-
-
Notifications
You must be signed in to change notification settings - Fork 8
Add clear loop implementation #40
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, besides those two comments.
stringdtype/stringdtype/src/dtype.c
Outdated
NpyAuxData **NPY_UNUSED(out_auxdata), | ||
NPY_ARRAYMETHOD_FLAGS *flags) | ||
{ | ||
*flags = NPY_METH_REQUIRES_PYAPI | NPY_METH_NO_FLOATINGPOINT_ERRORS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*flags = NPY_METH_REQUIRES_PYAPI | NPY_METH_NO_FLOATINGPOINT_ERRORS; | |
*flags = NPY_METH_NO_FLOATINGPOINT_ERRORS; |
You don't require the python API actually if you are u sing free()
to free/allocate.
NumPy currently actually ignores the float flag also, because how will clearing cause that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I thought NPY_METH_REQUIRES_PYAPI
was required for the clear loop, I'll try without.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all numpy ones, yes :).
2447dfd
to
67f3bbb
Compare
To avoid a seg fault in the sorting routine I needed to add the |
This PR needs to be merged to fix the tests, but I'll hold off on self-merging just in case Sebastian or Peyton wants to weigh in on the last commit I just pushed. |
Meh... the numpy sorting code is being stupid there, but I guess you can workaround it here for the time being. |
Fix this in numpy instead, see numpy/numpy#23292
Opened numpy/numpy#23292 and reverted the last commit. |
I retriggered the NumPy "nightlies", so you can hopefully put this in without tests failing (unless it depended on that NULL one). |
Note that this can't be merged until numpy/numpy#23262 is merged and there's a wheel available to install.
There are a couple other minor cleanups as well, but mostly this implements custom
get_clear_loop
andclear_loop
implementations, allowing us to callfree
on the embedded references stored in the numpy array before the array is deallocated.I haven't checked, but this will hopefully fix all memory leaks, although there may be other places we need to call
free
as well. In any case, it makes it much easier to check for those places!