8000 gh-115582: Make default PC/pyconfig.h work for free-threaded builds with manual /DPy_GIL_DISABLED by zooba · Pull Request #115850 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115582: Make default PC/pyconfig.h work for free-threaded builds with manual /DPy_GIL_DISABLED #115850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 26, 2024
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
0