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.
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.