Skip to content

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

Draft
miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-1d6e7d5-3.15
Draft

[3.15] gh-157146: Let linecache read sources from zip archives on sys.path (GH-157147)#157269
miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-1d6e7d5-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

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

…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 commented Sep 10, 2026

Copy link
Copy Markdown
Member

targeting 3.15.1

@gpshead gpshead self-assigned this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants