diff options
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r-- | Python/Python-ast.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c index 38d74b4..41299b2 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -5083,19 +5083,17 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw) Py_ssize_t i, numfields = 0; int res = -1; PyObject *key, *value, *fields, *attributes = NULL, *remaining_fields = NULL; - if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) { + + fields = PyObject_GetAttr((PyObject*)Py_TYPE(self), state->_fields); + if (fields == NULL) { goto cleanup; } - if (fields) { - numfields = PySequence_Size(fields); - if (numfields == -1) { - goto cleanup; - } - remaining_fields = PySet_New(fields); - } - else { - remaining_fields = PySet_New(NULL); + + numfields = PySequence_Size(fields); + if (numfields == -1) { + goto cleanup; } + remaining_fields = PySet_New(fields); if (remaining_fields == NULL) { goto cleanup; } |