summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-01-04 22:21:41 (GMT)
committerGitHub <noreply@github.com>2018-01-04 22:21:41 (GMT)
commitce5b0e9db1b9698e6ffc43ae41cf3a22ca5a6ba6 (patch)
treecde80dea939a4594a505c4cabc0e6f8de56d0f6a /Modules
parent87be28f4a1c5b76926c71a3d9f92503f9eb82d51 (diff)
downloadcpython-ce5b0e9db1b9698e6ffc43ae41cf3a22ca5a6ba6.zip
cpython-ce5b0e9db1b9698e6ffc43ae41cf3a22ca5a6ba6.tar.gz
cpython-ce5b0e9db1b9698e6ffc43ae41cf3a22ca5a6ba6.tar.bz2
bpo-32226: Make __class_getitem__ an automatic class method. (#5098)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapimodule.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 47b5064..7b2e2a3 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -5104,17 +5104,13 @@ typedef struct {
} PyGenericObject;
static PyObject *
-generic_class_getitem(PyObject *self, PyObject *args)
+generic_class_getitem(PyObject *type, PyObject *item)
{
- PyObject *type, *item;
- if (!PyArg_UnpackTuple(args, "__class_getitem__", 2, 2, &type, &item)) {
- return NULL;
- }
return generic_alias_new(item);
}
static PyMethodDef generic_methods[] = {
- {"__class_getitem__", generic_class_getitem, METH_VARARGS|METH_STATIC, NULL},
+ {"__class_getitem__", generic_class_getitem, METH_O|METH_CLASS, NULL},
{NULL} /* sentinel */
};