Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.1k
Closed
Description
Extension modules which check forself->weakreflist != NULL intp_dealloc before callingPyObject_ClearWeakRefs(self) leads to to data race if another thread is concurrently mutating the weaklist.
In free-threading the weaklist is modified atomically as such it can cause data race with the non atomic reads in extension modules. This can be avoided in extension modules by callingPyObject_ClearWeakRefs always and removing checking forweaklist == NULL.
I'll try to find a smaller reproducer for this.
Linked PRs
- gh-135607: Remove null checking of weakref list in dealloc of extension modules and objects #135614
- [3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) #136119
- [3.13] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) #136126