8000 gh-103977: compile re expressions in platform.py only if required by eendebakpt · Pull Request #103981 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-103977: compile re expressions in platform.py only if required #103981

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 30, 2023
Prev Previous commit
Next Next commit
revert _os_release_cache
  • Loading branch information
eendebakpt committed Apr 28, 2023
commit 4061a6b32407c9bea44acbe445eec448e35f6592
7 changes: 3 additions & 4 deletions Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,9 @@ def platform(aliased=False, terse=False):
### freedesktop.org os-release standard
# https://www.freedesktop.org/software/systemd/man/os-release.html

# /etc takes precedence over /usr/lib
_os_release_candidates = ("/etc/os-release", "/usr/lib/os-release")
_os_release_cache = None

def _parse_os_release(lines):
# These fields are mandatory fields with well-known defaults
Expand Down Expand Up @@ -1325,10 +1328,6 @@ def freedesktop_os_release():
"""
global _os_release_cache

# /etc takes precedence over /usr/lib
_os_release_candidates = ("/etc/os-release", "/usr/lib/os-release")
_os_release_cache = None

if _os_release_cache is None:
errno = None
for candidate in _os_release_candidates:
Expand Down
0