mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-105259: Ensure we don't show newline characters for trailing NEWLINE tokens (#105364)
This commit is contained in:
parent
0202aa002e
commit
c0a6ed3934
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