mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
Reverting a dumb experimental version I checked in by mistake.
This commit is contained in:
parent
2caf8df868
commit
8373218e28
1 changed files with 2 additions and 9 deletions
|
@ -89,7 +89,6 @@ elif os.name == 'mac':
|
||||||
else:
|
else:
|
||||||
template = 'tmp' # XXX might choose a better one
|
template = 'tmp' # XXX might choose a better one
|
||||||
|
|
||||||
_pidcache = {}
|
|
||||||
def gettempprefix():
|
def gettempprefix():
|
||||||
"""Function to calculate a prefix of the filename to use.
|
"""Function to calculate a prefix of the filename to use.
|
||||||
|
|
||||||
|
@ -97,15 +96,9 @@ def gettempprefix():
|
||||||
notion, so that concurrent processes don't generate the same prefix.
|
notion, so that concurrent processes don't generate the same prefix.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
global template
|
||||||
if template is None:
|
if template is None:
|
||||||
p = os.getpid()
|
return '@' + `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:
|
else:
|
||||||
return template
|
return template
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue