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 <rep...@bugs.python.org>
<https://bugs.python.org/issue31418>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to