Author vstinner
Recipients vstinner
Date 2020-06-22.21:38:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1592861898.93.0.100413398496.issue41078@roundup.psfhosted.org>
In-reply-to
Content
PySequence_Fast_ITEMS() is used in numpy at 7 lines:

numpy/core/src/common/ufunc_override.c:118:        *out_objs = PySequence_Fast_ITEMS(seq);

---
PyUFuncOverride_GetOutObjects(PyObject *kwds, PyObject **out_kwd_obj, PyObject ***out_objs)
---
=> PyObject** is part of the numpy C API (it's even a pointer to a PyObject** array)!


numpy/core/src/multiarray/arrayfunction_override.c:80:    PyObject **items = PySequence_Fast_ITEMS(relevant_args);
---
static int
get_implementing_args_and_methods(PyObject *relevant_args,
                                  PyObject **implementing_args,
                                  PyObject **methods)
{
    int num_implementing_args = 0;
    Py_ssize_t i;
    int j;

    PyObject **items = PySequence_Fast_ITEMS(relevant_args);
    Py_ssize_t length = PySequence_Fast_GET_SIZE(relevant_args);

    for (i = 0; i < length; i++) {
        int new_class = 1;
        PyObject *argument = items[i];
----

=> here PySequence_Fast_GET_ITEM() can be used instead.


numpy/core/src/multiarray/arrayfunction_override.c:167:    PyObject **items = PySequence_Fast_ITEMS(types);
numpy/core/src/multiarray/common.c:434:    objects = PySequence_Fast_ITEMS(seq);
numpy/core/src/multiarray/iterators.c:1368:    ret = multiiter_new_impl(n, PySequence_Fast_ITEMS(fast_seq));
numpy/core/src/multiarray/methods.c:1015:    in_objs = PySequence_Fast_ITEMS(fast);
numpy/core/src/umath/override.c:38:    arg_objs = PySequence_Fast_ITEMS(args);
History
Date User Action Args
2020-06-22 21:38:18vstinnersetrecipients: + vstinner
2020-06-22 21:38:18vstinnersetmessageid: <1592861898.93.0.100413398496.issue41078@roundup.psfhosted.org>
2020-06-22 21:38:18vstinnerlinkissue41078 messages
2020-06-22 21:38:18vstinnercreate