summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorOren Milman <orenmn@gmail.com>2017-09-30 17:16:24 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-09-30 17:16:24 (GMT)
commit7dc46d8cf5854d9f4ce3271b29c21aea4872e8ad (patch)
tree65d6f6876bfd7c627d9090e1bfadf24b99c970a8 /Lib/test
parentf4ea642cb60556231e714089a79d3c59c202661e (diff)
downloadcpython-7dc46d8cf5854d9f4ce3271b29c21aea4872e8ad.zip
cpython-7dc46d8cf5854d9f4ce3271b29c21aea4872e8ad.tar.gz
cpython-7dc46d8cf5854d9f4ce3271b29c21aea4872e8ad.tar.bz2
bpo-31592: Fix an assertion failure in Python parser in case of a bad unicodedata.normalize(). (#3767)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_ast.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 2f59527..aa53503 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -431,6 +431,16 @@ class AST_Tests(unittest.TestCase):
compile(empty_yield_from, "<test>", "exec")
self.assertIn("field value is required", str(cm.exception))
+ @support.cpython_only
+ def test_issue31592(self):
+ # There shouldn't be an assertion failure in case of a bad
+ # unicodedata.normalize().
+ import unicodedata
+ def bad_normalize(*args):
+ return None
+ with support.swap_attr(unicodedata, 'normalize', bad_normalize):
+ self.assertRaises(TypeError, ast.parse, '\u03D5')
+
class ASTHelpers_Test(unittest.TestCase):