Issue #19437: Fix array.buffer_info(), handle PyLong_FromVoidPtr() and
PyLong_FromLong() failure
This commit is contained in:
parent
804e05e800
commit
541067a640
|
@ -1133,13 +1133,25 @@ Insert a new item x into the array before position i.");
|
||||||
static PyObject *
|
static PyObject *
|
||||||
array_buffer_info(arrayobject *self, PyObject *unused)
|
array_buffer_info(arrayobject *self, PyObject *unused)
|
||||||
{
|
{
|
||||||
PyObject* retval = NULL;
|
PyObject *retval = NULL, *v;
|
||||||
|
|
||||||
retval = PyTuple_New(2);
|
retval = PyTuple_New(2);
|
||||||
if (!retval)
|
if (!retval)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item));
|
v = PyLong_FromVoidPtr(self->ob_item);
|
||||||
PyTuple_SET_ITEM(retval, 1, PyLong_FromLong((long)(Py_SIZE(self))));
|
if (v == NULL) {
|
||||||
|
Py_DECREF(retval);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
PyTuple_SET_ITEM(retval, 0, v);
|
||||||
|
|
||||||
|
v = PyLong_FromLong((long)(Py_SIZE(self)));
|
||||||
|
if (v == NULL) {
|
||||||
|
Py_DECREF(retval);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
PyTuple_SET_ITEM(retval, 1, v);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue