]> granicus.if.org Git - python/commit
Fixes issue19081: When a zipimport .zip file in sys.path being imported
authorGregory P. Smith <greg@krypto.org>
Mon, 6 Jan 2014 17:46:46 +0000 (09:46 -0800)
committerGregory P. Smith <greg@krypto.org>
Mon, 6 Jan 2014 17:46:46 +0000 (09:46 -0800)
commitb48c5d5107245f679b34091e43488f8c1465cb21
treebe610e49dd7c70b0140bb067554765b19f3ee65b
parent875565bbd602825fd24eab2978ea4a7f81cfd7cc
Fixes issue19081: When a zipimport .zip file in sys.path being imported
from is modified during the lifetime of the Python process after
zipimport has already opened and cached the zip's table of contents
it now fstat's the file after opening it upon every attempt to access
anything within and will re-read the table of contents if the .zip file
inode, size or mtime have changed.

It would've been nicer to hold any .zip file used by zipimport open for the
duration of the process but that would be more invasive and add an additional
open file descriptor to all zipimport using processes.  It also would likely
not fix the problem on Windows due to different filesystem semantics.
Lib/test/test_zipimport.py
Modules/zipimport.c