Content-Length: 290839 | pFad | https://github.com/python/cpython/issues/135607

DF data race with extension modules checking for empty weaklist · Issue #135607 · python/cpython · GitHub
Skip to content

data race with extension modules checking for empty weaklist #135607

@kumaraditya303

Description

@kumaraditya303

Extension modules which check for self->weakreflist != NULL in tp_dealloc before calling PyObject_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 calling PyObject_ClearWeakRefs always and removing checking for weaklist == NULL.

I'll try to find a smaller reproducer for this.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/135607

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy