summaryrefslogtreecommitdiff
path: root/Lib/tempfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r--Lib/tempfile.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index e3afa3b0ac..39ebf5a943 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -108,8 +108,13 @@ class _RandomNameSequence:
characters = "abcdefghijklmnopqrstuvwxyz0123456789_"
- def __init__(self):
- self.rng = _Random()
+ @property
+ def rng(self):
+ cur_pid = _os.getpid()
+ if cur_pid != getattr(self, '_rng_pid', None):
+ self._rng = _Random()
+ self._rng_pid = cur_pid
+ return self._rng
def __iter__(self):
return self