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: Fix finding pyconfig.h on Windows JIT builds (GH-134349)#134359

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
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
3 changes: 1 addition & 2 deletionsPCbuild/regen.targets
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -125,8 +125,7 @@
<JITArgsCondition="$(Platform) == 'x64'">x86_64-pc-windows-msvc</JITArgs>
<JITArgsCondition="$(Configuration) == 'Debug'">$(JITArgs) --debug</JITArgs>
</PropertyGroup>
<ExecCommand='$(PythonForBuild) "$(PySourcePath)Tools\jit\build.py" $(JITArgs)'
WorkingDirectory="$(GeneratedJitStencilsDir)"/>
<ExecCommand='$(PythonForBuild) "$(PySourcePath)Tools\jit\build.py" $(JITArgs) --output-dir "$(GeneratedJitStencilsDir)" --pyconfig-dir "$(PySourcePath)PC"'/>
</Target>
<TargetName="_CleanJIT"AfterTargets="Clean">
<DeleteFiles="@(_JITOutputs)"/>
Expand Down
16 changes: 8 additions & 8 deletionsTools/jit/_targets.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ class _Target(typing.Generic[_S, _R]):
debug:bool=False
verbose:bool=False
known_symbols:dict[str,int]=dataclasses.field(default_factory=dict)
pyconfig_dir:pathlib.Path=pathlib.Path.cwd().resolve()

def_get_nop(self)->bytes:
ifre.fullmatch(r"aarch64-.*",self.triple):
Expand All@@ -57,13 +58,13 @@ def _get_nop(self) -> bytes:
raiseValueError(f"NOP not defined for{self.triple}")
returnnop

def_compute_digest(self,out:pathlib.Path)->str:
def_compute_digest(self)->str:
hasher=hashlib.sha256()
hasher.update(self.triple.encode())
hasher.update(self.debug.to_bytes())
# These dependencies are also reflected in _JITSources in regen.targets:
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
hasher.update((out/"pyconfig.h").read_bytes())
hasher.update((self.pyconfig_dir/"pyconfig.h").read_bytes())
fordirpath,_,filenamesinsorted(os.walk(TOOLS_JIT)):
forfilenameinfilenames:
hasher.update(pathlib.Path(dirpath,filename).read_bytes())
Expand DownExpand Up@@ -125,7 +126,7 @@ async def _compile(
f"-D_JIT_OPCODE={opname}",
"-D_PyJIT_ACTIVE",
"-D_Py_JIT",
"-I.",
f"-I{self.pyconfig_dir}",
f"-I{CPYTHON/'Include'}",
f"-I{CPYTHON/'Include'/'internal'}",
f"-I{CPYTHON/'Include'/'internal'/'mimalloc'}",
Expand DownExpand Up@@ -193,28 +194,27 @@ async def _build_stencils(self) -> dict[str, _stencils.StencilGroup]:

defbuild(
self,
out:pathlib.Path,
*,
comment:str="",
force:bool=False,
stencils_h:str="jit_stencils.h",
jit_stencils:pathlib.Path,
)->None:
"""Build jit_stencils.h in the given directory."""
jit_stencils.parent.mkdir(parents=True,exist_ok=True)
ifnotself.stable:
warning=f"JIT support for{self.triple} is still experimental!"
request="Please report any issues you encounter.".center(len(warning))
outline="="*len(warning)
print("\n".join(["",outline,warning,request,outline,""]))
digest=f"//{self._compute_digest(out)}\n"
jit_stencils=out/stencils_h
digest=f"//{self._compute_digest()}\n"
if (
notforce
andjit_stencils.exists()
andjit_stencils.read_text().startswith(digest)
):
return
stencil_groups=ASYNCIO_RUNNER.run(self._build_stencils())
jit_stencils_new=out/"jit_stencils.h.new"
jit_stencils_new=jit_stencils.parent/"jit_stencils.h.new"
try:
withjit_stencils_new.open("w")asfile:
file.write(digest)
Expand Down
21 changes: 17 additions & 4 deletionsTools/jit/build.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,6 @@
import_targets

if__name__=="__main__":
out=pathlib.Path.cwd().resolve()
comment=f"${shlex.join([pathlib.Path(sys.executable).name]+sys.argv)}"
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument(
Expand All@@ -23,6 +22,20 @@
parser.add_argument(
"-f","--force",action="store_true",help="force the entire JIT to be rebuilt"
)
parser.add_argument(
"-o",
"--output-dir",
help="where to output generated files",
required=True,
type=lambdap:pathlib.Path(p).resolve(),
)
parser.add_argument(
"-p",
"--pyconfig-dir",
help="where to find pyconfig.h",
required=True,
type=lambdap:pathlib.Path(p).resolve(),
)
parser.add_argument(
"-v","--verbose",action="store_true",help="echo commands as they are run"
)
Expand All@@ -31,13 +44,13 @@
target.debug=args.debug
target.force=args.force
target.verbose=args.verbose
target.pyconfig_dir=args.pyconfig_dir
target.build(
out,
comment=comment,
stencils_h=f"jit_stencils-{target.triple}.h",
force=args.force,
jit_stencils=args.output_dir/f"jit_stencils-{target.triple}.h",
)
jit_stencils_h=out/"jit_stencils.h"
jit_stencils_h=args.output_dir/"jit_stencils.h"
lines= [f"//{comment}\n"]
guard="#if"
fortargetinargs.target:
Expand Down
2 changes: 1 addition & 1 deletionconfigure
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionconfigure.ac
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2776,7 +2776,7 @@ AS_VAR_IF([jit_flags],
[],
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
AS_VAR_SET([REGEN_JIT_COMMAND],
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host}"])
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir ."])
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
AS_VAR_IF([Py_DEBUG],
[true],
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp