Message408910
Unless I missed it, looking at https://github.com/python/cpython/blob/main/Lib/pdb.py, https://github.com/python/cpython/blob/main/Lib/inspect.py, and https://docs.python.org/3/library/pdb.html doesn't give much of a clue how to provide sources to exec-generated code.
I may have misread, but pdb *seems* to lean on inspect.findsource which eventually excludes sources that match `^<.*>$` (like `<string>`).
Running attached test_case.py:
% python test_case.py
> <string>(4)foo()
(Pdb) l
[EOF]
(Pdb) c
inspect.getfile(<function foo at 0x10b735160>): <string>
calling inspect.findsource(<function foo at 0x10b735160>) ...
Traceback (most recent call last):
File "/Users/matt/Documents/dev/numerary/test_case.py", line 12, in <module>
foo()
File "/Library/Frameworks/MacPorts-20200907/Python.framework/Versions/3.9/lib/python3.9/inspect.py", line 835, in findsource
raise OSError('could not get source code')
OSError: could not get source code |
|
Date |
User |
Action |
Args |
2021-12-19 16:17:53 | posita | set | recipients:
+ posita |
2021-12-19 16:17:53 | posita | set | messageid: <1639930673.95.0.69918856393.issue46133@roundup.psfhosted.org> |
2021-12-19 16:17:53 | posita | link | issue46133 messages |
2021-12-19 16:17:53 | posita | create | |
|