]> granicus.if.org Git - python/commitdiff
Issue #17223: Add another test to check that _PyUnicode_Ready() rejects
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 5 Mar 2013 23:39:03 +0000 (00:39 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 5 Mar 2013 23:39:03 +0000 (00:39 +0100)
code points bigger than U+10ffff

Modules/_testcapimodule.c

index 2f4381363a5ea0a822c2a5e785b5f5188fd5f520..7f640bce251593354cc87405eb3ed1aaf005a1c4 100644 (file)
@@ -1418,6 +1418,16 @@ test_widechar(PyObject *self)
     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;