You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deduplicate escape/quote scanning in f-string/t-string debug text handling #155516
Parser/lexer/string.c has two copies of the same escape-and-quote scanning logic in _PyLexer_set_ftstring_expr (one loop to detect a comment, one to strip it). The two loops drifting apart is what caused gh-154711 / #154914. Follow-up: factor the shared scanning logic into a small helper so the two loops can't diverge again.
It looks like this issue may have been made obsolete by the refactoring in #156484 (part of #153569).
The original report refers to two duplicated escape/quote scanning loops in _PyLexer_set_ftstring_expr(). However, that function no longer exists on main.
The current implementation uses finish_ftstring_expr() and _PyLexer_record_ftstring_comment(), with comment spans recorded during tokenization instead of the duplicated scanning logic described here.
Since the original duplication appears to have been eliminated by that refactoring, would it make sense to close this issue as obsolete?
Activity
Mystic-W commentedon Nov 13, 2026
It looks like this issue may have been made obsolete by the refactoring in #156484 (part of #153569).
The original report refers to two duplicated escape/quote scanning loops in
_PyLexer_set_ftstring_expr(). However, that function no longer exists onmain.The current implementation uses
finish_ftstring_expr()and_PyLexer_record_ftstring_comment(), with comment spans recorded during tokenization instead of the duplicated scanning logic described here.Since the original duplication appears to have been eliminated by that refactoring, would it make sense to close this issue as obsolete?
Please let me know if I'm missing anything.