Skip to content

PyRefTracer_SetTracer and PyRefTracer_GetTracer are not thread safe in the free threading build #137992

@pablogsal

Description

@pablogsal

Setting and getting the current ref tracer should be done while all the threads are stopped to avoid races. This is because users cannot ever safely free the old ref tracer's user data in a free threaded build, because is not possible to ever be sure that no other thread is in the middle of calling the ref tracer. Without synchronizing across threads there, one thread can still be trying to use the old tracer while another thinks it has been successfully uninstalled and safe to clean up

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixestopic-free-threadingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions