Skip to content
Snippets Groups Projects
Commit 80a19067 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Switch back to PyMem_Raw functions for zlib to allocate & free memory

parent 71e08ca8
No related branches found
No related tags found
1 merge request!1Build for each Python version rather than using limited API
Pipeline #164582 passed
...@@ -20,17 +20,13 @@ PyZlib_Malloc(voidpf ctx, uInt items, uInt size) ...@@ -20,17 +20,13 @@ PyZlib_Malloc(voidpf ctx, uInt items, uInt size)
return NULL; return NULL;
/* PyMem_Malloc() cannot be used: the GIL is not held when /* PyMem_Malloc() cannot be used: the GIL is not held when
inflate() and deflate() are called */ inflate() and deflate() are called */
/* The builtin zlib module uses PyMem_RawMalloc here, but this was only return PyMem_RawMalloc((size_t)items * (size_t)size);
added to the stable ABI from Python 3.13, so use plain malloc for now */
return malloc((size_t)items * (size_t)size);
} }
static void static void
PyZlib_Free(voidpf ctx, void *ptr) PyZlib_Free(voidpf ctx, void *ptr)
{ {
/* The builtin zlib module uses PyMem_RawFree here, but this was only PyMem_RawFree(ptr);
added to the stable ABI from Python 3.13, so use plain free for now */
free(ptr);
} }
// zlib_error copied from CPython // zlib_error copied from CPython
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment