Skip to content

Deduplicate escape/quote scanning in f-string/t-string debug text handling #155516

Description

@ArneshBanerjee

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-parsertype-refactorCode refactoring (with no changes in behavior)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions