Gregory P. Smith added the comment:

The problem appears to be that every zipimporter instance keeps its own 
reference to the zip files table of contents (self->files) instead of 
continually using the module wide zip_directory_cache but the zip_stat_cache is 
being maintained externally to that in a module wide fashion.

"import foo.bar" causes an "import foo" followed by an "import foo.bar" which 
uses a different zipimporter instance.  if it already exists, it's own 
self->files reference will be out of date despite the module global 
zip_stat_cache having been updated to say the TOC has been reread.

One solution to this would be to get rid of struct _zipimporter.files entirely 
and always use zip_directory_cache[self->archive] as the canonical single 
source for that.

"pro-tip" for anyone working on Python importers: You don't know how import 
works. Multiple instances of your importers will exist. If you think you know 
how import works, see the first statement again.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19081>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to