summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-11 16:15:30 (GMT)
committerGitHub <noreply@github.com>2023-07-11 16:15:30 (GMT)
commit58f9c8889d8fa79d617fddf6cb48942d3003c7fd (patch)
treee1b027f68d2fc2d3320359c366d186f827e5155b /Objects
parent60150590c74ff397ed07ef7bd752ad2f1d5cfde5 (diff)
downloadcpython-58f9c8889d8fa79d617fddf6cb48942d3003c7fd.zip
cpython-58f9c8889d8fa79d617fddf6cb48942d3003c7fd.tar.gz
cpython-58f9c8889d8fa79d617fddf6cb48942d3003c7fd.tar.bz2
[3.12] gh-106403: Restore weakref support for TypeVar and friends (GH-106418) (#106635)
gh-106403: Restore weakref support for TypeVar and friends (GH-106418) (cherry picked from commit 945d3cbf2e8e756ed16c3ec51106e6157abb2698) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typevarobject.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Objects/typevarobject.c b/Objects/typevarobject.c
index 406a6eb..97f3913 100644
--- a/Objects/typevarobject.c
+++ b/Objects/typevarobject.c
@@ -500,7 +500,7 @@ PyType_Spec typevar_spec = {
.name = "typing.TypeVar",
.basicsize = sizeof(typevarobject),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
- | Py_TPFLAGS_MANAGED_DICT,
+ | Py_TPFLAGS_MANAGED_DICT | Py_TPFLAGS_MANAGED_WEAKREF,
.slots = typevar_slots,
};
@@ -647,7 +647,8 @@ static PyType_Slot paramspecargs_slots[] = {
PyType_Spec paramspecargs_spec = {
.name = "typing.ParamSpecArgs",
.basicsize = sizeof(paramspecattrobject),
- .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE,
+ .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
+ | Py_TPFLAGS_MANAGED_WEAKREF,
.slots = paramspecargs_slots,
};
@@ -726,7 +727,8 @@ static PyType_Slot paramspeckwargs_slots[] = {
PyType_Spec paramspeckwargs_spec = {
.name = "typing.ParamSpecKwargs",
.basicsize = sizeof(paramspecattrobject),
- .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE,
+ .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
+ | Py_TPFLAGS_MANAGED_WEAKREF,
.slots = paramspeckwargs_slots,
};
@@ -1007,7 +1009,7 @@ PyType_Spec paramspec_spec = {
.name = "typing.ParamSpec",
.basicsize = sizeof(paramspecobject),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_IMMUTABLETYPE
- | Py_TPFLAGS_MANAGED_DICT,
+ | Py_TPFLAGS_MANAGED_DICT | Py_TPFLAGS_MANAGED_WEAKREF,
.slots = paramspec_slots,
};
@@ -1228,7 +1230,7 @@ PyType_Spec typevartuple_spec = {
.name = "typing.TypeVarTuple",
.basicsize = sizeof(typevartupleobject),
.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_MANAGED_DICT
- | Py_TPFLAGS_HAVE_GC,
+ | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_MANAGED_WEAKREF,
.slots = typevartuple_slots,
};