Merge from 3.4. · pythoncapi/cpython@983c106 · GitHub
Skip to content

Commit 983c106

Browse files
author
Tim Peters
committed
Merge from 3.4.
Issue python#21435: Segfault in gc with cyclic trash Changed the iteration logic in finalize_garbage() to tolerate objects vanishing from the list as a side effect of executing a finalizer.
2 parents 38ca5a7 + 5fbc7b1 commit 983c106

3 files changed

Lines changed: 59 additions & 11 deletions

File tree

Lib/test/test_gc.py

Lines changed: 32 additions & 0 deletions

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Release date: TBA
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #21435: In rare cases, when running finalizers on objects in cyclic
14+
trash a bad pointer dereference could occur due to a subtle flaw in
15+
internal iteration logic.
16+
1317
- Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
1418
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) and bytearray(int)
1519
are now using ``calloc()`` instead of ``malloc()`` for large objects which

Modules/gcmodule.c

Lines changed: 23 additions & 11 deletions

0 commit comments

Comments
 (0)