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-120057: Add os.environ.refresh() method by vstinner · Pull Request #120059 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jun 4, 2024 •
edited by github-actions Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: Add os.reload_environ() function #120057

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

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 4, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jun 4, 2024
Add os.reload_environ() function #120057
Closed
eryksun
eryksun reviewed Jun 4, 2024
View reviewed changes
Comment thread Lib/os.py Resolved

Uh oh!

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

JelleZijlstra
JelleZijlstra reviewed Jun 5, 2024
View reviewed changes
Comment thread Doc/library/os.rst Resolved

Uh oh!

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

vstinner added 3 commits June 5, 2024 09:42
@vstinner
pythongh-120057: Add os.environ.refresh() method
fbfb02a
@vstinner
Fix os.environb
cdd9fec
@vstinner
Fix doc
1afb8e5
@vstinner
vstinner force-pushed the env_refresh branch from df97d03 to 1afb8e5 Compare June 5, 2024 07:42
@vstinner

vstinner commented Jun 5, 2024

Copy link
Copy Markdown
Member Author

I rebased the PR to fix a merge conflict.

I addressed @eryksun's and @JelleZijlstra's reviews: thanks!

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner added 2 commits June 5, 2024 10:16
@vstinner
Fix Windows
283bdb2
@vstinner
add "in the same process"
e6665b6
picnixz
picnixz reviewed Jun 5, 2024
View reviewed changes
Comment thread Doc/library/os.rst Resolved

Uh oh!

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

@vstinner
doc: Put 3.14 after 3.9
12b1a72
@vstinner

vstinner commented Jun 10, 2024

Copy link
Copy Markdown
Member Author

@serhiy-storchaka @erlend-aasland: Would you mind to review this change?

All reactions

Sorry, something went wrong.

Uh oh!

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

serhiy-storchaka
serhiy-storchaka reviewed Jun 10, 2024
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

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.

What about os.environb.refresh()? Does it exist? Does it work?

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Lib/os.py Resolved

Uh oh!

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

@vstinner
Address Serhiy's review
3fbb134
@vstinner

vstinner commented Jun 10, 2024

Copy link
Copy Markdown
Member Author

@serhiy-storchaka: I addressed your review. Would you mind to review my updated PR?

What about os.environb.refresh()? Does it exist? Does it work?

I added a test on os.environb.refresh(). Yes, it works as expected :-)

All reactions

Sorry, something went wrong.

Uh oh!

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

serhiy-storchaka
serhiy-storchaka reviewed Jun 10, 2024
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

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.

Should os.environb.refresh() be documented? We perhaps do not want to attract too much attention to it, as its effect is the same as of os.environ.refresh().

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
Tests: add has_environb
ea656f0
eryksun
eryksun reviewed Jun 10, 2024
View reviewed changes
Comment thread Doc/library/os.rst Resolved

Uh oh!

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

@vstinner
Doc: add "or by os.putenv()"
558617c
Test: use directly os.putenv().
@vstinner

vstinner commented Jun 10, 2024

Copy link
Copy Markdown
Member Author

Should os.environb.refresh() be documented? We perhaps do not want to attract too much attention to it, as its effect is the same as of os.environ.refresh().

Hum, I prefer to not document it at https://docs.python.org/dev/library/os.html#os.environb :-)

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner closed this Jun 10, 2024
@vstinner vstinner reopened this Jun 10, 2024
@vstinner

vstinner commented Jun 10, 2024

Copy link
Copy Markdown
Member Author

(Ooops, I closed on [Close] instead of [Comment], sorry.)

All reactions

Sorry, something went wrong.

Uh oh!

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

serhiy-storchaka
serhiy-storchaka reviewed Jun 10, 2024
View reviewed changes
Comment thread Doc/library/os.rst Resolved

Uh oh!

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

Comment thread Lib/test/test_os.py Resolved

Uh oh!

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

Comment thread Lib/os.py Resolved

Uh oh!

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

Comment thread Lib/test/test_os.py Resolved

Uh oh!

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

@vstinner
Address also Serhiy's review
c140148
* Test os.unsetenv()
* Document os.unsetenv()
* Minor refactoring
@vstinner

vstinner commented Jun 10, 2024

Copy link
Copy Markdown
Member Author

@serhiy-storchaka: PR updated for os.unsetenv().

Oh, I didn't know that Python has two functions (putenv, unsetenv) which modify directly the environment without updating os.environ.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
doc: add links to refresh method
64c415d
serhiy-storchaka
serhiy-storchaka approved these changes Jun 10, 2024
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

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.

LGTM.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Lib/test/test_os.py Resolved

Uh oh!

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

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Jun 10, 2024
@vstinner
Add test on os.environb.refresh() with unsetenv()
6aaadc3
serhiy-storchaka
serhiy-storchaka approved these changes Jun 10, 2024
View reviewed changes
@vstinner
Fix test_refresh()
ae1ab62
@vstinner
vstinner enabled auto-merge (squash) June 10, 2024 16:08
serhiy-storchaka
serhiy-storchaka approved these changes Jun 10, 2024
View reviewed changes
@vstinner
vstinner merged commit 7aff2de into python:main Jun 10, 2024
@vstinner
vstinner deleted the env_refresh branch June 10, 2024 16:34
@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 10, 2024
erlend-aasland
erlend-aasland reviewed Jun 11, 2024
View reviewed changes
Comment thread Doc/library/os.rst
to the environment made after this time are not reflected in :data:`os.environ`,
except for changes made by modifying :data:`os.environ` directly.

The :meth:`!os.environ.refresh()` method updates :data:`os.environ` with

@erlend-aasland erlend-aasland Jun 11, 2024

Copy link
Copy Markdown
Contributor

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.

FTR, the :meth: and :func: roles will implicitly add parentheses in the rendered output; you do not need to add them explicitly.

Sorry, something went wrong.

Uh oh!

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

vstinner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
vstinner added a commit to vstinner/cpython that referenced this pull request Jun 20, 2024
@vstinner
Revert "pythongh-120057: Add os.environ.refresh() method (python#120059…
d3da724
…)"

This reverts commit 7aff2de.

The function is controversial and it was decided to remove it.
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
@vstinner @mrahtz
pythongh-120057: Add os.environ.refresh() method (python#120059)
82931eb
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
@vstinner @estyxx
pythongh-120057: Add os.environ.refresh() method (python#120059)
01f09f4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra left review comments
@eryksun eryksun eryksun left review comments
@picnixz picnixz picnixz left review comments
@erlend-aasland erlend-aasland erlend-aasland left review comments
@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

6 participants

@vstinner @JelleZijlstra @eryksun @serhiy-storchaka @picnixz @erlend-aasland
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.