[3.6] bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (GH-2285) (#2443)
Raise a ValueError if the second argument is NULL and the wchar_t\*
string contains null characters..
(cherry picked from commit e613e6add5f07ff6aad5802924596b631b707d2a)
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 5b87718..cec2b7f 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -1063,6 +1063,12 @@
);
#ifndef Py_LIMITED_API
+/* Similar to PyUnicode_AsWideCharString(unicode, NULL), but check if
+ the string contains null characters. */
+PyAPI_FUNC(wchar_t*) _PyUnicode_AsWideCharString(
+ PyObject *unicode /* Unicode object */
+ );
+
PyAPI_FUNC(void*) _PyUnicode_AsKind(PyObject *s, unsigned int kind);
#endif