Skip to content
Merged
Changes from 1 commit
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
14 changes: 12 additions & 2 deletions Objects/structseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,23 @@ static Py_ssize_t
get_type_attr_as_size(PyTypeObject *tp, PyObject *name)
{
PyObject *v = PyDict_GetItemWithError(_PyType_GetDict(tp), name);
if (v == NULL && !PyErr_Occurred()) {

if (v == NULL) {
if (PyErr_Occurred()) {
return -1;
}
PyErr_Format(PyExc_TypeError,
"Missed attribute '%U' of type %s",
name, tp->tp_name);
return -1;
}
return PyLong_AsSsize_t(v);

Py_ssize_t result = PyLong_AsSsize_t(v);
if (result == -1 && PyErr_Occurred()) {
return -1;
}

return result;
}

#define VISIBLE_SIZE(op) Py_SIZE(op)
Expand Down
Loading