[Python-checkins] python/dist/src/Objects typeobject.c,2.206,2.207
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Tue, 11 Feb 2003 09:12:53 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv31417
Modified Files:
typeobject.c
Log Message:
Inline create_specialmethod() -- since METH_CLASS is done differently
now, it was only called once, and its existence merely obfuscates the
control flow.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.206
retrieving revision 2.207
diff -C2 -d -r2.206 -r2.207
*** typeobject.c 11 Feb 2003 16:25:43 -0000 2.206
--- typeobject.c 11 Feb 2003 17:12:46 -0000 2.207
***************
*** 2495,2512 ****
/* Initialize the __dict__ in a type object */
- static PyObject *
- create_specialmethod(PyMethodDef *meth, PyObject *(*func)(PyObject *))
- {
- PyObject *cfunc;
- PyObject *result;
-
- cfunc = PyCFunction_New(meth, NULL);
- if (cfunc == NULL)
- return NULL;
- result = func(cfunc);
- Py_DECREF(cfunc);
- return result;
- }
-
static int
add_methods(PyTypeObject *type, PyMethodDef *meth)
--- 2495,2498 ----
***************
*** 2527,2531 ****
}
else if (meth->ml_flags & METH_STATIC) {
! descr = create_specialmethod(meth, PyStaticMethod_New);
}
else {
--- 2513,2521 ----
}
else if (meth->ml_flags & METH_STATIC) {
! PyObject *cfunc = PyCFunction_New(meth, NULL);
! if (cfunc == NULL)
! return -1;
! descr = PyStaticMethod_New(cfunc);
! Py_DECREF(cfunc);
}
else {