Fix T97731: Python traceback no longer includes line-numbers

Regression caused by [0] that caused the error message to be
created based on a normalized exception (which hid line numbers).

PyC_ExceptionBuffer{_Simple} & BPy_errors_to_report
no longer clears the exception.

This could have been resolved by changing python_script_error_jump
however that would involve changes to reference counting that are more
risky (noted in code-comment).

[0]: 2d2baeaf04
This commit is contained in:
2022-05-03 17:54:37 +10:00
parent a821a2db3d
commit 74dfb7ca23
7 changed files with 26 additions and 16 deletions

View File

@@ -165,6 +165,10 @@ finally:
bool python_script_error_jump(
const char *filepath, int *r_lineno, int *r_offset, int *r_lineno_end, int *r_offset_end)
{
/* WARNING(@campbellbarton): The normalized exception is restored (loosing line number info).
* Ideally this would leave the exception state as it found it, but that needs to be done
* carefully with regards to reference counting, see: T97731. */
bool success = false;
PyObject *exception, *value;
PyTracebackObject *tb;