]> granicus.if.org Git - python/commitdiff
Fix the --with-cxx-main build.
authorCollin Winter <collinw@gmail.com>
Sat, 17 Apr 2010 00:20:57 +0000 (00:20 +0000)
committerCollin Winter <collinw@gmail.com>
Sat, 17 Apr 2010 00:20:57 +0000 (00:20 +0000)
Include/Python.h
Modules/python.c

index 315d6ecd79928c9f7e33739bcdb17c4646b6c9a6..9b26d1678031f74577529c62506a96d8ee1d57dc 100644 (file)
 #include "pystrcmp.h"
 #include "dtoa.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 /* _Py_Mangle is defined in compile.c */
 PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
 
 /* _Py_char2wchar lives in python.c */
 PyAPI_FUNC(wchar_t *) _Py_char2wchar(char *);
+#ifdef __cplusplus
+}
+#endif
 
 /* Convert a possibly signed character to a nonnegative int */
 /* XXX This assumes characters are 8 bits wide */
index 7bc9c3a2d21247cb4fae96be50a7a61842dfca09..f5d38709dde1f457b71fff8caefa07c925ce3c67 100644 (file)
@@ -57,7 +57,7 @@ _Py_char2wchar(char* arg)
        /* Overallocate; as multi-byte characters are in the argument, the
           actual output could use less memory. */
        argsize = strlen(arg) + 1;
-       res = PyMem_Malloc(argsize*sizeof(wchar_t));
+       res = (wchar_t*)PyMem_Malloc(argsize*sizeof(wchar_t));
        if (!res) goto oom;
        in = (unsigned char*)arg;
        out = res;