Skip to content

[C API] Add PyMutex_STATIC_INIT macro #142585

@vstinner

Description

@vstinner

Currently, self->mutex = (PyMutex){0}; or self->mutex = (PyMutex){_Py_UNLOCKED} pattern is used to initialize statically a PyMutex. It leaks implementation details of PyMutex.

I propose adding PyMutex_STATIC_INIT macro to abstract the initialization. The pattern becomes: self->mutex = PyMutex_STATIC_INIT;.

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