[pypy-issue] Issue #2259: Exceptions in atexit handlers are slightly scary looking (pypy/pypy)

Julian Berman issues-reply at bitbucket.org
Wed Mar 16 15:53:06 EDT 2016


New issue 2259: Exceptions in atexit handlers are slightly scary looking
https://bitbucket.org/pypy/pypy/issues/2259/exceptions-in-atexit-handlers-are-slightly

Julian Berman:


```
#!traceback

⊙  pypy -c 'import atexit; atexit.register(lambda : object().explode)'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/local/Cellar/pypy/5.0.0/libexec/lib-python/2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "<string>", line 1, in <lambda>
AttributeError: 'object' object has no attribute 'explode'
debug: OperationError:
debug:  operror-type: AttributeError
debug:  operror-value: 'object' object has no attribute 'explode'
```


is somewhat scary looking, it looks like the kind of output one would be used to seeing when PyPy crashes. I'm not sure if PyPy is crashing there or not (probably could tell by adding a second handler and seeing if it runs?) but compare to CPython:


```
#!traceback

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "<string>", line 1, in <lambda>
AttributeError: 'object' object has no attribute 'explode'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "<string>", line 1, in <lambda>
AttributeError: 'object' object has no attribute 'explode'
```

also not completely ideal, I'm not sure why it shows the traceback twice, but a bit less scary.




More information about the pypy-issue mailing list