diff options
author | Brett Cannon <bcannon@gmail.com> | 2004-03-25 16:55:12 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2004-03-25 16:55:12 (GMT) |
commit | 21beb4c2ceb5238a6a3ab83156db55f678ed01ec (patch) | |
tree | 018389e4b2746dc30feb70291606d3a805e09330 /Lib | |
parent | 504ca68e20e01a42d89431a4562b3a72c9d62961 (diff) | |
download | cpython-21beb4c2ceb5238a6a3ab83156db55f678ed01ec.zip cpython-21beb4c2ceb5238a6a3ab83156db55f678ed01ec.tar.gz cpython-21beb4c2ceb5238a6a3ab83156db55f678ed01ec.tar.bz2 |
Fixed a caching bug in platform.platform() where the argument of 'terse' was
not taken into consideration when caching value.
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/platform.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/platform.py b/Lib/platform.py index 389e50c..7015044 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1135,8 +1135,8 @@ def python_compiler(): ### The Opus Magnum of platform strings :-) -_platform_cache = None -_platform_aliased_cache = None +_platform_cache = {True:None, False:None} +_platform_aliased_cache = {True:None, False:None} def platform(aliased=0, terse=0): @@ -1159,10 +1159,10 @@ def platform(aliased=0, terse=0): """ global _platform_cache,_platform_aliased_cache - if not aliased and (_platform_cache is not None): - return _platform_cache - elif _platform_aliased_cache is not None: - return _platform_aliased_cache + if not aliased and (_platform_cache[bool(terse)] is not None): + return _platform_cache[bool(terse)] + elif _platform_aliased_cache[bool(terse)] is not None: + return _platform_aliased_cache[bool(terse)] # Get uname information and then apply platform specific cosmetics # to it... @@ -1219,11 +1219,11 @@ def platform(aliased=0, terse=0): platform = _platform(system,release,machine,processor,bits,linkage) if aliased: - _platform_aliased_cache = platform + _platform_aliased_cache[bool(terse)] = platform elif terse: pass else: - _platform_cache = platform + _platform_cache[bool(terse)] = platform return platform ### Command line interface |