summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-06-27 18:52:10 (GMT)
committerGitHub <noreply@github.com>2017-06-27 18:52:10 (GMT)
commit94b169fe48bc7ea76b926823885d1b12c2c381fa (patch)
tree254a685184c3fab7c2f1311986a82b03cc028371 /Include
parenteb3c52a0d273491e745e0cbff2b73900bb96aa45 (diff)
downloadcpython-94b169fe48bc7ea76b926823885d1b12c2c381fa.zip
cpython-94b169fe48bc7ea76b926823885d1b12c2c381fa.tar.gz
cpython-94b169fe48bc7ea76b926823885d1b12c2c381fa.tar.bz2
[3.5] bpo-30708: Add private C API function _PyUnicode_AsWideCharString(). (GH-2285) (GH-2443) (#2448)
And use it instead of PyUnicode_AsWideCharString() if appropriate. _PyUnicode_AsWideCharString(unicode) is like PyUnicode_AsWideCharString(unicode, NULL), but raises a ValueError if the wchar_t* string contains null characters. (cherry picked from commit e613e6add5f07ff6aad5802924596b631b707d2a). (cherry picked from commit 0edffa3073b551ffeca34952529e7b292f1bd350)
Diffstat (limited to 'Include')
-rw-r--r--Include/unicodeobject.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 59dcf73..0e44808 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -1054,6 +1054,12 @@ PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString(
);
#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