diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/errors.c | 4 | ||||
-rw-r--r-- | Python/pythonrun.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c index 15ca21b..b2030f7 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -25,6 +25,7 @@ extern char *strerror(int); extern "C" { #endif +_Py_IDENTIFIER(__main__); _Py_IDENTIFIER(__module__); _Py_IDENTIFIER(builtins); _Py_IDENTIFIER(stderr); @@ -1297,7 +1298,8 @@ write_unraisable_exc_file(PyThreadState *tstate, PyObject *exc_type, } } else { - if (!_PyUnicode_EqualToASCIIId(modulename, &PyId_builtins)) { + if (!_PyUnicode_EqualToASCIIId(modulename, &PyId_builtins) && + !_PyUnicode_EqualToASCIIId(modulename, &PyId___main__)) { if (PyFile_WriteObject(modulename, file, Py_PRINT_RAW) < 0) { Py_DECREF(modulename); return -1; diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 3d07f43..0e0262c 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -35,6 +35,7 @@ #endif +_Py_IDENTIFIER(__main__); _Py_IDENTIFIER(builtins); _Py_IDENTIFIER(excepthook); _Py_IDENTIFIER(flush); @@ -974,7 +975,8 @@ print_exception(PyObject *f, PyObject *value) err = PyFile_WriteString("<unknown>", f); } else { - if (!_PyUnicode_EqualToASCIIId(modulename, &PyId_builtins)) + if (!_PyUnicode_EqualToASCIIId(modulename, &PyId_builtins) && + !_PyUnicode_EqualToASCIIId(modulename, &PyId___main__)) { err = PyFile_WriteObject(modulename, f, Py_PRINT_RAW); err += PyFile_WriteString(".", f); |