mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.12] gh-105564: Don't include artificial newlines in the line attribute of tokens (GH-105565) (#105579)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
97d846dc2b
commit
16b1cdc87c
3 changed files with 13 additions and 8 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