From 6bd96894269be4754a811fb8ea1e3b627a676562 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Wed, 2 Apr 2025 19:50:01 -0400 Subject: gh-60115: Support frozen modules for linecache.getline() (#131638) --- Doc/library/linecache.rst | 8 ++++++++ Doc/whatsnew/3.14.rst | 7 +++++++ Lib/linecache.py | 21 +++++++++++++++++++-- Lib/test/test_linecache.py | 13 +++++++++++++ .../2025-03-23-18-39-07.gh-issue-60115.AWdcmq.rst | 1 + 5 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2025-03-23-18-39-07.gh-issue-60115.AWdcmq.rst diff --git a/Doc/library/linecache.rst b/Doc/library/linecache.rst index 88c6079..e766a92 100644 --- a/Doc/library/linecache.rst +++ b/Doc/library/linecache.rst @@ -30,6 +30,10 @@ The :mod:`linecache` module defines the following functions: .. index:: triple: module; search; path + If *filename* indicates a frozen module (starting with ``'') + and not filename.startswith('')): + if _source_unavailable(filename): return [] - fullname = filename + if filename.startswith('