diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-09-30 19:51:37 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-09-30 19:51:37 (GMT) |
commit | a4dfe1c9eaca6faf206f63a178233ffea208c906 (patch) | |
tree | 65a56aaf6c606b02231600d21ffde9bcc07609ab /Lib | |
parent | 9ef28b6ad3d5aff767e3d852499def8b5ae5ff5d (diff) | |
download | cpython-a4dfe1c9eaca6faf206f63a178233ffea208c906.zip cpython-a4dfe1c9eaca6faf206f63a178233ffea208c906.tar.gz cpython-a4dfe1c9eaca6faf206f63a178233ffea208c906.tar.bz2 |
[3.6] bpo-31592: Fix an assertion failure in Python parser in case of a bad unicodedata.normalize(). (GH-3767) (#3836)
(cherry picked from commit 7dc46d8cf5854d9f4ce3271b29c21aea4872e8ad)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ast.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 8c62408..e68d0de 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -421,6 +421,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): |