Commit 2bd14030 authored by Jurko Gospodnetić's avatar Jurko Gospodnetić

fix clearing zipimport._zip_directory_cache on pypy

pypy uses a custom zipimport._zip_directory_cache implementation class that
does not support the complete dict interface, e.g. it does not support the
dict.pop() method.

For more detailed information see the following links:
  https://bitbucket.org/pypa/setuptools/issue/202/more-robust-zipimporter-cache-invalidation#comment-10495960
  https://bitbucket.org/pypy/pypy/src/dd07756a34a41f674c0cacfbc8ae1d4cc9ea2ae4/pypy/module/zipimport/interp_zipimport.py#cl-99

--HG--
extra : rebase_source : 95cff7946455f0a4422d97eecab11164a9ddef10
parent a82811aa
......@@ -1678,7 +1678,14 @@ def _replace_zip_directory_cache_data(normalized_path):
# documented anywhere and could in theory change with new Python releases)
# for no significant benefit.
for p in to_update:
old_entry = cache.pop(p)
# N.B. pypy uses a custom zipimport._zip_directory_cache implementation
# class that does not support the complete dict interface, e.g. it does
# not support the dict.pop() method. For more detailed information see
# the following links:
# https://bitbucket.org/pypa/setuptools/issue/202/more-robust-zipimporter-cache-invalidation#comment-10495960
# https://bitbucket.org/pypy/pypy/src/dd07756a34a41f674c0cacfbc8ae1d4cc9ea2ae4/pypy/module/zipimport/interp_zipimport.py#cl-99
old_entry = cache[p]
del cache[p]
zipimport.zipimporter(p)
old_entry.clear()
old_entry.update(cache[p])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment