mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
[3.6] bpo-30682: Removed a too-strict assertion that failed for certain f-strings. (GH-2232) (#2242)
This caused a segfault on eval("f'\\\n'") and eval("f'\\\r'") in debug build..
(cherry picked from commit 11e97f2f80
)
This commit is contained in:
parent
a0ccc54e6d
commit
2eca5b465f
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