summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-09-19 15:05:30 (GMT)
committerGitHub <noreply@github.com>2021-09-19 15:05:30 (GMT)
commitf25f2e2e8c8e48490d22b0cdf67f575608701f6f (patch)
tree5357fbf7251027bd5eed255a4f22639b0119d7a7 /Objects
parenta6241773869b80f2b1cac63f26ba646aa808a8db (diff)
downloadcpython-f25f2e2e8c8e48490d22b0cdf67f575608701f6f.zip
cpython-f25f2e2e8c8e48490d22b0cdf67f575608701f6f.tar.gz
cpython-f25f2e2e8c8e48490d22b0cdf67f575608701f6f.tar.bz2
Clean up initialization __class_getitem__ with Py_GenericAlias. (GH-28450)
The cast to PyCFunction is redundant. Overuse of redundant casts can hide actual bugs.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/descrobject.c2
-rw-r--r--Objects/dictobject.c2
-rw-r--r--Objects/enumobject.c2
-rw-r--r--Objects/genobject.c2
-rw-r--r--Objects/listobject.c2
-rw-r--r--Objects/setobject.c4
-rw-r--r--Objects/tupleobject.c2
-rw-r--r--Objects/weakrefobject.c2
8 files changed, 9 insertions, 9 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index 0565992..4ed36e9 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1144,7 +1144,7 @@ static PyMethodDef mappingproxy_methods[] = {
PyDoc_STR("D.items() -> list of D's (key, value) pairs, as 2-tuples")},
{"copy", (PyCFunction)mappingproxy_copy, METH_NOARGS,
PyDoc_STR("D.copy() -> a shallow copy of D")},
- {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS,
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
PyDoc_STR("See PEP 585")},
{"__reversed__", (PyCFunction)mappingproxy_reversed, METH_NOARGS,
PyDoc_STR("D.__reversed__() -> reverse iterator")},
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 85122ec..ae0098b 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -3294,7 +3294,7 @@ static PyMethodDef mapp_methods[] = {
{"copy", (PyCFunction)dict_copy, METH_NOARGS,
copy__doc__},
DICT___REVERSED___METHODDEF
- {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* sentinel */
};
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index 98ece3f..0ebaf5e 100644
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -213,7 +213,7 @@ PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
static PyMethodDef enum_methods[] = {
{"__reduce__", (PyCFunction)enum_reduce, METH_NOARGS, reduce_doc},
- {"__class_getitem__", (PyCFunction)Py_GenericAlias,
+ {"__class_getitem__", Py_GenericAlias,
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* sentinel */
};
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 7a687ce..be9238d9b 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1499,7 +1499,7 @@ static PyMethodDef async_gen_methods[] = {
{"asend", (PyCFunction)async_gen_asend, METH_O, async_asend_doc},
{"athrow",(PyCFunction)async_gen_athrow, METH_VARARGS, async_athrow_doc},
{"aclose", (PyCFunction)async_gen_aclose, METH_NOARGS, async_aclose_doc},
- {"__class_getitem__", (PyCFunction)Py_GenericAlias,
+ {"__class_getitem__", Py_GenericAlias,
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* Sentinel */
};
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 565c11e..e7c4742 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2843,7 +2843,7 @@ static PyMethodDef list_methods[] = {
LIST_COUNT_METHODDEF
LIST_REVERSE_METHODDEF
LIST_SORT_METHODDEF
- {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* sentinel */
};
diff --git a/Objects/setobject.c b/Objects/setobject.c
index af521b2..a3cdd33 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -2047,7 +2047,7 @@ static PyMethodDef set_methods[] = {
union_doc},
{"update", (PyCFunction)set_update, METH_VARARGS,
update_doc},
- {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* sentinel */
};
@@ -2161,7 +2161,7 @@ static PyMethodDef frozenset_methods[] = {
symmetric_difference_doc},
{"union", (PyCFunction)set_union, METH_VARARGS,
union_doc},
- {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* sentinel */
};
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index b7fd421..3e3aea4 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -887,7 +887,7 @@ static PyMethodDef tuple_methods[] = {
TUPLE___GETNEWARGS___METHODDEF
TUPLE_INDEX_METHODDEF
TUPLE_COUNT_METHODDEF
- {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* sentinel */
};
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index bb56c7d..8922768 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -363,7 +363,7 @@ static PyMemberDef weakref_members[] = {
};
static PyMethodDef weakref_methods[] = {
- {"__class_getitem__", (PyCFunction)Py_GenericAlias,
+ {"__class_getitem__", Py_GenericAlias,
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL} /* Sentinel */
};