From 44648a371445eaf42a19ef7418ae7438cc3b7286 Mon Sep 17 00:00:00 2001 From: Tim Conley Date: Mon, 20 Oct 2025 09:40:08 -0700 Subject: [PATCH 1/3] Linecache source is unavailable for frozen modules when global modules is None --- Lib/linecache.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/linecache.py b/Lib/linecache.py index ef73d1aa99774a..ef3b2d9136b4d2 100644 --- a/Lib/linecache.py +++ b/Lib/linecache.py @@ -123,9 +123,12 @@ def updatecache(filename, module_globals=None): if _source_unavailable(filename): return [] - if filename.startswith(' Date: Tue, 28 Oct 2025 17:43:53 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst diff --git a/Misc/NEWS.d/next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst b/Misc/NEWS.d/next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst new file mode 100644 index 00000000000000..1b130f6e4e88af --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst @@ -0,0 +1 @@ +LineCache - Avoid making useless filesystem calls for frozen modules when the global module cache is not present. From 405ea8f210a0ea9b21440c0686924a14dab0bfb9 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Tue, 28 Oct 2025 22:21:30 -0700 Subject: [PATCH 3/3] Update linecache documentation for frozen modules --- .../next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst b/Misc/NEWS.d/next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst index 1b130f6e4e88af..b3b692bae62c5d 100644 --- a/Misc/NEWS.d/next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst +++ b/Misc/NEWS.d/next/Library/2025-10-28-17-43-51.gh-issue-140228.8kfHhO.rst @@ -1 +1 @@ -LineCache - Avoid making useless filesystem calls for frozen modules when the global module cache is not present. +Avoid making unnecessary filesystem calls for frozen modules in :mod:`linecache` when the global module cache is not present.