8000 gh-122549: Allow to invalidate platform's cached results by picnixz · Pull Request #122547 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-122549: Allow to invalidate platform's cached results #122547

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 9 commits into from
Nov 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
allow to invalidate platform's information caches
  • Loading branch information
picnixz committed Aug 1, 2024
commit 85a5629954671c46cf25c63067f3a1b1f7d96ac3
15 changes: 14 additions & 1 deletion Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#
# <see CVS and SVN checkin messages for history>
#
# 1.0.9 - added cache_clear() function to invalidate cached values
# 1.0.8 - changed Windows support to read version from kernel32.dll
# 1.0.7 - added DEV_NULL
# 1.0.6 - added linux_distribution()
Expand Down Expand Up @@ -109,7 +110,7 @@

"""

__version__ = '1.0.8'
__version__ = '1.0.9'

import collections
import os
Expand Down Expand Up @@ -1441,6 +1442,18 @@ def freedesktop_os_release():
return _os_release_cache.copy()


def invalidate_caches():
"""Invalidate the cached results."""
global _uname_cache
_uname_cache = None

global _os_release_cache
_os_release_cache = None

_sys_version_cache.clear()
_platform_cache.clear()


### Command line interface

if __name__ == '__main__':
Expand Down
0