You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Syntax warnings are duplicated in zipimport #141276
@serhiy-storchaka Sorry to bother you. I has found the root cause, but don't know whether to fix it or the best approach to fix it. Could you take a look at it?
I happened to stumble across this when noticing that modules loaded from pyc's with zipimport go through lookup and unmarshalling twice (once though get_filename and once through get_code).
There's a comment in get_filename about needing to get the code for the filename, so this seems intentional, but I'm not sure whether it is intentional to do the entire dance twice instead of some caching. @serhiy-storchaka let me know if this should be a separate issue (or isn't an issue at all).
Activity
typenoob commentedon Nov 11, 2025
The warnings are emitted both in
_frozen_importlib._find_specand_frozen_importlib._load_unlocked.I think warnings are not supposed to be emitted in
_frozen_importlib._find_spec.cpython/Lib/importlib/_bootstrap_external.py
Lines 576 to 586 in 92741c5
_frozen_importlib._find_specacquired the filename byget_filenamecpython/Lib/zipimport.py
Lines 158 to 167 in 92741c5
however it triggered the compile action which may be not intended?
cpython/Lib/zipimport.py
Lines 809 to 824 in 92741c5
If all we want is just the filename, there's no need to compile the code right?
typenoob commentedon Nov 26, 2025
@serhiy-storchaka Sorry to bother you. I has found the root cause, but don't know whether to fix it or the best approach to fix it. Could you take a look at it?
itamaro commentedon Nov 27, 2025
I happened to stumble across this when noticing that modules loaded from pyc's with zipimport go through lookup and unmarshalling twice (once though get_filename and once through get_code).
There's a comment in get_filename about needing to get the code for the filename, so this seems intentional, but I'm not sure whether it is intentional to do the entire dance twice instead of some caching.
@serhiy-storchaka let me know if this should be a separate issue (or isn't an issue at all).
pythongh-141276: Update zipimport warning expectations
harjothkhara commentedon Aug 23, 2026
#153799 fixes this by not compiling the source in
get_filename.pythongh-141276: Return before reading source in _get_module_code
pythongh-141276: Address round-2 review feedback on zipimport
Merge branch 'main' into codex/pythongh-141276-zipimport
gh-141276: Avoid compiling zipimport source in get_filename (#153799)
pythongh-141276: Avoid compiling zipimport source in get_filename (py…