[New-bugs-announce] [issue41031] Inconsistency in C and python traceback printers

Michael Simacek report at bugs.python.org
Fri Jun 19 04:54:18 EDT 2020


New submission from Michael Simacek <michael.simacek at oracle.com>:

I belive the python traceback module was designed to produce the same output as the internal exception printer (sys.__excepthook__), but this is not the case when the exception's __str__ raises an exception.

Given an exception of the following class:
class E(Exception):
   def __str__(self):
      raise RuntimeError

Internal printer output:
Traceback (most recent call last):
  File "inconsistent.py", line 6, in <module>
    raise E()
__main__.E: <exception str() failed>

traceback.print_exc output:
Traceback (most recent call last):
  File "inconsistent.py", line 6, in <module>
    raise E()
E: <unprintable E object>

----------
components: Library (Lib)
messages: 371855
nosy: msimacek
priority: normal
severity: normal
status: open
title: Inconsistency in C and python traceback printers
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41031>
_______________________________________


More information about the New-bugs-announce mailing list