aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhan@python.org>2021-07-24 15:50:19 +0300
committerGitHub <noreply@github.com>2021-07-24 13:50:19 +0100
commitc8362314cce53a5b59da7523fbdfa00f122aa319 (patch)
tree5d2df73bd5b7ac436b1fbb15242e4bed12ce5476 /Python
parenta22b05da87bdfb081d6aaecfce136ae8dbb8680c (diff)
downloadcpython-c8362314cce53a5b59da7523fbdfa00f122aa319.tar.gz
cpython-c8362314cce53a5b59da7523fbdfa00f122aa319.zip
bpo-43950: ensure source_line is present when specialising the traceback (GH-27313)
Diffstat (limited to 'Python')
-rw-r--r--Python/traceback.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index e02caef6f9b..9418236abbf 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -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;