Revision 035b33e2
b/lib/utils/wrapper.py | ||
---|---|---|
1 | 1 |
# |
2 | 2 |
# |
3 | 3 |
|
4 |
# Copyright (C) 2006, 2007, 2010, 2011 Google Inc. |
|
4 |
# Copyright (C) 2006, 2007, 2010, 2011, 2012 Google Inc.
|
|
5 | 5 |
# |
6 | 6 |
# This program is free software; you can redistribute it and/or modify |
7 | 7 |
# it under the terms of the GNU General Public License as published by |
... | ... | |
22 | 22 |
|
23 | 23 |
""" |
24 | 24 |
|
25 |
import sys |
|
25 | 26 |
import time |
26 | 27 |
import socket |
27 | 28 |
import errno |
... | ... | |
182 | 183 |
|
183 | 184 |
""" |
184 | 185 |
# pylint: disable=W0212 |
186 |
if ((sys.hexversion >= 0x020703F0 and sys.hexversion < 0x03000000) or |
|
187 |
sys.hexversion >=0x030203F0): |
|
188 |
# Python 2.7 automatically resets the RNG on pid changes (i.e. forking) |
|
189 |
return |
|
190 |
|
|
185 | 191 |
try: |
186 | 192 |
lock = tempfile._once_lock |
187 | 193 |
lock.acquire() |
b/test/tempfile_fork_unittest.py | ||
---|---|---|
1 | 1 |
#!/usr/bin/python |
2 | 2 |
# |
3 | 3 |
|
4 |
# Copyright (C) 2010 Google Inc. |
|
4 |
# Copyright (C) 2010, 2012 Google Inc.
|
|
5 | 5 |
# |
6 | 6 |
# This program is free software; you can redistribute it and/or modify |
7 | 7 |
# it under the terms of the GNU General Public License as published by |
... | ... | |
47 | 47 |
shutil.rmtree(self.tmpdir) |
48 | 48 |
|
49 | 49 |
def testNoReset(self): |
50 |
if ((sys.hexversion >= 0x020703F0 and sys.hexversion < 0x03000000) or |
|
51 |
sys.hexversion >=0x030203F0): |
|
52 |
# We can't test the no_reset case on Python 2.7+ |
|
53 |
return |
|
54 |
# evil Debian sid... |
|
55 |
if (hasattr(tempfile._RandomNameSequence, "rng") and |
|
56 |
type(tempfile._RandomNameSequence.rng) == property): |
|
57 |
return |
|
50 | 58 |
self._Test(False) |
51 | 59 |
|
52 | 60 |
def testReset(self): |
Also available in: Unified diff