Commit fe77570a authored by Stefan Behnel's avatar Stefan Behnel

fix C pointer coercion problem when coercing bytes to signed char*

parent da19379b
...@@ -2085,7 +2085,10 @@ class CPointerBaseType(CType): ...@@ -2085,7 +2085,10 @@ class CPointerBaseType(CType):
if base_type.signed: if base_type.signed:
self.to_py_function = "__Pyx_PyObject_FromString" self.to_py_function = "__Pyx_PyObject_FromString"
if self.is_ptr: if self.is_ptr:
self.from_py_function = "__Pyx_PyObject_AsString" if base_type.signed == 2:
self.from_py_function = "__Pyx_PyObject_AsSString"
else:
self.from_py_function = "__Pyx_PyObject_AsString"
else: else:
self.to_py_function = "__Pyx_PyObject_FromUString" self.to_py_function = "__Pyx_PyObject_FromUString"
if self.is_ptr: if self.is_ptr:
......
...@@ -19,6 +19,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); ...@@ -19,6 +19,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif #endif
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s)
#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment