Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Building extensions intended for free-threaded builds of CPython now require
compiling with ``/DPy_GIL_DISABLED`` manually when using a regular install. This
is expected to change in future releases.
7 changes: 6 additions & 1 deletion PC/pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ WIN32 is still required for the locale module.
#endif /* Py_BUILD_CORE || Py_BUILD_CORE_BUILTIN || Py_BUILD_CORE_MODULE */

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

/* Compiler specific defines */

Expand Down
2 changes: 1 addition & 1 deletion PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@
<OldPyConfigH Condition="Exists('$(IntDir)pyconfig.h')">$([System.IO.File]::ReadAllText('$(IntDir)pyconfig.h'))</OldPyConfigH>
</PropertyGroup>
<PropertyGroup Condition="$(DisableGil) == 'true'">
<PyConfigHText>$(PyConfigHText.Replace('#undef Py_GIL_DISABLED', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
<PyConfigHText>$(PyConfigHText.Replace('/* #define Py_GIL_DISABLED 1 */', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
</PropertyGroup>
<Message Text="Updating pyconfig.h" Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
<WriteLinesToFile File="$(IntDir)pyconfig.h"
Expand Down