FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add os.reload_environ() function · Issue #120057 · python/cpython · GitHub

Repository navigation

Add os.reload_environ() function #120057

Closed
Closed

Activity

  1. added 2 commits that reference this issue on Jun 4, 2024
  2. eryksun commented on Jun 4, 2024

    Contributor

    Note that on Windows the C runtime's Unicode and multibyte environments -- _wenviron and _environ -- can get out of sync with the process environment -- GetEnvironmentStringsW() -- due to code that directly calls WinAPI SetEnvironmentVariableW(). It's possible to implement a function to fresh the C environment on Windows, which unsets the variables in _wenviron and sets the variables from GetEnvironmentStringsW(), but that's probably not something that the Python runtime needs to worry about.

  3. added a commit that references this issue on Jun 5, 2024
  4. vstinner commented on Jun 5, 2024

    MemberAuthor

    but that's probably not something that the Python runtime needs to worry about

    As soon as there are different "caches", it's hard to keep everything in sync and consistent :-(

  5. erlend-aasland commented on Jun 5, 2024

    Contributor

    I'm not sure if this is a good idea. I suspect it will be a hard feature to get right, and as noted in the forum discussion, most beginners will misunderstand the feature.

  6. vstinner commented on Jun 5, 2024

    MemberAuthor

    I suspect it will be a hard feature to get right

    Would you mind to elaborate?

  7. vstinner commented on Jun 5, 2024

    MemberAuthor

    and as noted in the forum discussion, most beginners will misunderstand the feature.

    I added "in the same process" to reduce misunderstanding.

  8. picnixz commented on Jun 5, 2024

    Member

    FYI, there was this issue: #119737 (so you may want to close it to avoid duplicates)

  9. vstinner commented on Jun 5, 2024

    MemberAuthor

    I closed issue #119737 as a duplicate of this issue.

  10. added a commit that references this issue on Jun 10, 2024
  11. vstinner commented on Jun 11, 2024

    MemberAuthor

    Implemented by the commit 7aff2de.

  12. WolfDWyc commented on Jun 11, 2024

    @vstinner

    As I noted in the discourse thread, and was mentioned in the comment on the PR, I still feel like this name will be confusing for new users, even with docs clarifying it. Can we maybe re-discuss this? Or at least choose another name?

    Should we continue here or in the discourse thread?

  13. 21 remaining items

  14. ncoghlan commented on Oct 31, 2024

    Contributor

    I think @zooba's point was that this function doesn't reload the system wide environment variable settings into the running application process, which os.reload_environment() could be taken to mean.

    That misreading doesn't seem particularly likely to me though, and the fact this operation reloads both os.environ and os.environb (not just os.environ) makes me wary of the shorter os.reload_environ() name (it feels misleading to me in the same way that the os.environ.refresh() spelling is misleading).

  15. zooba commented on Oct 31, 2024

    Member

    I can't reasonably see os.reload_environ() implying that os.environb wouldn't also be reloaded. Certainly not as much as I can see someone thinking that os.reload_environment() implies something other than "os.environ will be reloaded".

    Whereas os.environ.refresh() could quite reasonably be assumed to have no impact on os.environb. So I think that's another argument in favour of the module-level function.

    Perhaps os.reload_environs() feels more comfortable for covering both os.environ and os.environb? I don't have a strong preference about the s. My main concern is still the same as at the start - this function doesn't impact the (generic) environment of the process at all, it only affects what is contained in Python's cache of the environment, otherwise known as os.environ.

  16. added a commit that references this issue on Nov 1, 2024
  17. vstinner commented on Nov 1, 2024

    MemberAuthor

    I created PR gh-126268 to replace the os.environ.refresh() method with a new os.reload_environ() function.

    IMO reload_environ() is a good name since it reminds os.environ. I don't think that we should bother with the fact that os.environb is also reloaded to name the function. And reload_environment() is too long :-)

  18. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 1, 2024
  19. added a commit that references this issue on Nov 5, 2024
  20. changed the title [-]Add os.environ.refresh() method[/-] [+]Add os.reload_environ() function[/+] on Nov 5, 2024
  21. vstinner commented on Nov 5, 2024

    MemberAuthor

    I created PR #126268 to replace the os.environ.refresh() method with a new os.reload_environ() function.

    Done: I merged the PR. I close the issue.

  22. added a commit that references this issue on Dec 8, 2024
  23. added a commit that references this issue on Jan 12, 2025
  24. added a commit that references this issue on Oct 29, 2025
  25. added a commit that references this issue on Oct 29, 2025
  26. added a commit that references this issue on Oct 29, 2025
  27. added a commit that references this issue on Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL