[Python-checkins] python/dist/src/Lib platform.py,1.9,1.10

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Thu Mar 25 11:55:45 EST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11409/Lib

Modified Files:
	platform.py 
Log Message:
Fixed a caching bug in platform.platform() where the argument of 'terse' was
not taken into consideration when caching value.


Index: platform.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** platform.py	6 Nov 2003 14:06:47 -0000	1.9
--- platform.py	25 Mar 2004 16:55:11 -0000	1.10
***************
*** 1136,1141 ****
  ### The Opus Magnum of platform strings :-)
  
! _platform_cache = None
! _platform_aliased_cache = None
  
  def platform(aliased=0, terse=0):
--- 1136,1141 ----
  ### The Opus Magnum of platform strings :-)
  
! _platform_cache = {True:None, False:None}
! _platform_aliased_cache = {True:None, False:None}
  
  def platform(aliased=0, terse=0):
***************
*** 1160,1167 ****
      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
  
      # Get uname information and then apply platform specific cosmetics
--- 1160,1167 ----
      global _platform_cache,_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
***************
*** 1220,1228 ****
  
      if aliased:
!         _platform_aliased_cache = platform
      elif terse:
          pass
      else:
!         _platform_cache = platform
      return platform
  
--- 1220,1228 ----
  
      if aliased:
!         _platform_aliased_cache[bool(terse)] = platform
      elif terse:
          pass
      else:
!         _platform_cache[bool(terse)] = platform
      return platform
  




More information about the Python-checkins mailing list