Skip to content

[3.14] gh-157146: Let linecache read sources from zip archives on sys.path (GH-157147) - #159213

Merged
gpshead merged 1 commit into
python:3.14from
gpshead:backport-1d6e7d5-3.14
Oct 12, 2026
Merged

gpshead merged 1 commit into
python:3.14from
gpshead:backport-1d6e7d5-3.14

Conversation

@gpshead

@gpshead gpshead commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

linecache.getline() now works for a .zip archive on sys.path without the caller having to pass module_globals. Callers that only have a file name, such as pdb, warnings, and doctest, now get source. Reads of such files go through the get_data() method of the path entry finder registered for the archive in sys.path_importer_cache.

Prior to this: os.stat() would fail on the archive-internal path, the loader lookup needed the globals, and the sys.path search would only handle relative names and assumed a filesystem rather than using an importer. (cherry picked from commit 1d6e7d5)

…on sys.path (pythonGH-157147)

linecache.getline() now works for a .zip archive on sys.path without the caller having to pass module_globals. Callers that only have a file name, such as pdb, warnings, and doctest, now get source. Reads of such files go through the get_data() method of the path entry finder registered for the archive in sys.path_importer_cache.

Prior to this: os.stat() would fail on the archive-internal path, the loader lookup needed the globals, and the sys.path search would only handle relative names and assumed a filesystem rather than using an importer.
(cherry picked from commit 1d6e7d5)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
@gpshead gpshead self-assigned this Oct 12, 2026
@gpshead
gpshead marked this pull request as ready for review October 12, 2026 03:50
@gpshead
gpshead enabled auto-merge (squash) October 12, 2026 03:53
@gpshead
gpshead merged commit 6947564 into python:3.14 Oct 12, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant