Commit 73e89124 authored by Stefan Behnel's avatar Stefan Behnel

generally #define PyObject_Malloc() and friends to their PyMem_*() counterparts in PyPy

parent 8657bc27
...@@ -498,11 +498,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) ...@@ -498,11 +498,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
for (i = 0; i < m->defaults_pyobjects; i++) for (i = 0; i < m->defaults_pyobjects; i++)
Py_XDECREF(pydefaults[i]); Py_XDECREF(pydefaults[i]);
#if CYTHON_COMPILING_IN_CPYTHON
PyObject_Free(m->defaults); PyObject_Free(m->defaults);
#else
PyMem_Free(m->defaults);
#endif
m->defaults = NULL; m->defaults = NULL;
} }
...@@ -712,11 +708,7 @@ static int __pyx_CyFunction_init(void) { ...@@ -712,11 +708,7 @@ static int __pyx_CyFunction_init(void) {
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
#if CYTHON_COMPILING_IN_CPYTHON
m->defaults = PyObject_Malloc(size); m->defaults = PyObject_Malloc(size);
#else
m->defaults = PyMem_Malloc(size);
#endif
if (!m->defaults) if (!m->defaults)
return PyErr_NoMemory(); return PyErr_NoMemory();
memset(m->defaults, 0, size); memset(m->defaults, 0, size);
......
...@@ -117,6 +117,12 @@ ...@@ -117,6 +117,12 @@
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
#endif #endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
#define PyObject_Malloc(s) PyMem_Malloc(s)
#define PyObject_Free(p) PyMem_Free(p)
#define PyObject_Realloc(p) PyMem_Realloc(p)
#endif
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
......
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