[Python-checkins] python/dist/src/Lib platform.py,1.5.8.1,1.5.8.2

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Thu Mar 25 11:56:16 EST 2004


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

Modified Files:
      Tag: release23-maint
	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.5.8.1
retrieving revision 1.5.8.2
diff -C2 -d -r1.5.8.1 -r1.5.8.2
*** platform.py	14 Oct 2003 22:32:34 -0000	1.5.8.1
--- platform.py	25 Mar 2004 16:56:14 -0000	1.5.8.2
***************
*** 1137,1142 ****
  ### The Opus Magnum of platform strings :-)
  
! _platform_cache = None
! _platform_aliased_cache = None
  
  def platform(aliased=0, terse=0):
--- 1137,1142 ----
  ### 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):
***************
*** 1161,1168 ****
      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
--- 1161,1168 ----
      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
***************
*** 1221,1229 ****
  
      if aliased:
!         _platform_aliased_cache = platform
      elif terse:
          pass
      else:
!         _platform_cache = platform
      return platform
  
--- 1221,1229 ----
  
      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