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

MNT: clean up references to array_owned==2 case in StringDType #26419

Merged
merged 1 commit into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions numpy/_core/src/multiarray/stringdtype/dtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ new_stringdtype_instance(PyObject *na_object, int coerce)

char *default_string_buf = NULL;
char *na_name_buf = NULL;
char array_owned = 0;

npy_string_allocator *allocator = NpyString_new_allocator(PyMem_RawMalloc, PyMem_RawFree,
PyMem_RawRealloc);
Expand Down Expand Up @@ -138,7 +137,7 @@ new_stringdtype_instance(PyObject *na_object, int coerce)
if (na_name_buf != NULL) {
PyMem_RawFree(na_name_buf);
}
if (allocator != NULL && array_owned != 2) {
if (allocator != NULL) {
NpyString_free_allocator(allocator);
}
return NULL;
Expand Down Expand Up @@ -660,7 +659,7 @@ stringdtype_dealloc(PyArray_StringDTypeObject *self)
{
Py_XDECREF(self->na_object);
// this can be null if an error happens while initializing an instance
if (self->allocator != NULL && self->array_owned != 2) {
if (self->allocator != NULL) {
NpyString_free_allocator(self->allocator);
}
PyMem_RawFree((char *)self->na_name.buf);
Expand Down
Loading