[3.12] gh-112243: Don't include comments in f-string debug expressions (GH-112284) (#112285)

(cherry picked from commit d59feb5dbe)
This commit is contained in:
Pablo Galindo Salgado 2023-11-20 15:38:57 +00:00 committed by GitHub
parent d4fd165aba
commit 7e70e2ed29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 5 deletions

View file

@ -1579,6 +1579,9 @@ x = (
self.assertEqual(f'X{x = }Y', 'Xx = '+repr(x)+'Y')
self.assertEqual(f"sadsd {1 + 1 = :{1 + 1:1d}f}", "sadsd 1 + 1 = 2.000000")
self.assertEqual(f"{1+2 = # my comment
}", '1+2 = \n 3')
# These next lines contains tabs. Backslash escapes don't
# work in f-strings.
# patchcheck doesn't like these tabs. So the only way to test