mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
bpo-41031: Match C and Python code formatting of unprintable exceptions and exceptions in the __main__ module. (GH-28139)
This commit is contained in:
parent
b01fd533fe
commit
9e31b3952f
6 changed files with 55 additions and 14 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue