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

[3.14] gh-133779: Revert Windows generation of pyconfig.h and go back to a static header. (GH-133966)#134211

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zooba merged 1 commit intopython:3.14fromzooba:gh-133779-3.14
May 19, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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
8 changes: 8 additions & 0 deletionsDoc/howto/free-threading-extensions.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,14 @@ You can use it to enable code that only runs under the free-threaded build::
/* code that only runs in the free-threaded build */
#endif

..note::

On Windows, this macro is not defined automatically, but must be specified
to the compiler when building. The:func:`sysconfig.get_config_var` function
can be used to determine whether the current running interpreter had the
macro defined.


Module Initialization
=====================

Expand Down
6 changes: 6 additions & 0 deletionsDoc/whatsnew/3.14.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -829,6 +829,12 @@ Kumar Aditya, Edgar Margffoy, and many others.
Some of these contributors are employed by Meta, which has continued to provide
significant engineering resources to support this project.

From 3.14, when compiling extension modules for the free-threaded build of
CPython on Windows, the preprocessor variable ``Py_GIL_DISABLED`` now needs to
be specified by the build backend, as it will no longer be determined
automatically by the C compiler. For a running interpreter, the setting that
was used at compile time can be found using:func:`sysconfig.get_config_var`.


.. _whatsnew314-pyrepl-highlighting:

Expand Down
13 changes: 13 additions & 0 deletionsInclude/Python.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,6 +59,14 @@
# include<intrin.h>// __readgsqword()
#endif

// Suppress known warnings in Python header files.
#if defined(_MSC_VER)
// Warning that alignas behaviour has changed. Doesn't affect us, because we
// never relied on the old behaviour.
#pragma warning(push)
#pragma warning(disable: 5274)
#endif

// Include Python header files
#include"pyport.h"
#include"pymacro.h"
Expand DownExpand Up@@ -138,4 +146,9 @@
#include"cpython/pyfpe.h"
#include"cpython/tracemalloc.h"

// Restore warning filter
#ifdef_MSC_VER
#pragma warning(pop)
#endif

#endif/* !Py_PYTHON_H */
2 changes: 1 addition & 1 deletionLib/sysconfig/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -468,7 +468,7 @@ def get_config_h_filename():
"""Return the path of pyconfig.h."""
if_PYTHON_BUILD:
ifos.name=="nt":
inc_dir=os.path.dirname(sys._base_executable)
inc_dir=os.path.join(_PROJECT_BASE,'PC')
else:
inc_dir=_PROJECT_BASE
else:
Expand Down
5 changes: 1 addition & 4 deletionsLib/test/test_sysconfig.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -531,13 +531,10 @@ def test_srcdir(self):
Python_h=os.path.join(srcdir,'Include','Python.h')
self.assertTrue(os.path.exists(Python_h),Python_h)
# <srcdir>/PC/pyconfig.h.in always exists even if unused
pyconfig_h=os.path.join(srcdir,'PC','pyconfig.h.in')
self.assertTrue(os.path.exists(pyconfig_h),pyconfig_h)
pyconfig_h_in=os.path.join(srcdir,'pyconfig.h.in')
self.assertTrue(os.path.exists(pyconfig_h_in),pyconfig_h_in)
ifos.name=='nt':
# <executable dir>/pyconfig.h exists on Windows in a build tree
pyconfig_h=os.path.join(sys.executable,'..','pyconfig.h')
pyconfig_h=os.path.join(srcdir,'PC','pyconfig.h')
self.assertTrue(os.path.exists(pyconfig_h),pyconfig_h)
elifos.name=='posix':
makefile_dir=os.path.dirname(sysconfig.get_makefile_filename())
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
Reverts the change to generate different:file:`pyconfig.h` files based on
compiler settings, as it was frequently causing extension builds to break.
In particular, the ``Py_GIL_DISABLED`` preprocessor variable must now always
be defined explicitly when compiling for the experimental free-threaded
runtime. The:func:`sysconfig.get_config_var` function can be used to
determine whether the current runtime was compiled with that flag or not.
22 changes: 16 additions & 6 deletionsPC/pyconfig.h.in → PC/pyconfig.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -94,12 +94,22 @@
#endif
#endif /* Py_BUILD_CORE || Py_BUILD_CORE_BUILTIN || Py_BUILD_CORE_MODULE */

/* Define to 1 if you want to disable the GIL */
/* 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 */
/* _DEBUG implies Py_DEBUG */
#ifdef _DEBUG
# define Py_DEBUG 1
#endif

/* Define to 1 when compiling for experimental free-threaded builds */
#ifdef Py_GIL_DISABLED
/* We undefine if it was set to zero because all later checks are #ifdef.
* Note that non-Windows builds do not do this, and so every effort should
* be made to avoid defining the variable at all when not desired. However,
* sysconfig.get_config_var always returns a 1 or a 0, and so it seems likely
* that a build backend will define it with the value.
*/
#if Py_GIL_DISABLED == 0
#undef Py_GIL_DISABLED
#endif
#endif

/* Compiler specific defines */
Expand DownExpand Up@@ -377,7 +387,7 @@
#endif

#ifdef _DEBUG
# define Py_DEBUG

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (arm64)

'Py_DEBUG': macro redefinition [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 390 in PC/pyconfig.h

View workflow job for this annotation

GitHub Actions/ Windows (free-threading) / Build and test (x64)

'Py_DEBUG': macro redefinition [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
#endif


Expand Down
27 changes: 1 addition & 26 deletionsPCbuild/_freeze_module.vcxproj
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -276,7 +276,7 @@
<ClCompileInclude="..\Python\uniqueid.c" />
</ItemGroup>
<ItemGroup>
<ClIncludeInclude="..\PC\pyconfig.h.in" />
<ClIncludeInclude="..\PC\pyconfig.h" />
</ItemGroup>
<ItemGroup>
<!-- BEGIN frozen modules-->
Expand DownExpand Up@@ -436,31 +436,6 @@
<ImportGroupLabel="ExtensionTargets">
</ImportGroup>

<!-- Direct copy from pythoncore.vcxproj, but this one is only used for our
own build. All other extension modules will use the copy that pythoncore
generates.-->
<TargetName="_UpdatePyconfig"BeforeTargets="PrepareForBuild">
<MakeDirDirectories="$(IntDir)"Condition="!Exists($(IntDir))" />
<ItemGroup>
<PyConfigHRemove="@(PyConfigH)" />
<PyConfigHInclude="@(ClInclude)"Condition="'%(Filename)%(Extension)' == 'pyconfig.h.in'" />
</ItemGroup>
<ErrorText="Did not find pyconfig.h"Condition="@(ClInclude) == ''" />
<PropertyGroup>
<PyConfigH>@(PyConfigH->'%(FullPath)', ';')</PyConfigH>
<PyConfigHText>$([System.IO.File]::ReadAllText($(PyConfigH)))</PyConfigHText>
<OldPyConfigHCondition="Exists('$(IntDir)pyconfig.h')">$([System.IO.File]::ReadAllText('$(IntDir)pyconfig.h'))</OldPyConfigH>
</PropertyGroup>
<PropertyGroupCondition="$(DisableGil) == 'true'">
<PyConfigHText>$(PyConfigHText.Replace('/* #define Py_GIL_DISABLED 1 */', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
</PropertyGroup>
<MessageText="Updating pyconfig.h"Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
<WriteLinesToFileFile="$(IntDir)pyconfig.h"
Lines="$(PyConfigHText)"
Overwrite="true"
Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
</Target>

<TargetName="_RebuildGetPath"AfterTargets="_RebuildFrozen"Condition="$(Configuration) != 'PGUpdate'">
<ExecCommand='"$(TargetPath)" "%(GetPath.ModName)" "%(GetPath.FullPath)" "%(GetPath.IntFile)"' />

Expand Down
8 changes: 4 additions & 4 deletionsPCbuild/pyproject.props
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,9 @@
<Py_IntDirCondition="'$(Py_IntDir)' == ''">$(MSBuildThisFileDirectory)obj\</Py_IntDir>
<IntDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
<IntDir>$(IntDir.Replace(`\\`, `\`))</IntDir>
<!-- pyconfig.h is updated by pythoncore.vcxproj, so it's always in pythoncore's IntDir-->
<GeneratedPyConfigDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\pythoncore\</GeneratedPyConfigDir>
<GeneratedFrozenModulesDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)_frozen\</GeneratedFrozenModulesDir>
<GeneratedZlibNgDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\zlib-ng\</GeneratedZlibNgDir>
<GeneratedJitStencilsDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)_$(Configuration)</GeneratedJitStencilsDir>
<TargetNameCondition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
<TargetName>$(TargetName)$(PyDebugExt)</TargetName>
<GenerateManifest>false</GenerateManifest>
Expand DownExpand Up@@ -49,11 +48,12 @@
<_PlatformPreprocessorDefinitionCondition="$(Platform) == 'x64'">_WIN64;</_PlatformPreprocessorDefinition>
<_PlatformPreprocessorDefinitionCondition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition)</_PlatformPreprocessorDefinition>
<_Py3NamePreprocessorDefinition>PY3_DLLNAME=L"$(Py3DllName)$(PyDebugExt)";</_Py3NamePreprocessorDefinition>
<_FreeThreadedPreprocessorDefinitionCondition="$(DisableGil) == 'true'">Py_GIL_DISABLED=1;</_FreeThreadedPreprocessorDefinition>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(GeneratedPyConfigDir);$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition)$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)$(_FreeThreadedPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitionsCondition="'$(SupportPGO)' and ($(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate')">_Py_USING_PGO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>

<Optimization>MaxSpeed</Optimization>
Expand Down
31 changes: 2 additions & 29 deletionsPCbuild/pythoncore.vcxproj
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -102,6 +102,7 @@
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(PySourcePath)Modules\_hacl;$(PySourcePath)Modules\_hacl\include;$(PySourcePath)Python;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectoriesCondition="$(IncludeExternals)">$(zlibNgDir);$(GeneratedZlibNgDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectoriesCondition="'$(UseJIT)' == 'true'">$(GeneratedJitStencilsDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";ZLIB_COMPAT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitionsCondition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitionsCondition="'$(UseJIT)' == 'true'">_Py_JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand DownExpand Up@@ -409,7 +410,7 @@
<ClIncludeInclude="..\Parser\string_parser.h" />
<ClIncludeInclude="..\Parser\pegen.h" />
<ClIncludeInclude="..\PC\errmap.h" />
<ClIncludeInclude="..\PC\pyconfig.h.in" />
<ClIncludeInclude="..\PC\pyconfig.h" />
<ClIncludeInclude="..\Python\condvar.h" />
<ClIncludeInclude="..\Python\stdlib_module_names.h" />
<ClIncludeInclude="..\Python\thread_nt.h" />
Expand DownExpand Up@@ -688,34 +689,6 @@
</ImportGroup>
<TargetName="_TriggerRegen"BeforeTargets="PrepareForBuild"DependsOnTargets="Regen" />

<TargetName="_UpdatePyconfig"BeforeTargets="PrepareForBuild">
<MakeDirDirectories="$(IntDir)"Condition="!Exists($(IntDir))" />
<ItemGroup>
<PyConfigHRemove="@(PyConfigH)" />
<PyConfigHInclude="@(ClInclude)"Condition="'%(Filename)%(Extension)' == 'pyconfig.h.in'" />
</ItemGroup>
<ErrorText="Did not find pyconfig.h"Condition="@(ClInclude) == ''" />
<PropertyGroup>
<PyConfigH>@(PyConfigH->'%(FullPath)', ';')</PyConfigH>
<PyConfigHText>$([System.IO.File]::ReadAllText($(PyConfigH)))</PyConfigHText>
<OldPyConfigHCondition="Exists('$(IntDir)pyconfig.h')">$([System.IO.File]::ReadAllText('$(IntDir)pyconfig.h'))</OldPyConfigH>
</PropertyGroup>
<PropertyGroupCondition="$(DisableGil) == 'true'">
<PyConfigHText>$(PyConfigHText.Replace('/* #define Py_GIL_DISABLED 1 */', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
</PropertyGroup>
<MessageText="Updating pyconfig.h"Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
<WriteLinesToFileFile="$(IntDir)pyconfig.h"
Lines="$(PyConfigHText)"
Overwrite="true"
Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
</Target>
<TargetName="_CopyPyconfig"Inputs="$(IntDir)pyconfig.h"Outputs="$(OutDir)pyconfig.h"AfterTargets="Build"DependsOnTargets="_UpdatePyconfig">
<CopySourceFiles="$(IntDir)pyconfig.h"DestinationFolder="$(OutDir)" />
</Target>
<TargetName="_CleanPyconfig"AfterTargets="Clean">
<DeleteFiles="$(IntDir)pyconfig.h;$(OutDir)pyconfig.h" />
</Target>

<TargetName="_GetBuildInfo"BeforeTargets="PrepareForBuild">
<PropertyGroup>
<GITCondition="$(GIT) == ''">git</GIT>
Expand Down
14 changes: 7 additions & 7 deletionsPCbuild/regen.targets
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,12 +29,12 @@
<_KeywordSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
<_KeywordOutputs Include="$(PySourcePath)Lib\keyword.py" />
<!-- Taken from _Target._compute_digest in Tools\jit\_targets.py: -->
<_JITSources Include="$(PySourcePath)Python\executor_cases.c.h;$(GeneratedPyConfigDir)pyconfig.h;$(PySourcePath)Tools\jit\**"/>
<_JITSources Include="$(PySourcePath)Python\executor_cases.c.h;$(PySourcePath)PC\pyconfig.h;$(PySourcePath)Tools\jit\**"/>
<!-- Need to explicitly enumerate these, since globbing doesn't work for missing outputs: -->
<_JITOutputs Include="$(GeneratedPyConfigDir)jit_stencils.h"/>
<_JITOutputs Include="$(GeneratedPyConfigDir)jit_stencils-aarch64-pc-windows-msvc.h" Condition="$(Platform) == 'ARM64'"/>
<_JITOutputs Include="$(GeneratedPyConfigDir)jit_stencils-i686-pc-windows-msvc.h" Condition="$(Platform) == 'Win32'"/>
<_JITOutputs Include="$(GeneratedPyConfigDir)jit_stencils-x86_64-pc-windows-msvc.h" Condition="$(Platform) == 'x64'"/>
<_JITOutputs Include="$(GeneratedJitStencilsDir)jit_stencils.h"/>
<_JITOutputs Include="$(GeneratedJitStencilsDir)jit_stencils-aarch64-pc-windows-msvc.h" Condition="$(Platform) == 'ARM64'"/>
<_JITOutputs Include="$(GeneratedJitStencilsDir)jit_stencils-i686-pc-windows-msvc.h" Condition="$(Platform) == 'Win32'"/>
<_JITOutputs Include="$(GeneratedJitStencilsDir)jit_stencils-x86_64-pc-windows-msvc.h" Condition="$(Platform) == 'x64'"/>
<_CasesSources Include="$(PySourcePath)Python\bytecodes.c;$(PySourcePath)Python\optimizer_bytecodes.c;"/>
<_CasesOutputs Include="$(PySourcePath)Python\generated_cases.c.h;$(PySourcePath)Include\opcode_ids.h;$(PySourcePath)Include\internal\pycore_uop_ids.h;$(PySourcePath)Python\opcode_targets.h;$(PySourcePath)Include\internal\pycore_opcode_metadata.h;$(PySourcePath)Include\internal\pycore_uop_metadata.h;$(PySourcePath)Python\optimizer_cases.c.h;$(PySourcePath)Lib\_opcode_metadata.py"/>
<_SbomSources Include="$(PySourcePath)PCbuild\get_externals.bat" />
Expand DownExpand Up@@ -116,7 +116,7 @@

<Target Name="_RegenJIT"
Condition="'$(UseJIT)' == 'true'"
DependsOnTargets="_UpdatePyconfig;FindPythonForBuild"
DependsOnTargets="FindPythonForBuild"
Inputs="@(_JITSources)"
Outputs="@(_JITOutputs)">
<PropertyGroup>
Expand All@@ -126,7 +126,7 @@
<JITArgs Condition="$(Configuration) == 'Debug'">$(JITArgs) --debug</JITArgs>
</PropertyGroup>
<Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\jit\build.py" $(JITArgs)'
WorkingDirectory="$(GeneratedPyConfigDir)"/>
WorkingDirectory="$(GeneratedJitStencilsDir)"/>
</Target>
<Target Name="_CleanJIT" AfterTargets="Clean">
<Delete Files="@(_JITOutputs)"/>
Expand Down
2 changes: 1 addition & 1 deletionTools/msi/dev/dev_files.wxs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@
<Fragment>
<ComponentGroupId="dev_pyconfig">
<ComponentId="include_pyconfig.h"Directory="include"Guid="*">
<FileId="include_pyconfig.h"Name="pyconfig.h"Source="pyconfig.h"KeyPath="yes" />
<FileId="include_pyconfig.h"Name="pyconfig.h"Source="!(bindpath.src)PC\pyconfig.h"KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
Expand Down
2 changes: 2 additions & 0 deletionsTools/peg_generator/pegen/build.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,6 +108,8 @@ def compile_c_extension(
extra_compile_args.append("-DPy_BUILD_CORE_MODULE")
# Define _Py_TEST_PEGEN to not call PyAST_Validate() in Parser/pegen.c
extra_compile_args.append("-D_Py_TEST_PEGEN")
ifsys.platform=="win32"andsysconfig.get_config_var("Py_GIL_DISABLED"):
extra_compile_args.append("-DPy_GIL_DISABLED")
extra_link_args=get_extra_flags("LDFLAGS","PY_LDFLAGS_NODIST")
ifkeep_asserts:
extra_compile_args.append("-UNDEBUG")
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp