summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorericvsmith <ericvsmith@users.noreply.github.com>2017-06-16 10:19:32 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-06-16 10:19:32 (GMT)
commit11e97f2f80bf65cc828c127eafc95229df35d403 (patch)
tree69abcabdc0c46545eea7d33419655cd952fb9190 /Lib
parenta49c935cfd6b4f8ea1f750888dd9260bbf5b9980 (diff)
downloadcpython-11e97f2f80bf65cc828c127eafc95229df35d403.zip
cpython-11e97f2f80bf65cc828c127eafc95229df35d403.tar.gz
cpython-11e97f2f80bf65cc828c127eafc95229df35d403.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_fstring.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index b398704..3d762b5 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -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()