summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-11-02 05:37:44 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-11-02 05:37:44 (GMT)
commit54a831bef74fc2213dc2a8467236a5f481957d5c (patch)
treed3c7df7df278ad13f430021e6ecd75e0f87fcc5f
parentb4b9ced1b6a6da388c52e82f1fc67a0ea1dfed87 (diff)
downloadcpython-54a831bef74fc2213dc2a8467236a5f481957d5c.zip
cpython-54a831bef74fc2213dc2a8467236a5f481957d5c.tar.gz
cpython-54a831bef74fc2213dc2a8467236a5f481957d5c.tar.bz2
Use PyTuple_Pack() to simplify enumerate().
-rw-r--r--Objects/enumobject.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index 5fbecbf..17a6282 100644
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -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;
}