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 blueyed
Recipients blueyed, iritkatriel
Date 2021-09-07.12:22:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1631017324.88.0.543180250249.issue36550@roundup.psfhosted.org>
In-reply-to
Content
Given code like the following the try/except handling of Pdb (via `Cmd.onecmd`, see https://github.com/python/cpython/pull/4666) will mess with `sys.exc_info()`, which could be avoided:

```
try:
    raise ValueError()
except Exception as exc:
    e = exc
    __import__('pdb').set_trace()
```

```
% ./python t_issue36550.py
--Return--
> …/t_issue36550.py(5)<module>()->None
-> __import__('pdb').set_trace()
(Pdb) import sys; sys.exc_info()
(<class 'AttributeError'>, AttributeError("'Pdb' object has no attribute 'do_import'"), <traceback object at 0x7f92d2782500>)
```

The initial / better motivation was described in the original issue: with pdb++/pdbpp I want to display tracebacks/errors with errors that might occur via Pdb's prompt, where this then showed up as interfering with it.

(Sorry for not responding on https://github.com/python/cpython/pull/4666 earlier, but I think it is only part of this issue, and therefore it should not get closed, and also creating a new one instead does not sound useful to me, so please consider to re-open it instead.)
History
Date User Action Args
2021-09-07 12:22:04blueyedsetrecipients: + blueyed, iritkatriel
2021-09-07 12:22:04blueyedsetmessageid: <1631017324.88.0.543180250249.issue36550@roundup.psfhosted.org>
2021-09-07 12:22:04blueyedlinkissue36550 messages
2021-09-07 12:22:04blueyedcreate