bpo-43950: ensure source_line is present when specialising the traceback (GH-27313)

This commit is contained in:
Batuhan Taskaya 2021-07-24 15:50:19 +03:00 committed by GitHub
parent a22b05da87
commit c8362314cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View file

@ -699,11 +699,11 @@ tb_displayline(PyTracebackObject* tb, PyObject *f, PyObject *filename, int linen
Py_DECREF(line);
if (err != 0)
return err;
int truncation = _TRACEBACK_SOURCE_LINE_INDENT;
PyObject* source_line = NULL;
if (_Py_DisplaySourceLine(f, filename, lineno, _TRACEBACK_SOURCE_LINE_INDENT,
&truncation, &source_line) != 0) {
&truncation, &source_line) != 0 || !source_line) {
/* ignore errors since we can't report them, can we? */
err = ignore_source_errors();
goto done;