Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyMem_RawCalloc missing from cpython.mem #3047

Open
wkschwartz opened this issue Jul 18, 2019 · 1 comment

Comments

@wkschwartz
Copy link

commented Jul 18, 2019

While cpython.mem contains the other raw allocators, it is missing PyMem_RawCalloc.

@scoder

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2019

PR welcome.

wkschwartz added a commit to wkschwartz/cython that referenced this issue Jul 20, 2019

Fix cython#3047: Add PyMem_(Raw)Calloc to cpython.mem
CPython added PyMem_RawCalloc and PyMem_Calloc in version 3.5. I did not
in include a version guard for 3.4 because PyObject_Calloc was also
added in 3.5 but it's already in this file without a version guard.

I updated comments for other functions to reflect PyMem_Calloc but not
PyMem_RawCalloc to match comments' currently only referencing
PyMem_Malloc and friends.

I did not modify Cython/Utility/ModuleSetupCode.c, where
PyMem_RawMalloc, PyMem_RawRealloc, and PyMem_RawFree are #defined for
Python 3.3 because (a) I couldn't figure out where these were being used
and (b) they're defined to their non-raw versions, which strikes me as
dangerous since the Raw versions allow use without the GIL but the
non-Raw versions do not.

Finally, I updated the tests in cpython_capi.pyx. I'm never sure when
compilers decide code is dead and just ignore it, so I tried actually to
write to the memory and return data from it. I can't figure out how to
run Cython's tests, so... fingers crossed.
@wkschwartz wkschwartz referenced a pull request that will close this issue Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.