gh-157377: Don't flush the thread-local allocation count in gc.get_co… · python/cpython@c215919 · GitHub
Skip to content

Commit c215919

Browse files
authored
gh-157377: Don't flush the thread-local allocation count in gc.get_count (#157381)
* gh-157377: Don't flush the thread-local allocation count in gc.get_count() * gh-157377: clamp gc.get_count() return value at zero
1 parent c3f2373 commit c215919

3 files changed

Lines changed: 30 additions & 4 deletions

File tree

Lib/test/test_gc.py

Lines changed: 19 additions & 0 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fix :func:`gc.get_count` on the free-threaded build resetting the thread-local
2+
allocation counter that schedules automatic garbage collection. A thread that
3+
called it while allocating could prevent cyclic garbage from ever being
4+
collected.

Modules/gcmodule.c

Lines changed: 7 additions & 4 deletions

0 commit comments

Comments
 (0)