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

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

PyMem_RawCalloc missing from cpython.mem #3047

wkschwartz opened this issue Jul 18, 2019 · 1 comment

Comments

@wkschwartz
Copy link

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

@scoder
Copy link
Contributor

scoder commented Jul 18, 2019

PR welcome.

wkschwartz added a commit to wkschwartz/cython that referenced this issue Jul 20, 2019
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.
@scoder scoder added this to the 3.0 milestone Dec 6, 2021
@scoder scoder closed this as completed in b2fac63 Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants