[Python-checkins] cpython: Issue #17223: Add another test to check that _PyUnicode_Ready() rejects

victor.stinner python-checkins at python.org
Wed Mar 6 00:42:21 CET 2013


http://hg.python.org/cpython/rev/15190138d3f3
changeset:   82501:15190138d3f3
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Mar 06 00:39:03 2013 +0100
summary:
  Issue #17223: Add another test to check that _PyUnicode_Ready() rejects
code points bigger than U+10ffff

files:
  Modules/_testcapimodule.c |  10 ++++++++++
  1 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1418,6 +1418,16 @@
     else
         return raiseTestError("test_widechar",
                               "PyUnicode_FromUnicode(L\"\\U00110000\", 1) didn't fail");
+
+    wide = PyUnicode_FromUnicode(NULL, 1);
+    if (wide == NULL)
+        return NULL;
+    PyUnicode_AS_UNICODE(wide)[0] = invalid[0];
+    if (_PyUnicode_Ready(wide) < 0)
+        PyErr_Clear();
+    else
+        return raiseTestError("test_widechar",
+                              "PyUnicode_Ready() didn't fail");
 #endif
 
     Py_RETURN_NONE;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list