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 d3a6a14 commit b0e5718Copy full SHA for b0e5718
1 file changed
Lib/tempfile.py
@@ -60,11 +60,17 @@ def gettempdir():
60
61
# Function to calculate a prefix of the filename to use
62
63
+_pid = None
64
+
65
def gettempprefix():
- global template
- if template == None:
66
+ global template, _pid
67
+ if os.name == 'posix' and _pid and _pid != os.getpid():
68
+ # Our pid changed; we must have forked -- zap the template
69
+ template = None
70
+ if template is None:
71
if os.name == 'posix':
- template = '@' + `os.getpid()` + '.'
72
+ _pid = os.getpid()
73
+ template = '@' + `_pid` + '.'
74
elif os.name == 'nt':
75
template = '~' + `os.getpid()` + '-'
76
elif os.name == 'mac':
0 commit comments