diff options
Diffstat (limited to 'Objects/iterobject.c')
-rw-r--r-- | Objects/iterobject.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c index c4f4e61..e062c8a 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -96,12 +96,6 @@ static PyMethodDef iter_methods[] = { {NULL, NULL} /* sentinel */ }; -static PyObject * -iter_getattr(seqiterobject *it, char *name) -{ - return Py_FindMethod(iter_methods, (PyObject *)it, name); -} - PyTypeObject PySeqIter_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ @@ -111,7 +105,7 @@ PyTypeObject PySeqIter_Type = { /* methods */ (destructor)iter_dealloc, /* tp_dealloc */ 0, /* tp_print */ - (getattrfunc)iter_getattr, /* tp_getattr */ + 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ @@ -121,7 +115,7 @@ PyTypeObject PySeqIter_Type = { 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ - 0, /* tp_getattro */ + PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ @@ -132,6 +126,13 @@ PyTypeObject PySeqIter_Type = { 0, /* tp_weaklistoffset */ (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)iter_iternext, /* tp_iternext */ + iter_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ }; /* -------------------------------------- */ @@ -198,12 +199,6 @@ static PyMethodDef calliter_methods[] = { }; static PyObject * -calliter_getattr(calliterobject *it, char *name) -{ - return Py_FindMethod(calliter_methods, (PyObject *)it, name); -} - -static PyObject * calliter_iternext(calliterobject *it) { PyObject *result = PyObject_CallObject(it->it_callable, NULL); @@ -228,7 +223,7 @@ PyTypeObject PyCallIter_Type = { /* methods */ (destructor)calliter_dealloc, /* tp_dealloc */ 0, /* tp_print */ - (getattrfunc)calliter_getattr, /* tp_getattr */ + 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ @@ -238,7 +233,7 @@ PyTypeObject PyCallIter_Type = { 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ - 0, /* tp_getattro */ + PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ @@ -249,4 +244,11 @@ PyTypeObject PyCallIter_Type = { 0, /* tp_weaklistoffset */ (getiterfunc)iter_getiter, /* tp_iter */ (iternextfunc)calliter_iternext, /* tp_iternext */ + calliter_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ }; |