mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
[3.12] gh-105259: Ensure we don't show newline characters for trailing NEWLINE tokens (GH-105364) (#105367)
This commit is contained in:
parent
6f3a4fd4f2
commit
67b288f8be
5 changed files with 17 additions and 5 deletions
|
@ -243,10 +243,12 @@ tokenizeriter_next(tokenizeriterobject *it)
|
|||
}
|
||||
else if (type == NEWLINE) {
|
||||
Py_DECREF(str);
|
||||
if (it->tok->start[0] == '\r') {
|
||||
str = PyUnicode_FromString("\r\n");
|
||||
} else {
|
||||
str = PyUnicode_FromString("\n");
|
||||
if (!it->tok->implicit_newline) {
|
||||
if (it->tok->start[0] == '\r') {
|
||||
str = PyUnicode_FromString("\r\n");
|
||||
} else {
|
||||
str = PyUnicode_FromString("\n");
|
||||
}
|
||||
}
|
||||
end_col_offset++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue