Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8373218

Browse files
committed
Reverting a dumb experimental version I checked in by mistake.
1 parent 2caf8df commit 8373218

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

Lib/tempfile.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,16 @@ def gettempdir():
8989
else:
9090
template = 'tmp' # XXX might choose a better one
9191

92-
_pidcache = {}
9392
def gettempprefix():
9493
"""Function to calculate a prefix of the filename to use.
9594
9695
This incorporates the current process id on systems that support such a
9796
notion, so that concurrent processes don't generate the same prefix.
9897
"""
9998

99+
global template
100100
if template is None:
101-
p = os.getpid()
102-
t = _pidcache.get(p, 0)
103-
if t:
104-
return t
105-
if len(_pidcache) > 100: # stop unbounded growth
106-
_pidcache.clear()
107-
t = _pidcache[p] = '@' + `p` + '.'
108-
return t
101+
return '@' + `os.getpid()` + '.'
109102
else:
110103
return template
111104

0 commit comments

Comments
 (0)