We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
get_type_attr_as_size
structseq.c
1 parent 985216c commit c08c7b1Copy full SHA for c08c7b1
1 file changed
Objects/structseq.c
@@ -28,13 +28,23 @@ static Py_ssize_t
28
get_type_attr_as_size(PyTypeObject *tp, PyObject *name)
29
{
30
PyObject *v = PyDict_GetItemWithError(_PyType_GetDict(tp), name);
31
- if (v == NULL && !PyErr_Occurred()) {
+
32
+ if (v == NULL) {
33
+ if (PyErr_Occurred()) {
34
+ return -1;
35
+ }
36
PyErr_Format(PyExc_TypeError,
37
"Missed attribute '%U' of type %s",
38
name, tp->tp_name);
39
return -1;
40
}
- return PyLong_AsSsize_t(v);
41
42
+ Py_ssize_t result = PyLong_AsSsize_t(v);
43
+ if (result == -1 && PyErr_Occurred()) {
44
45
46
47
+ return result;
48
49
50
#define VISIBLE_SIZE(op) Py_SIZE(op)
0 commit comments