[issue10756] Error in atexit._run_exitfuncs [...] Exception expected for value, str found

Andreas Stührk report at bugs.python.org
Sat Dec 25 18:20:23 CET 2010


Andreas Stührk <andy-python at hammerhartes.de> added the comment:

It's because `PyErr_Fetch()` which is used in `atexit_callfuncs()` can return an unnormalized exception (e.g. if the exception is set with `PyErr_SetString()`. "value" is then a string). A simple call to `PyErr_NormalizeException()` fixes this issue.

Attached is a patch which fixes the issue and adds a test for it. I used exactly the same code ("1 / 0") to raise the exception, as I don't know if there is some clean way to raise an unnormalized exception.

----------
keywords: +patch
nosy: +Trundle
Added file: http://bugs.python.org/file20163/issue10756_normalize_exceptions.diff

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


More information about the Python-bugs-list mailing list