diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2016-03-17 14:11:14 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2016-03-17 14:11:14 +0100 |
commit | 73e891244c9e777cc3c254319efe881b776b97ce (patch) | |
tree | 2b88d9539c8f368121c7b2dba972a9129eefbbaf | |
parent | 8657bc27cbf160689725d1a2e9de6833b4501098 (diff) | |
download | cython-73e891244c9e777cc3c254319efe881b776b97ce.tar.gz |
generally #define PyObject_Malloc() and friends to their PyMem_*() counterparts in PyPy
-rw-r--r-- | Cython/Utility/CythonFunction.c | 8 | ||||
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/Cython/Utility/CythonFunction.c b/Cython/Utility/CythonFunction.c index 1bfc274d6..266a8b935 100644 --- a/Cython/Utility/CythonFunction.c +++ b/Cython/Utility/CythonFunction.c @@ -498,11 +498,7 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) for (i = 0; i < m->defaults_pyobjects; i++) Py_XDECREF(pydefaults[i]); -#if CYTHON_COMPILING_IN_CPYTHON PyObject_Free(m->defaults); -#else - PyMem_Free(m->defaults); -#endif m->defaults = NULL; } @@ -712,11 +708,7 @@ static int __pyx_CyFunction_init(void) { static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; -#if CYTHON_COMPILING_IN_CPYTHON m->defaults = PyObject_Malloc(size); -#else - m->defaults = PyMem_Malloc(size); -#endif if (!m->defaults) return PyErr_NoMemory(); memset(m->defaults, 0, size); diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index 52cc66cc3..a5576cef2 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -117,6 +117,12 @@ #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #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_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) |