mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Fixed a caching bug in platform.platform() where the argument of 'terse' was
not taken into consideration when caching value.
This commit is contained in:
parent
504ca68e20
commit
21beb4c2ce
2 changed files with 12 additions and 9 deletions
|
|
@ -1135,8 +1135,8 @@ def python_compiler():
|
||||||
|
|
||||||
### The Opus Magnum of platform strings :-)
|
### The Opus Magnum of platform strings :-)
|
||||||
|
|
||||||
_platform_cache = None
|
_platform_cache = {True:None, False:None}
|
||||||
_platform_aliased_cache = None
|
_platform_aliased_cache = {True:None, False:None}
|
||||||
|
|
||||||
def platform(aliased=0, terse=0):
|
def platform(aliased=0, terse=0):
|
||||||
|
|
||||||
|
|
@ -1159,10 +1159,10 @@ def platform(aliased=0, terse=0):
|
||||||
"""
|
"""
|
||||||
global _platform_cache,_platform_aliased_cache
|
global _platform_cache,_platform_aliased_cache
|
||||||
|
|
||||||
if not aliased and (_platform_cache is not None):
|
if not aliased and (_platform_cache[bool(terse)] is not None):
|
||||||
return _platform_cache
|
return _platform_cache[bool(terse)]
|
||||||
elif _platform_aliased_cache is not None:
|
elif _platform_aliased_cache[bool(terse)] is not None:
|
||||||
return _platform_aliased_cache
|
return _platform_aliased_cache[bool(terse)]
|
||||||
|
|
||||||
# Get uname information and then apply platform specific cosmetics
|
# Get uname information and then apply platform specific cosmetics
|
||||||
# to it...
|
# to it...
|
||||||
|
|
@ -1219,11 +1219,11 @@ def platform(aliased=0, terse=0):
|
||||||
platform = _platform(system,release,machine,processor,bits,linkage)
|
platform = _platform(system,release,machine,processor,bits,linkage)
|
||||||
|
|
||||||
if aliased:
|
if aliased:
|
||||||
_platform_aliased_cache = platform
|
_platform_aliased_cache[bool(terse)] = platform
|
||||||
elif terse:
|
elif terse:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
_platform_cache = platform
|
_platform_cache[bool(terse)] = platform
|
||||||
return platform
|
return platform
|
||||||
|
|
||||||
### Command line interface
|
### Command line interface
|
||||||
|
|
|
||||||
|
|
@ -296,6 +296,9 @@ Extension modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Fixed a caching bug in platform.platform() where the argument of 'terse' was
|
||||||
|
not taken into consideration when caching value.
|
||||||
|
|
||||||
- Added two new command-line arguments for profile (output file and
|
- Added two new command-line arguments for profile (output file and
|
||||||
default sort).
|
default sort).
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue