]> git.ipfire.org Git - thirdparty/babel.git/commit
Add f-string parsing for Python 3.12 (PEP 701) (#1027)
authorPetr Viktorin <encukou@gmail.com>
Sun, 1 Oct 2023 10:52:33 +0000 (12:52 +0200)
committerGitHub <noreply@github.com>
Sun, 1 Oct 2023 10:52:33 +0000 (10:52 +0000)
commit72bccffc7c35f07ec8bf97ff90079d51fc4da012
tree2f24bd30511fac4a5b34964bad5256f561d184a4
parent6fc07a27c00cc67e32a5e5e610fe8a9a0b3756f1
Add f-string parsing for Python 3.12 (PEP 701) (#1027)

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