Skip to content

Commit b88cbbe

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 7a91841 commit b88cbbe

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

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
@@ -698,7 +698,7 @@ show_warning(PyThreadState *tstate, PyObject *filename, int lineno,
698698
if (truncated == NULL)
699699
goto error;
700700

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

0 commit comments

Comments
 (0)