summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-10-25 13:49:34 (GMT)
committerGitHub <noreply@github.com>2022-10-25 13:49:34 (GMT)
commit65f9c8e6dda177925346b8e846995cd5b1552167 (patch)
tree749cfbe590537f721f553dff013437d3d57666bf /Lib/pdb.py
parentc96c7630c50037d1fc075aa7ca10e03a4d777f80 (diff)
downloadcpython-65f9c8e6dda177925346b8e846995cd5b1552167.zip
cpython-65f9c8e6dda177925346b8e846995cd5b1552167.tar.gz
cpython-65f9c8e6dda177925346b8e846995cd5b1552167.tar.bz2
gh-93696: Locate frozen module source with __file__ (GH-93697)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> (cherry picked from commit d91de288e73c67805e4c838b5f770ab7ec3661f9) Co-authored-by: James Gerity <snoopjedi@gmail.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 fe8ddd1..411ce53 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)