diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-09-05 16:54:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-05 18:54:13 +0300 |
commit | 9e31b3952f6101ef71ec029481b972169ab0e0f1 (patch) | |
tree | b325ae97e170eafbdb9b58a5cc1755446c5667b5 /Python/errors.c | |
parent | b01fd533fef78b088674bad73267b89bea98e904 (diff) | |
download | cpython-git-9e31b3952f6101ef71ec029481b972169ab0e0f1.tar.gz |
bpo-41031: Match C and Python code formatting of unprintable exceptions and exceptions in the __main__ module. (GH-28139)
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/errors.c b/Python/errors.c index 15ca21b684..b2030f728a 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; |