`PyType_AddWatcher` and friends are not thread safe in free-threading · Issue #131544 · python/cpython · GitHub
Skip to content

PyType_AddWatcher and friends are not thread safe in free-threading #131544

Description

@kumaraditya303

PyType_AddWatcher and PyType_ClearWatcher are not thread safe as it modifies the interp's type watchers non-atomically.

PyType_AddWatcher:

PyType_ClearWatcher:

I think adding and removing of type watchers is a rare event so maybe instead of adding atomics or locks it would be better to change them to use stop-the-world pause event.

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions