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-120057: Add os.reload_environ() function#126268

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
vstinner merged 6 commits intopython:mainfromvstinner:reload_environ
Nov 5, 2024

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commentedNov 1, 2024
edited by github-actionsbot
Loading

Replace the os.environ.refresh() method with a new os.reload_environ() function.


📚 Documentation preview 📚:https://cpython-previews--126268.org.readthedocs.build/

EDM115 reacted with hooray emojincoghlan reacted with heart emoji
Replace the os.environ.refresh() method with a newos.reload_environ() function.
..function::reload_environ()

Update:data:`os.environ` and:data:`os.environb` with changes to the
environment made by:func:`os.putenv`, by:func:`os.unsetenv`, or made

Choose a reason for hiding this comment

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

I think that it is better to say "the process environment".
os.putenv and os.unsetenv update the cache, so there is no need to reload after them. You should refer to the C functions.
Please add a note that this function is not thread safe. Calling it while the environment is modified in other thread has undefined behavior. Reading from os.environ or calling os.getenv during reloading can return empty result.

rruuaanng reacted with thumbs up emoji
Copy link
Contributor

@rruuaanngrruuaanngNov 1, 2024
edited
Loading

Choose a reason for hiding this comment

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

If the process environment is mentioned, perhaps it can be specifically mentioned that it is the current process environment (I think)

Edit
Or, it can be called the current program.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

os.putenv() andos.unsetenv() don't updateos.environ: seetest_reload_environ().

serhiy-storchaka reacted with thumbs up emoji
@vstinner
Copy link
MemberAuthor

@serhiy-storchaka: Please review the updated PR. I addressed your review.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. Let a native speaker to review the wording.

@vstinner
Copy link
MemberAuthor

cc@zooba@ncoghlan

Copy link
Member

@picnixzpicnixz left a comment

Choose a reason for hiding this comment

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

Not a native speaker but here are some suggestions. For native speakers: @python/proofreaders

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@vstinner
Copy link
MemberAuthor

@picnixz: I applied your suggestions.

picnixz reacted with heart emoji

Copy link
Contributor

@ncoghlanncoghlan left a comment

Choose a reason for hiding this comment

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

LGTM! (although see@AA-Turner's suggested docs wording tweaks)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Copy link
Member

@picnixzpicnixz left a comment

Choose a reason for hiding this comment

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

Pro tips from someone who had lots of linter errors due to suggestions in the past: when submitting a suggestion, I usually Ctrl+A (or "Select all" on mobile) to check whether the text has trailing whitespaces or not. This helps reducing linter errors.

ncoghlan reacted with thumbs up emoji
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Copy link
Member

@zoobazooba left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@vstinnervstinner merged commit4a0d574 intopython:mainNov 5, 2024
36 checks passed
@vstinnervstinner deleted the reload_environ branchNovember 5, 2024 07:43
@vstinner
Copy link
MemberAuthor

Merged, thanks for reviews!

picnixz added a commit to picnixz/cpython that referenced this pull requestDec 8, 2024
Replace the os.environ.refresh() method with a newos.reload_environ() function.Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull requestJan 12, 2025
Replace the os.environ.refresh() method with a newos.reload_environ() function.Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ncoghlanncoghlanncoghlan approved these changes

@cmaloneycmaloneycmaloney approved these changes

@zoobazoobazooba approved these changes

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

@AA-TurnerAA-TurnerAA-Turner approved these changes

@picnixzpicnixzpicnixz approved these changes

+1 more reviewer

@rruuaanngrruuaanngrruuaanng left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

8 participants

@vstinner@cmaloney@ncoghlan@zooba@serhiy-storchaka@AA-Turner@picnixz@rruuaanng

[8]ページ先頭

©2009-2025 Movatter.jp