Use PyTuple_Pack() to simplify enumerate().

This commit is contained in:
Raymond Hettinger 2003-11-02 05:37:44 +00:00
parent b4b9ced1b6
commit 54a831bef7
1 changed files with 1 additions and 5 deletions

View File

@ -31,16 +31,12 @@ enum_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_DECREF(en);
return NULL;
}
en->en_result = PyTuple_New(2);
en->en_result = PyTuple_Pack(2, Py_None, Py_None);
if (en->en_result == NULL) {
Py_DECREF(en->en_sit);
Py_DECREF(en);
return NULL;
}
Py_INCREF(Py_None);
PyTuple_SET_ITEM(en->en_result, 0, Py_None);
Py_INCREF(Py_None);
PyTuple_SET_ITEM(en->en_result, 1, Py_None);
return (PyObject *)en;
}