Closed
Description
Bug report
Bug description:
tokenize._all_string_prefixes()
does not include t-string prefixes.
$ ./python.bat
Running Release|x64 interpreter...
Python 3.15.0a0 (heads/main-dirty:7b1a7002312, May 25 2025, 22:44:32) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tokenize
>>> tokenize._all_string_prefixes()
{'', 'rf', 'fR', 'rF', 'Br', 'BR', 'f', 'F', 'FR', 'Fr', 'Rf', 'rb', 'rB', 'u', 'U', 'R', 'fr', 'r', 'B', 'RB', 'bR', 'br', 'Rb', 'RF', 'b'}
>>> len(_)
25
This also affects tokenize.endpats
and tokenize.StringPrefix
.
CPython versions tested on:
3.15
Operating systems tested on:
Windows
Linked PRs
- gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. #134734
- [3.14] gh-134675: Add t-string prefixes to tokenizer module, lexical analysis doc, and add a test to make sure we catch this error in the future. (GH-134734) #134739