gh-112243: Don't include comments in f-string debug expressions (#112284)

This commit is contained in:
Pablo Galindo Salgado 2023-11-20 15:18:24 +00:00 committed by GitHub
parent 3b3ec0d77f
commit d59feb5dbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 6 deletions

View file

@ -1627,6 +1627,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