summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-02-11 17:12:46 (GMT)
committerGuido van Rossum <guido@python.org>2003-02-11 17:12:46 (GMT)
commit9af48ff44ea5e096495d9652f6164b45a369144a (patch)
treec6c4c6ffb2241a7e9715576486a3af1c8db2ec32 /Objects
parent8d2613adbeba5b133fd1ca0f2fadf1f5e37342f1 (diff)
downloadcpython-9af48ff44ea5e096495d9652f6164b45a369144a.zip
cpython-9af48ff44ea5e096495d9652f6164b45a369144a.tar.gz
cpython-9af48ff44ea5e096495d9652f6164b45a369144a.tar.bz2
Inline create_specialmethod() -- since METH_CLASS is done differently
now, it was only called once, and its existence merely obfuscates the control flow.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index f37bb1b..38d5956 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2494,20 +2494,6 @@ PyTypeObject PyBaseObject_Type = {
/* 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)
{
@@ -2526,7 +2512,11 @@ add_methods(PyTypeObject *type, PyMethodDef *meth)
descr = PyDescr_NewClassMethod(type, meth);
}
else if (meth->ml_flags & METH_STATIC) {
- descr = create_specialmethod(meth, PyStaticMethod_New);
+ PyObject *cfunc = PyCFunction_New(meth, NULL);
+ if (cfunc == NULL)
+ return -1;
+ descr = PyStaticMethod_New(cfunc);
+ Py_DECREF(cfunc);
}
else {
descr = PyDescr_NewMethod(type, meth);