Skip to content

The typical initialization of PyMutex in its comment document cannot be compiled on Windows #115304

Closed
@aisk

Description

@aisk

// Typical initialization:
// PyMutex m = (PyMutex){0};

But it cannot be compiled outside a function on Windows: https://github.com/python/cpython/actions/runs/7862752441/job/21452578591 with this error:

`3>D:\a\cpython\cpython\Modules\rotatingtree.c(19,16): error C2099: initializer is not a constant [D:\a\cpython\cpython\PCbuild\pythoncore.vcxproj]` 

Also check here be0427f#diff-266bed9d854389a88ddd0696e9a225a2570559901edf0e909de43dd1f49ce80aR19 to see the usage and the compile error.

Change it to PyMutex m = {0}; can resolve this issue.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions