X Tutup
The Wayback Machine - https://web.archive.org/web/20220610214819/https://github.com/python/cpython/issues/93696
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdb cannot find source code for frozen stdlib modules #93696

Open
SnoopJeDi opened this issue Jun 10, 2022 · 0 comments
Open

pdb cannot find source code for frozen stdlib modules #93696

SnoopJeDi opened this issue Jun 10, 2022 · 0 comments
Labels
type-bug

Comments

@SnoopJeDi
Copy link
Contributor

@SnoopJeDi SnoopJeDi commented Jun 10, 2022

Bug report

Context: this issue came out of a discussion in #python on the Libera.chat IRC network, where a user wanted to peek into importlib._bootstrap with pdb while chasing a bug.

pdb is capable of stepping into function calls into frozen modules, but the list command cannot locate the source code necessary to display the source being stepped through.

# repro.py
import importlib._bootstrap

# some function call that we want to step into with pdb
importlib._bootstrap._resolve_name("os", ".", 1)
$ python3 -m pdb repro.py
> /home/snoopjedi/repro.py(2)<module>()
-> import importlib._bootstrap
(Pdb) n
> /home/snoopjedi/repro.py(5)<module>()
-> importlib._bootstrap._resolve_name("os", ".", 1)
(Pdb) s
--Call--
> <frozen importlib._bootstrap>(883)_resolve_name()
(Pdb) l
[EOF]

Note that executing source importlib._bootstrap from the frame that calls into this module does successfully locate the source, but this isn't very useful to a user of pdb.

I believe that bringing the frame's co_filename into agreement with the module's __file__ would fix this issue without changes to pdb (see #89815), but thought it would be good to track the issue with pdb in a separate ticket since that fix is more nuanced and I think I have an interim patch for the debugger.

Your environment

  • CPython versions tested on: 3.9.4, 3.11.0b3
  • Operating system and architecture: Ubuntu 20.04, x86_64
@SnoopJeDi SnoopJeDi added the type-bug label Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug
Projects
None yet
Development

No branches or pull requests

1 participant
X Tutup