From 2a75826a8ba6b329b9d0d09a0159a0fa0c25369d Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 24 Apr 2024 23:38:17 -0700 Subject: [PATCH] tweaks --- CHANGES.md | 2 ++ src/blib2to3/pgen2/tokenize.py | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 79e7b0b1444..17decf5fe05 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -26,6 +26,8 @@ +- Fix regression where certain complex f-strings failed to parse (#4332) + ### Performance diff --git a/src/blib2to3/pgen2/tokenize.py b/src/blib2to3/pgen2/tokenize.py index d920d0d7c01..07b2ebf6146 100644 --- a/src/blib2to3/pgen2/tokenize.py +++ b/src/blib2to3/pgen2/tokenize.py @@ -487,7 +487,7 @@ def _split_fstring_start_and_middle(token: str) -> Tuple[str, str]: class FStringState: - def __init__(self): + def __init__(self) -> None: self.stack: List[int] = [] def is_in_fstring(self) -> bool: @@ -496,9 +496,6 @@ def is_in_fstring(self) -> bool: def is_in_fstring_expression(self) -> bool: return bool(self.stack) and self.stack[-1] != STATE_MIDDLE - def is_in_middle(self) -> bool: - return bool(self.stack) and self.stack[-1] == STATE_MIDDLE - def current(self) -> int: if not self.stack: return STATE_NOT_FSTRING