FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-141276: Avoid compiling zipimport source in get_filename by harjothkhara · Pull Request #153799 · python/cpython · GitHub

/ cpython Public

gh-141276: Avoid compiling zipimport source in get_filename - #153799

Open
harjothkhara wants to merge 2 commits into
python:mainfrom
harjothkhara:codex/gh-141276-zipimport
Open

gh-141276: Avoid compiling zipimport source in get_filename#153799
harjothkhara wants to merge 2 commits into
python:mainfrom
harjothkhara:codex/gh-141276-zipimport

Conversation

harjothkhara commented Jul 16, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Summary

  • avoid compiling zipimport source while resolving a module filename
  • preserve bytecode validation and source fallback behavior
  • add a regression test and a NEWS entry

Root cause

zipimporter.get_filename() called _get_module_code(), which compiled source while import machinery was creating the module spec. Module execution then compiled the same source again.

Tests

  • ./python.exe -m test test_zipimport -m test_syntax_warning -m testBadMagic -m testBadMTime
  • ./python.exe -m test test_zipimport

Refs #141276

Duplicate-work check

No open or merged pull request referencing #141276 was found before submission.

AI assistance

OpenAI Codex assisted with investigation, implementation, testing, and review.

brettcannon removed their request for review July 17, 2026 19:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL