[New-bugs-announce] [issue31418] assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__

Oren Milman report at bugs.python.org
Mon Sep 11 08:49:19 EDT 2017


New submission from Oren Milman:

The following code causes an assertion failure in PyErr_WriteUnraisable() (in
Python/errors.c):

class BadException(Exception):
    __module__ = None

class BadClass:
    def __del__(self):
        raise BadException

foo = BadClass()
del foo


this is because PyErr_WriteUnraisable() assumes that __module__ is a string,
and passes it to _PyUnicode_EqualToASCIIId(), which asserts it received a string.


what is the wanted behavior in such a case?
should we ignore the bad __module__ and print '<unknown>' as the module name
in the traceback?

----------
components: Interpreter Core
messages: 301872
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: assertion failure in PyErr_WriteUnraisable() in case of an exception with a bad __module__
type: crash
versions: Python 3.7

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


More information about the New-bugs-announce mailing list