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

gh-144533: Use pybuilddir.txt to find _sysconfigdata for WASI#144535

Closed
therohityadav wants to merge 1 commit intopython:mainfrom
therohityadav:fix-wasi-build-144533
Closed

gh-144533: Use pybuilddir.txt to find _sysconfigdata for WASI#144535
therohityadav wants to merge 1 commit intopython:mainfrom
therohityadav:fix-wasi-build-144533

Conversation

@therohityadav
Copy link

Usepybuilddir.txt to find_sysconfigdata for the WASI build script.

The previous implementation hardcoded the path pattern tobuild/lib.wasi-wasm32-{python_version}. This change makes the script more robust by reading the exact build directory frompybuilddir.txt if it exists. It falls back to the hardcoded path if the file is missing to ensure backward compatibility during early build stages.

@python-cla-bot
Copy link

python-cla-botbot commentedFeb 6, 2026
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@therohityadavtherohityadavforce-pushed thefix-wasi-build-144533 branch 2 times, most recently from035c77e tob64935aCompareFebruary 6, 2026 08:59
@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

with pybuilddir.open("r", encoding="utf-8") as f:
sysconfig_data_dir = f"{wasi_build_dir}/{f.read().strip()}"
else:
# Fallback if the build hasn't generated the file yet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Something feels off. Why did I ever care about setting this when configuring the host? If I remember correctly it was because tests failed using the host runner if I didn't viamake test. But that doesn't seem right since that would mean a WASI build was somehow special in regards to paths compared to any other build which it shouldn't be. Plus if thepython.sh shell script works which doesn't make the change to PYTHONPATH then it really feels weird that this is even here.

Can someone test what happens if you just take out the environment updates?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah, that's right. I tested removing the environment updates. Without PYTHONPATH, tests fail withModuleNotFoundError: No module named '_sysconfigdata__wasi_wasm32-wasi' (because this lives in the build dir and not in Lib/, I think).

python.sh does include PYTHONPATH. It's just passed in via--env in the wasmtime command.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is this an out-of-tree build issue? I never bothered to figure out why this is an issue since you would think all builds have the same situation and yet none of us set it when we run the test suite from a checkout.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes, that is the case. However, after looking into this more, I think we can deletethis entirely in favour of passing--argv0 to wasmtime.getpath.py readspybuilddir.txt from the directory of the binary to auto-discover the sysconfig data directory, but without--argv0 the WASI guest receives the host path forargv[0] which doesn't resolve inside the guest filesystem. I tested this locally and everything built correctly/tests passed.

Copy link
Member

@savannahostrowskisavannahostrowskiFeb 20, 2026
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@therohityadav Did you want to try applying the approach I mentioned above? We should just be able to replacePYTHONPATH with ARGV0here and the plumb it through indefault_host_runner

Jamesgmz4k reacted with thumbs up emoji

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've opened a PR with this approach here:#145328

@savannahostrowski
Copy link
Member

Hey there - thanks so much for working on this. However, based on the earlier discussion (#144535 (comment)), I've just merged a PR with a different approach so I'll close this.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@brettcannonbrettcannonbrettcannon left review comments

@emmatypingemmatypingAwaiting requested review from emmatypingemmatyping is a code owner

@savannahostrowskisavannahostrowskiAwaiting requested review from savannahostrowskisavannahostrowski is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@therohityadav@savannahostrowski@brettcannon

[8]ページ先頭

©2009-2026 Movatter.jp