mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-30682: Removed a too-strict assertion that failed for certain f-strings. (#2232)
This caused a segfault on eval("f'\\\n'") and eval("f'\\\r'") in debug build.
This commit is contained in:
parent
a49c935cfd
commit
11e97f2f80
3 changed files with 11 additions and 2 deletions
|
@ -780,5 +780,11 @@ f'{a * x()}'"""
|
|||
self.assertEqual(f'{d["foo"]}', 'bar')
|
||||
self.assertEqual(f"{d['foo']}", 'bar')
|
||||
|
||||
def test_backslash_char(self):
|
||||
# Check eval of a backslash followed by a control char.
|
||||
# See bpo-30682: this used to raise an assert in pydebug mode.
|
||||
self.assertEqual(eval('f"\\\n"'), '')
|
||||
self.assertEqual(eval('f"\\\r"'), '')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue