GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — untokenize() round-trip fails for t-strings (with only type + string) · Issue #134582 · python/cpython Closed Labels 3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:Found when investigating test.test_tokenize.TestRoundtrip.test_random_files failing on #134577 def test(code): tokens = list(tokenize.tokenize(iter([code]).__next__)) from5 = tokenize.untokenize(tokens) print("from5 ", from5, eval(from5)) tokens2 = [tok[:2] for tok in tokens] from2 = tokenize.untokenize(tokens2) print("from2 ", from2, eval(from2)) >>> test(b't"{ {} }"') from5 b't"{ {} }"' Template(strings=('', ''), interpolations=(Interpolation({}, ' {}', None, ''),)) from2 b't"{{}}"' Template(strings=('{}',), interpolations=()) >>> test(b'f"{ {} }"') from5 b'f"{ {} }"' {} from2 b'f"{ {} }"' {} From what I understand, untokenize should round-trip correctly even with only the type and string of tokens. CPython versions tested on:CPython main branch Operating systems tested on:macOS Linked PRsActivity
MetadataMetadataAssigneesLabels3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |