@@ -288,9 +288,7 @@ def __repr__(self):
288288
289289# _zip_searchorder defines how we search for a module in the Zip
290290# archive: we first search for a package __init__, then for
291- # non-package .pyc, and .py entries. The .pyc entries
292- # are swapped by initzipimport() if we run in optimized mode. Also,
293- # '/' is replaced by path_sep there.
291+ # non-package .pyc, and .py entries.
294292_zip_searchorder = (
295293 (path_sep + '__init__.pyc' , True , True ),
296294 (path_sep + '__init__.py' , False , True ),
@@ -616,7 +614,7 @@ def _read_directory(archive):
616614def _get_decompress_func ():
617615 global _importing_zlib
618616 if _importing_zlib :
619- # Someone has a zlib.py[co] in their Zip file
617+ # Someone has a zlib.pyc in their Zip file
620618 # let's avoid a stack overflow.
621619 _bootstrap ._verbose_message ('zipimport: zlib UNAVAILABLE' )
622620 raise ZipImportError ("can't decompress data; zlib not available" )
@@ -685,9 +683,9 @@ def _eq_mtime(t1, t2):
685683 return abs (t1 - t2 ) <= 1
686684
687685
688- # Given the contents of a .py[co] file, unmarshal the data
689- # and return the code object. Raises ImportError it the magic word doesn't
690- # match, or if the recorded .py[co] metadata does not match the source .
686+ # Given the contents of a .pyc file, unmarshal the data
687+ # and return the code object. Raises ImportError if the magic word doesn't
688+ # match, or if the recorded .pyc hash fails validation .
691689def _unmarshal_code (self , pathname , fullpath , fullname , data ):
692690 exc_details = {
693691 'name' : fullname ,
@@ -761,8 +759,8 @@ def _parse_dostime(d, t):
761759# or (0, 0) if no source is available.
762760def _get_mtime_and_size_of_source (self , path ):
763761 try :
764- # strip 'c' or 'o' from *.py[co]
765- assert path [ - 1 :] in ( 'c' , 'o ' )
762+ # strip 'c' from *.pyc
763+ assert path . endswith ( '.pyc ' )
766764 path = path [:- 1 ]
767765 toc_entry = self ._get_files ()[path ]
768766 # fetch the time stamp of the .py file for comparison
@@ -779,8 +777,8 @@ def _get_mtime_and_size_of_source(self, path):
779777# contents of the matching .py file, or None if no source
780778# is available.
781779def _get_pyc_source (self , path ):
782- # strip 'c' or 'o' from *.py[co]
783- assert path [ - 1 :] in ( 'c' , 'o ' )
780+ # strip 'c' from *.pyc
781+ assert path . endswith ( '.pyc ' )
784782 path = path [:- 1 ]
785783
786784 try :
0 commit comments