Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Apr 25, 2024
1 parent 0e93995 commit 2a75826
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

<!-- Changes to the parser or to version autodetection -->

- Fix regression where certain complex f-strings failed to parse (#4332)

### Performance

<!-- Changes that improve Black's performance. -->
Expand Down
5 changes: 1 addition & 4 deletions src/blib2to3/pgen2/tokenize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 2a75826

Please sign in to comment.