Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2caf8df commit 8373218Copy full SHA for 8373218
1 file changed
Lib/tempfile.py
@@ -89,23 +89,16 @@ def gettempdir():
89
else:
90
template = 'tmp' # XXX might choose a better one
91
92
-_pidcache = {}
93
def gettempprefix():
94
"""Function to calculate a prefix of the filename to use.
95
96
This incorporates the current process id on systems that support such a
97
notion, so that concurrent processes don't generate the same prefix.
98
"""
99
+ global template
100
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 '@' + `os.getpid()` + '.'
109
110
return template
111
0 commit comments