Skip to content

Commit 6fafa6b

Browse files
authored
gh-108374: Add --disable-gil option to PCbuild/build.bat (#108729)
This adds a `--disable-gil` option to PCbuild/build.bat. For now, all this does is define the Py_NOGIL macro.
1 parent ecc61a6 commit 6fafa6b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

PCbuild/build.bat

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ echo. -k Attempt to kill any running Pythons before building (usually done
3333
echo. automatically by the pythoncore project)
3434
echo. --pgo Build with Profile-Guided Optimization. This flag
3535
echo. overrides -c and -d
36+
echo. --disable-gil Enable experimental support for running without the GIL.
3637
echo. --test-marker Enable the test marker within the build.
3738
echo. --regen Regenerate all opcodes, grammar and tokens.
3839
echo.
@@ -80,6 +81,7 @@ if "%~1"=="-q" (set verbose=/v:q /nologo /clp:summary) & shift & goto CheckOpts
8081
if "%~1"=="-k" (set kill=true) & shift & goto CheckOpts
8182
if "%~1"=="--pgo" (set do_pgo=true) & shift & goto CheckOpts
8283
if "%~1"=="--pgo-job" (set do_pgo=true) & (set pgo_job=%~2) & shift & shift & goto CheckOpts
84+
if "%~1"=="--disable-gil" (set UseDisableGil=true) & shift & goto CheckOpts
8385
if "%~1"=="--test-marker" (set UseTestMarker=true) & shift & goto CheckOpts
8486
if "%~1"=="-V" shift & goto Version
8587
if "%~1"=="--regen" (set Regen=true) & shift & goto CheckOpts
@@ -172,6 +174,7 @@ echo on
172174
/p:IncludeExternals=%IncludeExternals%^
173175
/p:IncludeCTypes=%IncludeCTypes%^
174176
/p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^
177+
/p:DisableGil=%UseDisableGil%^
175178
/p:UseTestMarker=%UseTestMarker% %GITProperty%^
176179
%1 %2 %3 %4 %5 %6 %7 %8 %9
177180

PCbuild/pyproject.props

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<ClCompile>
4141
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
4242
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
43+
<PreprocessorDefinitions Condition="'$(DisableGil)' == 'true'">Py_NOGIL=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
4344

4445
<Optimization>MaxSpeed</Optimization>
4546
<IntrinsicFunctions>true</IntrinsicFunctions>

0 commit comments

Comments
 (0)