# Feature or enhancement The current weakref implementation relies on the GIL for thread-safety. The `nogil-3.12` fork substantially modifies the weakref implementation. I think we can implement a simpler change in CPython 3.13 (main) now that all PyObject's have their own mutex (in `--disable-gil` builds). ### Basic idea Protect access to the weakrefs linked list using the mutex in the weakly referenced object. Use the critical section API. Prior implementation: https://github.com/colesbury/nogil-3.12/commit/0dddcb6f9d <!-- gh-linked-prs --> ### Linked PRs * gh-112189 * gh-112267 * gh-113621 * gh-116825 * gh-116843 * gh-116844 * gh-117168 * gh-117275 <!-- /gh-linked-prs -->