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-118234: Avoid socket failure with missing SYSTEMROOT env var on Windows#134363

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

Closed
jhohm wants to merge4 commits intopython:mainfromjhohm:gh-118234

Conversation

jhohm
Copy link
Contributor

@jhohmjhohm commentedMay 20, 2025
edited by bedevere-appbot
Loading

Resolves#118234 by checking for the SystemRoot environment variable and, if it is missing, setting it based onGetWindowsDirectoryW.

As described in the issue, the default path of the provider DLL is stored in the registry as "%SystemRoot%\System32\mswsock.dll" which does not resolve without SystemRoot set (typically to "C:\Windows").

Resolvespython#118234 by checking for the SystemRoot environment variableand, if it is missing, setting it based on GetWindowsDirectoryW.As described in the issue, the default path of the provider DLL isstored in the registry as "%SystemRoot%\System32\mswsock.dll" which doesnot resolve without SystemRoot set (typically to "C:\Windows").
@vstinner
Copy link
Member

I don't think that it's a good idea to setSYSTEMROOT environment variable onimport socket. It's a surprising side effect. I suspect that other Python stdlib modules don't work well withoutSYSTEMROOT.

cc@zooba

@zooba
Copy link
Member

Yeah, I don't love this, and certainly not as part of socketmodule. It might make sense in python.c, to detect whenever someone launches Python with an empty environment, but it's probably even better in subprocess to warn peoplebefore they launch with an empty environment.

In my experience, this only ever happens when launching from Python. I've not seen any other language cause it.This list linked in the bug has the main ones, and we should probably just ensure that subprocess always sets them if the caller omits them.

@jhohm
Copy link
ContributorAuthor

Sentgh-134435 instead.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

sockets and asyncio on Windows depend on SYSTEMROOT env var
3 participants
@jhohm@vstinner@zooba

[8]ページ先頭

©2009-2025 Movatter.jp