| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Add an explicit f_weakreflist field to the frame object, following the same pattern as generators and coroutines, including free-threading-safe weakref clearing via FT_CLEAR_WEAKREFS() in frame_dealloc(). Py_TPFLAGS_MANAGED_WEAKREF is not used because static builtin types must not carry it (see init_static_type()) and the pre-header would cost two extra words per frame instead of one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Documentation build overview6 files changed · ± 6 modified ± Modified |
Sorry, something went wrong.
Exceptions raised in worker threads don't propagate to the unittest result, so report weakref mismatches via a shared list instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Under --parallel-threads a concurrent collection can turn a test's own gc.collect() into a no-op, leaving its cycles uncollected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Drop tests that exercised generic weakref machinery already covered by test_weakref (proxy, shared refs, WeakValueDictionary, coroutine frames) and fold the callback assertion into the basic test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
Frame objects now support weak references, stored in an explicit f_weakreflist field, following the same pattern as generators and coroutines. Weakref clearing in frame_dealloc() uses FT_CLEAR_WEAKREFS(), which handles the free-threaded build correctly (unconditional PyObject_ClearWeakRefs() there, NULL-check fast path on the default build).
Py_TPFLAGS_MANAGED_WEAKREF was considered instead, but static builtin types must not carry it (see init_static_type()), and the managed pre-header would cost two extra words per frame object instead of one.
This is a redo of GH-102962 against current main. Compared to that PR it adds free-threading-safe weakref clearing, a more comprehensive test suite, and docs.
Tested on the default, free-threaded (--disable-gil), and JIT (--enable-experimental-jit) builds.
🤖 Generated with Claude Code