[Python-checkins] CVS: python/dist/src/Lib tempfile.py,1.25,1.26

Tim Peters python-dev@python.org
Sat, 13 Jan 2001 21:12:42 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13436

Modified Files:
	tempfile.py 
Log Message:
Reverting a dumb experimental version I checked in by mistake.


Index: tempfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/tempfile.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** tempfile.py	2001/01/14 05:05:51	1.25
--- tempfile.py	2001/01/14 05:12:40	1.26
***************
*** 90,94 ****
      template = 'tmp' # XXX might choose a better one
  
- _pidcache = {}
  def gettempprefix():
      """Function to calculate a prefix of the filename to use.
--- 90,93 ----
***************
*** 98,110 ****
      """
  
      if template is None:
!         p = os.getpid()
!         t = _pidcache.get(p, 0)
!         if t:
!             return t
!         if len(_pidcache) > 100:    # stop unbounded growth
!             _pidcache.clear()
!         t = _pidcache[p] = '@' + `p` + '.'
!         return t
      else:
          return template
--- 97,103 ----
      """
  
+     global template
      if template is None:
!         return '@' + `os.getpid()` + '.'
      else:
          return template