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.

classification
Title: PDB pm function throws exception without sys import
Type: behavior Stage: resolved
Components: Library (Lib), macOS Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: ThePokestarFan, ned.deily, ronaldoussoren, zach.ware
Priority: normal Keywords:

Created on 2020-01-04 00:04 by ThePokestarFan, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg359264 - (view) Author: (ThePokestarFan) * Date: 2020-01-04 00:04
When testing PDB in python 3.8.1, PDB throws an exception when I call the pm() function in PDB without importing system.

[Fresh session]
>>> import pdb
>>> pdb.pm()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pdb.py", line 1631, in pm
    post_mortem(sys.last_traceback)
AttributeError: module 'sys' has no attribute 'last_traceback'
>>> import sys
>>> pdb.pm()
> /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/pdb.py(1631)pm()
-> post_mortem(sys.last_traceback)
...
msg359266 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2020-01-04 00:11
Try varying the order of what you're doing there:

>>> import pdb, sys
>>> pdb.pm()
Traceback ...
>>> pdb.pm()
<post-mortem of the exception raised by the first call to pdb.pm()>

See https://docs.python.org/3/library/sys.html#sys.last_traceback, which notes that this attribute is not always present (it won't be if no exception has been raised).
History
Date User Action Args
2022-04-11 14:59:24adminsetgithub: 83389
2020-01-04 00:11:39zach.waresetstatus: open -> closed

nosy: + zach.ware
messages: + msg359266

resolution: not a bug
stage: resolved
2020-01-04 00:04:37ThePokestarFancreate