summaryrefslogtreecommitdiffstats
path: root/Objects/weakrefobject.c
diff options
context:
space:
mode:
authorEthan Smith <ethan@ethanhs.me>2020-04-14 04:54:40 (GMT)
committerGitHub <noreply@github.com>2020-04-14 04:54:40 (GMT)
commit8ef875028a3644a329c87ce420a73793e315143f (patch)
tree102695b9e45519561c88f9d9b91b66992cd40b72 /Objects/weakrefobject.c
parentcecf049673da6a24435acd1a6a3b34472b323c97 (diff)
downloadcpython-8ef875028a3644a329c87ce420a73793e315143f.zip
cpython-8ef875028a3644a329c87ce420a73793e315143f.tar.gz
cpython-8ef875028a3644a329c87ce420a73793e315143f.tar.bz2
bpo-39481: Make weakref and WeakSet generic (GH-19497)
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r--Objects/weakrefobject.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 1e6697b..dd9b789 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -362,6 +362,12 @@ static PyMemberDef weakref_members[] = {
{NULL} /* Sentinel */
};
+static PyMethodDef weakref_methods[] = {
+ {"__class_getitem__", (PyCFunction)Py_GenericAlias,
+ METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {NULL} /* Sentinel */
+};
+
PyTypeObject
_PyWeakref_RefType = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
@@ -392,7 +398,7 @@ _PyWeakref_RefType = {
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
- 0, /*tp_methods*/
+ weakref_methods, /*tp_methods*/
weakref_members, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/