summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 60cbffa..29ca08c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -553,10 +553,16 @@ PyObject *PyUnicode_FromWideChar(register const wchar_t *w,
PyUnicodeObject *unicode;
if (w == NULL) {
+ if (size == 0)
+ return PyUnicode_FromStringAndSize(NULL, 0);
PyErr_BadInternalCall();
return NULL;
}
+ if (size == -1) {
+ size = wcslen(w);
+ }
+
unicode = _PyUnicode_New(size);
if (!unicode)
return NULL;