mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
gh-93696: Locate frozen module source with __file__ (#93697)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
parent
dd13b23e49
commit
d91de288e7
3 changed files with 53 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue