-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
BUG: Fix incorrect/missing reference cleanups found using valgrind #12624
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
Changes from all commits
3b69c78
defdc74
71803e6
040c5e3
67e89c6
a12e392
aae353a
d37b17b
8a68950
f152795
340ebea
3c6cb19
2e51fdd
13868b1
0f1500a
4732c1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3822,18 +3822,26 @@ recursive_find_object_timedelta64_type(PyObject *obj, | |
* single object using [()], but not by using | ||
* __getitem__(integer) approaches | ||
*/ | ||
PyObject *item, *meth, *args; | ||
PyObject *item, *args; | ||
|
||
meth = PyObject_GetAttrString(obj, "__getitem__"); | ||
args = Py_BuildValue("(())"); | ||
item = PyObject_CallObject(meth, args); | ||
args = PyTuple_New(0); | ||
if (args == NULL) { | ||
return 0; | ||
} | ||
item = PyObject_GetItem(obj, args); | ||
Py_DECREF(args); | ||
if (item == NULL) { | ||
return 0; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code above does not seem super pretty, but I am not quite sure that subclasses are not supposed to get a chance here, so |
||
/* | ||
* NOTE: may need other type checks here in the future | ||
* for expanded 0 D datetime array conversions? | ||
*/ | ||
if (PyDelta_Check(item)) { | ||
Py_DECREF(item); | ||
return delta_checker(meta); | ||
} | ||
Py_DECREF(item); | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3255,6 +3255,7 @@ array_datetime_data(PyObject *NPY_UNUSED(dummy), PyObject *args) | |
} | ||
|
||
meta = get_datetime_metadata_from_dtype(dtype); | ||
Py_DECREF(dtype); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably one of the few ones that could hurt in practice, if someone prints a lot of datetime objects for some reason. |
||
if (meta == NULL) { | ||
return NULL; | ||
} | ||
|
@@ -3619,13 +3620,15 @@ _vec_string_with_args(PyArrayObject* char_array, PyArray_Descr* type, | |
if (nargs == -1 || nargs > NPY_MAXARGS) { | ||
PyErr_Format(PyExc_ValueError, | ||
"len(args) must be < %d", NPY_MAXARGS - 1); | ||
Py_DECREF(type); | ||
goto err; | ||
} | ||
|
||
broadcast_args[0] = (PyObject*)char_array; | ||
for (i = 1; i < nargs; i++) { | ||
PyObject* item = PySequence_GetItem(args, i-1); | ||
if (item == NULL) { | ||
Py_DECREF(type); | ||
goto err; | ||
} | ||
broadcast_args[i] = item; | ||
|
@@ -3634,6 +3637,7 @@ _vec_string_with_args(PyArrayObject* char_array, PyArray_Descr* type, | |
in_iter = (PyArrayMultiIterObject*)PyArray_MultiIterFromObjects | ||
(broadcast_args, nargs, 0); | ||
if (in_iter == NULL) { | ||
Py_DECREF(type); | ||
goto err; | ||
} | ||
n = in_iter->numiter; | ||
|
@@ -3714,6 +3718,7 @@ _vec_string_no_args(PyArrayObject* char_array, | |
|
||
in_iter = (PyArrayIterObject*)PyArray_IterNew((PyObject*)char_array); | ||
if (in_iter == NULL) { | ||
Py_DECREF(type); | ||
goto err; | ||
} | ||
|
||
|
@@ -3770,7 +3775,7 @@ static PyObject * | |
_vec_string(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) | ||
{ | ||
PyArrayObject* char_array = NULL; | ||
PyArray_Descr *type = NULL; | ||
PyArray_Descr *type; | ||
PyObject* method_name; | ||
PyObject* args_seq = NULL; | ||
|
||
|
@@ -3807,6 +3812,7 @@ _vec_string(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *kwds) | |
result = _vec_string_with_args(char_array, type, method, args_seq); | ||
} | ||
else { | ||
Py_DECREF(type); | ||
PyErr_SetString(PyExc_TypeError, | ||
"'args' must be a sequence of arguments"); | ||
goto err; | ||
mattip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
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.
Frankly, right now I do not understand the logic of the cache, but I did not try to either and I guess they are very small objects.