summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
authorJames Gerity <snoopjedi@gmail.com>2022-10-25 13:22:53 (GMT)
committerGitHub <noreply@github.com>2022-10-25 13:22:53 (GMT)
commitd91de288e73c67805e4c838b5f770ab7ec3661f9 (patch)
treeb35272b46a434fb805ce28b4bbea0345e218a644 /Lib/pdb.py
parentdd13b23e49b8c49bc751fe5ed470773a2d60b7d1 (diff)
downloadcpython-d91de288e73c67805e4c838b5f770ab7ec3661f9.zip
cpython-d91de288e73c67805e4c838b5f770ab7ec3661f9.tar.gz
cpython-d91de288e73c67805e4c838b5f770ab7ec3661f9.tar.bz2
gh-93696: Locate frozen module source with __file__ (#93697)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index b0acb1f..78d0ce5 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -1332,6 +1332,12 @@ class Pdb(bdb.Bdb, cmd.Cmd):
if last is None:
last = first + 10
filename = self.curframe.f_code.co_filename
+ # gh-93696: stdlib frozen modules provide a useful __file__
+ # this workaround can be removed with the closure of gh-89815
+ if filename.startswith("<frozen"):
+ tmp = self.curframe.f_globals.get("__file__")
+ if isinstance(tmp, str):
+ filename = tmp
breaklist = self.get_file_breaks(filename)
try:
lines = linecache.getlines(filename, self.curframe.f_globals)