[New-bugs-announce] [issue45635] Tidy up error handling in traceback.c / python run.c

Irit Katriel report at bugs.python.org
Wed Oct 27 17:27:06 EDT 2021


New submission from Irit Katriel <iritkatriel at gmail.com>:

They do things like 

    err = PyFile_WriteString("TypeError: print_exception(): Exception expected for value, ", f);
    err += PyFile_WriteString(Py_TYPE(value)->tp_name, f);
    err += PyFile_WriteString(" found\n", f);

which means that PyFile_XXX functions are called after error. They should return (abort printing the exception) instead.


It gets even more interesting with PyFile_WriteObject calls - this function asserts that the exception is not set, so the code calls PyErr_Clear() before calling PyFile_WriteObject(). It should avoid making the call altogether.

----------
assignee: iritkatriel
messages: 405126
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Tidy up error handling in traceback.c / python run.c

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45635>
_______________________________________


More information about the New-bugs-announce mailing list