GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-144533: Use pybuilddir.txt to find _sysconfigdata for WASI by therohityadav · Pull Request #144535 · python/cpython

Conversation

@therohityadav

@therohityadav therohityadav commented Feb 6, 2026

Copy link
Copy Markdown
  • Issue: Stop calculating the location of _sysconfigdata for the WASI build script #144533

Use pybuilddir.txt to find _sysconfigdata for the WASI build script.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@therohityadav
therohityadav requested review from brettcannon, emmatyping and savannahostrowski as code owners February 6, 2026 07:56
@python-cla-bot

python-cla-bot Bot commented Feb 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added the awaiting review label Feb 6, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Feb 6, 2026
Stop calculating the location of _sysconfigdata for the WASI build script #144533
Closed
@bedevere-app

bedevere-app Bot commented Feb 6, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@therohityadav
therohityadav force-pushed the fix-wasi-build-144533 branch 2 times, most recently from 035c77e to b64935a Compare February 6, 2026 08:59
savannahostrowski
savannahostrowski requested changes Feb 6, 2026
View reviewed changes
Comment thread Platforms/WASI/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting review label Feb 6, 2026
@bedevere-app

bedevere-app Bot commented Feb 6, 2026

Copy link
Copy Markdown

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 phrase I 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added the awaiting changes label Feb 6, 2026
brettcannon
brettcannon reviewed Feb 6, 2026
View reviewed changes
Comment thread Platforms/WASI/__main__.py Outdated
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

@brettcannon brettcannon Feb 6, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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 via make 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 the python.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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@savannahostrowski savannahostrowski Feb 6, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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 with ModuleNotFoundError: 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@brettcannon brettcannon Feb 9, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@savannahostrowski savannahostrowski Feb 20, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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 delete this entirely in favour of passing --argv0 to wasmtime. getpath.py reads pybuilddir.txt from the directory of the binary to auto-discover the sysconfig data directory, but without --argv0 the WASI guest receives the host path for argv[0] which doesn't resolve inside the guest filesystem. I tested this locally and everything built correctly/tests passed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@savannahostrowski savannahostrowski Feb 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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 replace PYTHONPATH with ARGV0 here and the plumb it through in default_host_runner

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Jamesgmz4k reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@savannahostrowski savannahostrowski Feb 27, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@therohityadav
pythongh-144533: Use pybuilddir.txt to find _sysconfigdata for WASI
0ecc19e
@therohityadav
therohityadav force-pushed the fix-wasi-build-144533 branch from b64935a to 0ecc19e Compare February 7, 2026 05:49
@therohityadav
therohityadav requested a review from savannahostrowski February 7, 2026 14:16
@savannahostrowski

savannahostrowski commented Feb 28, 2026

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@savannahostrowski savannahostrowski closed this Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brettcannon brettcannon brettcannon left review comments
@emmatyping emmatyping Awaiting requested review from emmatyping emmatyping is a code owner
@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski savannahostrowski is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting changes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@therohityadav @savannahostrowski @brettcannon
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.