]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-38964: Print correct filename on a SyntaxError in an fstring (GH-20399...
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Tue, 26 May 2020 01:24:31 +0000 (04:24 +0300)
committerGitHub <noreply@github.com>
Tue, 26 May 2020 01:24:31 +0000 (02:24 +0100)
commit791a46ed58f74d673cf2c0d81deec57155bf7583
tree26b3037aba7bcaafdb3a3f83ec73ebdc835511df
parent6cb0ad20396116b5076a58b05b55286d6d5e0c94
[3.9] bpo-38964: Print correct filename on a SyntaxError in an fstring (GH-20399) (GH-20404)

When a `SyntaxError` in the expression part of a fstring is found,
the filename attribute of the `SyntaxError` is always `<fstring>`.
With this commit, it gets changed to always have the name of the file
the fstring resides in.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>.
(cherry picked from commit f7b1e461567e5e3fa3ba46f589d9edc1b45b2dd0)
Lib/test/test_fstring.py
Misc/NEWS.d/next/Core and Builtins/2020-05-25-21-49-11.bpo-38964.lrml90.rst [new file with mode: 0644]
Parser/pegen/parse_string.c