8000 gh-115582: Make default PC/pyconfig.h work for free-threaded builds w… · python/cpython@37a13b9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 37a13b9

Browse files
authored
gh-115582: Make default PC/pyconfig.h work for free-threaded builds with manual /DPy_GIL_DISABLED (GH-115850)
1 parent 72cff8d commit 37a13b9

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Building extensions intended for free-threaded builds of CPython now require
2+
compiling with ``/DPy_GIL_DISABLED`` manually when using a regular install. This
3+
is expected to change in future releases.

PC/pyconfig.h.in

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ WIN32 is still required for the locale module.
9595
#endif /* Py_BUILD_CORE || Py_BUILD_CORE_BUILTIN || Py_BUILD_CORE_MODULE */
9696

9797
/* Define to 1 if you want to disable the GIL */
98-
#undef Py_GIL_DISABLED
98+
/* Uncomment the definition for free-threaded builds, or define it manually
99+
* when compiling extension modules. Note that we test with #ifdef, so
100+
* defining as 0 will still disable the GIL. */
101+
#ifndef Py_GIL_DISABLED
102+
/* #define Py_GIL_DISABLED 1 */
103+
#endif
99104

100105
/* Compiler specific defines */
101106

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@
677677
<OldPyConfigH Condition="Exists('$(IntDir)pyconfig.h')">$([System.IO.File]::ReadAllText('$(IntDir)pyconfig.h'))</OldPyConfigH>
678678
</PropertyGroup>
679679
<PropertyGroup Condition="$(DisableGil) == 'true'">
680-
<PyConfigHText>$(PyConfigHText.Replace('#undef Py_GIL_DISABLED', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
680+
<PyConfigHText>$(PyConfigHText.Replace('/* #define Py_GIL_DISABLED 1 */', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
681681
</PropertyGroup>
682682
<Message Text="Updating pyconfig.h" Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
683683
<WriteLinesToFile File="$(IntDir)pyconfig.h"

0 commit comments

Comments
 (0)
0