Skip to content

Commit 900022b

Browse files
committed
Revise NEWS.
1 parent 0060602 commit 900022b

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed
Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
Fix two bugs related to the interaction of weakrefs and the garbage
2-
collector. The weakrefs in the ``tp_subclasses`` dictionary are needed in
3-
order to correctly invalidate type caches (for example, by calling
4-
``PyType_Modified()``). Clearing weakrefs before calling finalizers causes
5-
the caches to not be correctly invalidated. That can cause crashes since the
6-
caches can refer to invalid objects. This is fixed by deferring the
7-
clearing of weakrefs to classes and without callbacks until after finalizers
8-
are executed.
9-
10-
The second bug is caused by weakrefs created while running finalizers. Those
11-
weakrefs can be outside the set of unreachable garbage and therefore survive
12-
the ``delete_garbage()`` phase (where ``tp_clear()`` is called on objects).
13-
Those weakrefs can expose to Python-level code objects that have had
14-
``tp_clear()`` called on them. See GH-91636 as an example of this kind of
15-
bug. This is fixes be clearing all weakrefs to unreachable objects after
16-
finalizers have been executed.
1+
Fix a bug caused by the garbage collector clearing weakrefs too early. The
2+
weakrefs in the ``tp_subclasses`` dictionary are needed in order to correctly
3+
invalidate type caches (for example, by calling ``PyType_Modified()``).
4+
Clearing weakrefs before calling finalizers causes the caches to not be
5+
correctly invalidated. That can cause crashes since the caches can refer to
6+
invalid objects. Defer the clearing of weakrefs without callbacks until after
7+
finalizers are executed.

0 commit comments

Comments
 (0)