Issue 15911: can't step through _frozen_importlib/importlib._bootstrap using pdb
Issue15911
Created on 2012-09-10 19:30 by exarkun, last changed 2022-04-11 14:57 by admin.
| Messages (3) | |||
|---|---|---|---|
| msg170221 - (view) | Author: Jean-Paul Calderone (exarkun) * ![]() |
Date: 2012-09-10 19:30 | |
Debugging problems involving the frozen importlib._bootstrap is difficult, because the source for importlib._bootstrap is not available to pdb. The bootstrap code can be stepped through, but with only function names and line numbers available, not source lines. The value of having importlib written in Python would be greatly enhanced if it were more like a regular Python module that, eg, pdb could display source lines from. |
|||
| msg170224 - (view) | Author: Eric Snow (eric.snow) * ![]() |
Date: 2012-09-10 19:42 | |
This comes back to #14657, which addressed the frozen vs. non-frozen copies of importlib. It sounds like one useful solution for your situation would be for _frozen_importlib to be used only long enough for bootstrap purposes. This was discussed in that other issue. |
|||
| msg170301 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2012-09-11 13:09 | |
I'm going to guess this is a shortcoming of pdb when it comes to frozen modules as I can get to the source using inspect (which pdb leans on):: >>> len(inspect.findsource(_frozen_importlib)[0]) 1761 >>> len(inspect.findsource(importlib._bootstrap)[0]) 1761 Which are accurate line counts:: $ wc Lib/importlib/_bootstrap.py 1761 6236 62517 Lib/importlib/_bootstrap.py So why gdb can't output the source line when it has the line number of the file I don't know when it can already get access to the source without issue. And yes, debugging imports are hard. =) Still, it's better than before as you can easily toss in a print statement or two and then just regenerate the frozen object. But I do agree it would be nice to get gdb to play along with the whole situation (and thus the title change for this bug). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:35 | admin | set | github: 60115 |
| 2020-01-29 00:42:31 | brett.cannon | set | versions: + Python 3.9, - Python 3.4 |
| 2020-01-29 00:40:10 | brett.cannon | set | title: can't step through _frozen_importlib/importlib._bootstrap using gdb -> can't step through _frozen_importlib/importlib._bootstrap using pdb |
| 2012-12-18 02:14:29 | Arfrever | set | nosy:
+ Arfrever |
| 2012-09-11 13:09:40 | brett.cannon | set | versions:
+ Python 3.4, - Python 3.3 type: behavior nosy:
+ brett.cannon |
| 2012-09-10 19:42:31 | eric.snow | set | nosy:
+ eric.snow messages: + msg170224 |
| 2012-09-10 19:30:36 | exarkun | create | |
