Message302348
The following code causes an assertion failure:
import os
os.__name__ = None
os.does_not_exist
this is because module_getattro() (in Objects/moduleobject.c) assumes that
__name__ is a string, and passes it to PyErr_Format(), which asserts it is a
string.
if we fixed that one (so that the code above would raise an AttributeError),
the following code would still cause an assertion failure:
import os
os.__name__ = None
from os import does_not_exist
this is because import_from() (in Python/ceval.c) also assumes that __name__
is a string, and passes it to PyUnicode_FromFormat(), which asserts it is a
string.
BTW, while we are in module_getattro(): isn't the second call to PyErr_Clear()
redundant? (Ethan, IIUC, you worked on this as part of #8297 some years ago..) |
|
Date |
User |
Action |
Args |
2017-09-16 18:00:45 | Oren Milman | set | recipients:
+ Oren Milman, ethan.furman |
2017-09-16 18:00:45 | Oren Milman | set | messageid: <1505584845.12.0.793382405796.issue31492@psf.upfronthosting.co.za> |
2017-09-16 18:00:45 | Oren Milman | link | issue31492 messages |
2017-09-16 18:00:44 | Oren Milman | create | |
|