Skip to content

Commit

Permalink
pythongh-125588: Allow to regenerate the parser with Python < 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogsal committed Dec 15, 2024
1 parent 7b8bd3b commit 9b16996
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Tools/peg_generator/pegen/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def string(self) -> Optional[tokenize.TokenInfo]:

@memoize
def fstring_start(self) -> Optional[tokenize.TokenInfo]:
FSTRING_START = getattr(token, "FSTRING_START")
FSTRING_START = getattr(token, "FSTRING_START", None)
if not FSTRING_START:
return None
tok = self._tokenizer.peek()
Expand All @@ -217,7 +217,7 @@ def fstring_start(self) -> Optional[tokenize.TokenInfo]:

@memoize
def fstring_middle(self) -> Optional[tokenize.TokenInfo]:
FSTRING_MIDDLE = getattr(token, "FSTRING_MIDDLE")
FSTRING_MIDDLE = getattr(token, "FSTRING_MIDDLE", None)
if not FSTRING_MIDDLE:
return None
tok = self._tokenizer.peek()
Expand All @@ -227,7 +227,7 @@ def fstring_middle(self) -> Optional[tokenize.TokenInfo]:

@memoize
def fstring_end(self) -> Optional[tokenize.TokenInfo]:
FSTRING_END = getattr(token, "FSTRING_END")
FSTRING_END = getattr(token, "FSTRING_END", None)
if not FSTRING_END:
return None
tok = self._tokenizer.peek()
Expand Down

0 comments on commit 9b16996

Please sign in to comment.