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