Skip to content

Commit 526f5c3

Browse files
committed
gh-143201: warnings writes the full source line instead of the truncated one
The truncated object is meant to be written instead.
1 parent a1c6308 commit 526f5c3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Print out the truncated line, not the raw sourceline.

Python/_warnings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ show_warning(PyThreadState *tstate, PyObject *filename, int lineno,
697697
if (truncated == NULL)
698698
goto error;
699699

700-
PyFile_WriteObject(sourceline, f_stderr, Py_PRINT_RAW);
700+
PyFile_WriteObject(truncated, f_stderr, Py_PRINT_RAW);
701701
Py_DECREF(truncated);
702702
PyFile_WriteString("\n", f_stderr);
703703
}

0 commit comments

Comments
 (0)