]> git.ipfire.org Git - thirdparty/babel.git/commit
Add f-string parsing for Python 3.12 (PEP 701) py3.12-fstring-extraction
authorPetr Viktorin <encukou@gmail.com>
Thu, 21 Sep 2023 10:45:32 +0000 (12:45 +0200)
committerAarni Koskela <akx@iki.fi>
Sun, 1 Oct 2023 10:45:34 +0000 (13:45 +0300)
commit1f06b3616f44bbd87a3c9df274225d431c01ae6e
treed44872c55fb36f89b73b26f6407eefa206cef5a6
parent9ef53c6a6ab5fc604b58ccb19dc63ebcf8edd28b
Add f-string parsing for Python 3.12 (PEP 701)

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.
babel/messages/extract.py