summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-03-28 15:49:54 (GMT)
committerFred Drake <fdrake@acm.org>2002-03-28 15:49:54 (GMT)
commitf841aa6fc0024a6c94e4e507ec943b13cbec17cc (patch)
tree8cf687b8a4993ca2513c55fd0e18746b87548505 /Modules
parent4157ffbb96865c38facfceb2456dbd8b101d1e62 (diff)
downloadcpython-f841aa6fc0024a6c94e4e507ec943b13cbec17cc.zip
cpython-f841aa6fc0024a6c94e4e507ec943b13cbec17cc.tar.gz
cpython-f841aa6fc0024a6c94e4e507ec943b13cbec17cc.tar.bz2
Add a simple test of the METH_CLASS and METH_STATIC flags for type methods.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/xxsubtype.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c
index 3b91a0c..7a7cc1e 100644
--- a/Modules/xxsubtype.c
+++ b/Modules/xxsubtype.c
@@ -43,11 +43,39 @@ spamlist_setstate(spamlistobject *self, PyObject *args)
return Py_None;
}
+static PyObject *
+spamlist_specialmeth(PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *result = PyTuple_New(3);
+
+ if (result != NULL) {
+ if (self == NULL)
+ self = Py_None;
+ if (kw == NULL)
+ kw = Py_None;
+ Py_INCREF(self);
+ PyTuple_SET_ITEM(result, 0, self);
+ Py_INCREF(args);
+ PyTuple_SET_ITEM(result, 1, args);
+ Py_INCREF(kw);
+ PyTuple_SET_ITEM(result, 2, kw);
+ }
+ return result;
+}
+
static PyMethodDef spamlist_methods[] = {
{"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS,
"getstate() -> state"},
{"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS,
"setstate(state)"},
+ /* These entries differ only in the flags; they are used by the tests
+ in test.test_descr. */
+ {"classmeth", (PyCFunction)spamlist_specialmeth,
+ METH_VARARGS | METH_KEYWORDS | METH_CLASS,
+ "classmeth(*args, **kw)"},
+ {"staticmeth", (PyCFunction)spamlist_specialmeth,
+ METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ "staticmeth(*args, **kw)"},
{NULL, NULL},
};