]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/helpers.cpp
trying to add wxBase project file from Unix
[wxWidgets.git] / wxPython / src / helpers.cpp
index c9994a4cfb4faaa337a29a9b314ec8901805e227..0d7aa40850f7655988ab57fa58eb94c3108b6a80 100644 (file)
@@ -1011,11 +1011,24 @@ wxString* wxString_LIST_helper(PyObject* source) {
     }
     for (int x=0; x<count; x++) {
         PyObject* o = PyList_GetItem(source, x);
+#if PYTHON_API_VERSION >= 1009
+        if (! PyString_Check(o) && ! PyUnicode_Check(o)) {
+            PyErr_SetString(PyExc_TypeError, "Expected a list of string or unicode objects.");
+            return NULL;
+        }
+
+        char* buff;
+        int   length;
+        if (PyString_AsStringAndSize(o, &buff, &length) == -1)
+            return NULL;
+        temp[x] = wxString(buff, length);
+#else
         if (! PyString_Check(o)) {
             PyErr_SetString(PyExc_TypeError, "Expected a list of strings.");
             return NULL;
         }
         temp[x] = PyString_AsString(o);
+#endif
     }
     return temp;
 }