In 3.14, the t-string is supported, but the IDLE still hardcodes the string prefix pattern (r, u, b, f, rb, br, fr, rf),
but does not delegate to the standard tokenize module.
The question of the hardcodes cannot fix quickly. However, change the code in make_pat here can fix the question above:
stringprefix=r"(?i:r|u|f|t|fr|rf|b|br|rb|rt|tr)?"
If there are more supported combinations we can add them.
Thank you for detailing both the issue and the proposed fix! Are you planning to submit a pull request for this, or is it open for others to work on? I’d like to help if the opportunity is available.
The change for the "test_colorizer.py" seems to be difficult. Only adding the line will cause the full test fail. Maybe it need the exactly line and offset for the new test source.
Activity
Anuradha-Agrawal-07 commented on Oct 8, 2025
Thank you for detailing both the issue and the proposed fix! Are you planning to submit a pull request for this, or is it open for others to work on? I’d like to help if the opportunity is available.
terryjreedy commented on Oct 8, 2025
Initial PR patches must be against main branch unless main should not be changed (rare).
Insert 't' blocks based on and parallel to 'f' blocks. In colorizer.py:
stringprefix = r"(?i:r|u|f|fr|rf|t|tr|rt|b|br|rb)?"
The 'source' definition in idlelib/idle_test/test_colorizer.py has these two lines.
r'x', u'x', R'x', U'x', f'x', F'x' fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'Add 2 't' entries at the end of the first line and a 't' line after the second, 'f', line.
Blurb: "Colorize t-string prefixes, as done with f-string prefixes."
Locked-chess-official commented on Oct 8, 2025
The change for the "test_colorizer.py" seems to be difficult. Only adding the line will cause the full test fail. Maybe it need the exactly line and offset for the new test source.
gh-139742: Add support for Python 3.14 t-string prefixes in IDLE colo…
pythongh-139742: Add support for Python 3.14 t-string prefixes in IDL…
pythongh-139742: Add support for Python 3.14 t-string prefixes in IDL…
[3.14] gh-139742: Add support for Python 3.14 t-string prefixes in ID…