diff Objects/unicodeobject.c @ 46318:22a74eaf6b22

Change command line processing API to use wchar_t. Fixes #2128.
author Martin v. Löwis <martin@v.loewis.de>
date Sat, 05 Apr 2008 20:41:37 +0000
parents 848160d10780
children 3d9ad27d930b
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Sat Apr 05 19:47:23 2008 +0000
+++ b/Objects/unicodeobject.c	Sat Apr 05 20:41:37 2008 +0000
@@ -553,10 +553,16 @@
     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;