Add f-string parsing for Python 3.12 (PEP 701) by encukou · Pull Request #1027 · python-babel/babel

@encukou mentioned this pull request

Sep 21, 2023

@encukou encukou changed the title Add F f-string parsing for Python 3.12 (PEP 701) Add f-string parsing for Python 3.12 (PEP 701)

Sep 21, 2023

@akx akx self-requested a review

September 21, 2023 18:30

@encukou @akx

Since Python 3.12, f-strings are tokenized and parsed like the rest
of Python's grammar, using the new tokens FSTRING_START, FSTRING_MIDDLE
and FSTRING_END.

Make the babel message extractor concatenate these three if they're
adjacent to each other. If they're not, that means there are dynamic
substitutions, so the f-string is ignored.

akx

akx approved these changes Oct 1, 2023

@akx akx enabled auto-merge (squash)

October 1, 2023 10:49

@encukou encukou deleted the py3.12-fstring-extraction branch

October 3, 2023 07:37