@@ -163,7 +163,8 @@ def get_filename(self, fullname):
163163 """
164164 # Deciding the filename requires working out where the code
165165 # would come from if the module was actually loaded
166- code , ispackage , modpath = _get_module_code (self , fullname )
166+ _ , _ , modpath = _get_module_code (
167+ self , fullname , compile_source = False )
167168 return modpath
168169
169170
@@ -793,9 +794,9 @@ def _get_pyc_source(self, path):
793794 return _get_data (self .archive , toc_entry )
794795
795796
796- # Get the code object associated with the module specified by
797- # 'fullname' .
798- def _get_module_code (self , fullname ):
797+ # Get the code object associated with the module specified by 'fullname'.
798+ # If compile_source is false, return None for source code without compiling it .
799+ def _get_module_code (self , fullname , * , compile_source = True ):
799800 path = _get_module_path (self , fullname )
800801 import_error = None
801802 for suffix , isbytecode , ispackage in _zip_searchorder :
@@ -815,6 +816,8 @@ def _get_module_code(self, fullname):
815816 except ImportError as exc :
816817 import_error = exc
817818 else :
819+ if not compile_source :
820+ return None , ispackage , modpath
818821 code = _compile_source (modpath , data , fullname )
819822 if code is None :
820823 # bad magic number or non-matching mtime
0 commit comments