[New-bugs-announce] [issue18776] atexit error display behavior changed in python 3

Doug Hellmann report at bugs.python.org
Mon Aug 19 01:07:59 CEST 2013


New submission from Doug Hellmann:

Under python 2 when an atexit callback raised an exception the full traceback was displayed. Under python 3, only the summary of the exception is shown.

Input file:

import atexit


def exit_with_exception(message):
    raise RuntimeError(message)

atexit.register(exit_with_exception, 'Registered first')
atexit.register(exit_with_exception, 'Registered second')


Python 2:

$ python2.7 source/atexit/atexit_exception.py
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "source/atexit/atexit_exception.py", line 36, in exit_with_exception
    raise RuntimeError(message)
RuntimeError: Registered second
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "source/atexit/atexit_exception.py", line 36, in exit_with_exception
    raise RuntimeError(message)
RuntimeError: Registered first
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "source/atexit/atexit_exception.py", line 36, in exit_with_exception
    raise RuntimeError(message)
RuntimeError: Registered first

Python 3:

$ python3.3 source/atexit/atexit_exception.py
Error in atexit._run_exitfuncs:
RuntimeError: Registered second
Error in atexit._run_exitfuncs:
RuntimeError: Registered first

----------
messages: 195586
nosy: doughellmann
priority: normal
severity: normal
status: open
title: atexit error display behavior changed in python 3
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18776>
_______________________________________


More information about the New-bugs-announce mailing list