diff options
author | John Kirkham <kirkhamj@janelia.hhmi.org> | 2018-08-07 17:00:43 -0400 |
---|---|---|
committer | John Kirkham <kirkhamj@janelia.hhmi.org> | 2018-08-09 14:39:59 -0400 |
commit | 8d324dfd3da2c38292f6312b299ecaa843b2fd00 (patch) | |
tree | b887bf6a63b217b35724e842e5cf989d44212428 /Cython/Utility | |
parent | 9fbbf21650abf0cad2d4d7dae66361d0db8ab6ad (diff) | |
download | cython-8d324dfd3da2c38292f6312b299ecaa843b2fd00.tar.gz |
Define Python Raw Mem helpers in ModuleSetupCode
To handle the Python version differences, handle the definitions of
`PyMem_Raw*` functions in `ModuleSetupCode`. Then extern them in
`cpython.mem` without using a version check or a specific header.
Diffstat (limited to 'Cython/Utility')
-rw-r--r-- | Cython/Utility/ModuleSetupCode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index ac6264574..9f7e3d875 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -441,6 +441,12 @@ class __Pyx_FakeReference { #define PyObject_Realloc(p) PyMem_Realloc(p) #endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 + #define PyMem_RawMalloc(n) PyMem_Malloc(n) + #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) + #define PyMem_RawFree(p) PyMem_Free(p) +#endif + #if CYTHON_COMPILING_IN_PYSTON // special C-API functions only in Pyston #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) |