Skip to content

Fix thread-safety for PyType_IsSubtype in free-threaded builds #117306

Closed

Description

@mpage

Feature or enhancement

Proposal:

In #117275 we started performing reads of the MRO in PyType_IsSubtype in a thread-unsafe way. We need to read the MRO in a way that ideally doesn't lock, or at the very least locks without the possibility of suspending.

One potential solution is to use deferred reference counting to avoid locking.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Activity

  1. changed the title [-]Implement a more robust solution for avoiding locking in `PyType_IsSubtype` in free-threaded builds[/-] [+]Fix thread-safety for `PyType_IsSubtype` in free-threaded builds[/+] on Mar 28, 2024
  2. added
    type-bugAn unexpected behavior, bug, or error
    and removed
    type-featureA feature request or enhancement
    on Mar 28, 2024
  3. added a commit that references this issue on Mar 29, 2024
  4. added a commit that references this issue on Apr 17, 2024
  5. StanFromIreland commented on Jun 9, 2026

    @StanFromIreland
    Member

    I presume this was fixed by 5d21d88, please re-open if that was incorrect.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions