Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Py_GIL_DISABLED not defined in "free-threaded" Windows C-API extensions #111650

Closed
Assignees
zooba
Labels
@colesbury

Description

@colesbury

Bug report

On Windows, thePy_GIL_DISABLED macro is not defined when building C API extensions with the free-threaded build of CPython 3.13 (i.e.,--disable-gil). Now that biased reference counting (6dfb8fe) landed, this leads to incorrect/failed compilation of extensions on Windows1. The problem does not occur on Linux/macOS and other./configure based builds because that build system defines thePy_NOGIL macro as part ofpyconfig.h. On Windows,Py_GIL_DISABLED instead defined as a pre-processor definition inpyproject.props, but that's used by C-API extensions.

Among other problems, this leads totest_peg_generator failing on the nogil Windows buildbot (example failure).

I can think of two possible approaches to fixing this:

  1. Modify setuptools (maybe setuptools.distutils?) to definePy_GIL_DISABLED when invoking the compiler ifsysconfig.get_config_var("Py_NOGIL") isTrue.
  2. In the CPython Windows build, generate a header file defining/undefingPy_GIL_DISABLED depending on if the build is invoked with--disable-gil or not.

The first option seems a little more straightforward to me, but there is a risk that we might encounter this same issue across multiple extension build systems. The second option seems like it would more robustly address this issue.

Linked PRs

Footnotes

  1. Modules built as part of the CPython build (i.e., standard library modules) still work

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp