mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-105564: Don't include artificial newlines in the line attribute of tokens (#105565)
This commit is contained in:
parent
1dd267af64
commit
d7f46bcd98
4 changed files with 30 additions and 25 deletions
|
@ -206,6 +206,9 @@ tokenizeriter_next(tokenizeriterobject *it)
|
|||
line = PyUnicode_FromString("");
|
||||
} else {
|
||||
Py_ssize_t size = it->tok->inp - line_start;
|
||||
if (size >= 1 && it->tok->implicit_newline) {
|
||||
size -= 1;
|
||||
}
|
||||
line = PyUnicode_DecodeUTF8(line_start, size, "replace");
|
||||
}
|
||||
if (line == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue