encukou / py3c

A Python 2/3 compatibility layer for C extensions
http://py3c.readthedocs.org
MIT License
59 stars 20 forks source link

Add PyMem_RawMalloc and friends #10

Closed jonathanunderwood closed 7 years ago

jonathanunderwood commented 7 years ago

In python 3.4 PyMem_RawMalloc, PyMem_RawCalloc, PyMem_RawRealloc, and PyMem_RawFree were added which allow memory management without requiring the GIL to be held (as opposed to the non-Raw versions). It would be great if those wrappers were available via py3c for earlier Python versions.

https://github.com/python/cpython/blob/master/Include/pymem.h#L15-L18

encukou commented 7 years ago

This is a good idea. I'll add it when I find time.

It should go into a new header for 3.4+ shims, which should be included from the main py3c.h.