This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author posita
Recipients posita
Date 2021-12-19.16:17:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1639930673.95.0.69918856393.issue46133@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-12-19 16:17:53positasetrecipients: + posita
2021-12-19 16:17:53positasetmessageid: <1639930673.95.0.69918856393.issue46133@roundup.psfhosted.org>
2021-12-19 16:17:53positalinkissue46133 messages
2021-12-19 16:17:53positacreate