diff --git a/src/zlib_into.c b/src/zlib_into.c index fcdc2947bec9bd7acf8300cf9e8c43c032aa68b1..d07fd8c5c91c8bc368cace12919fbd713c5e6638 100644 --- a/src/zlib_into.c +++ b/src/zlib_into.c @@ -20,17 +20,13 @@ PyZlib_Malloc(voidpf ctx, uInt items, uInt size) return NULL; /* PyMem_Malloc() cannot be used: the GIL is not held when inflate() and deflate() are called */ - /* The builtin zlib module uses PyMem_RawMalloc here, but this was only - added to the stable ABI from Python 3.13, so use plain malloc for now */ - return malloc((size_t)items * (size_t)size); + return PyMem_RawMalloc((size_t)items * (size_t)size); } static void PyZlib_Free(voidpf ctx, void *ptr) { - /* The builtin zlib module uses PyMem_RawFree here, but this was only - added to the stable ABI from Python 3.13, so use plain free for now */ - free(ptr); + PyMem_RawFree(ptr); } // zlib_error copied from CPython