Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(77392)

Unified Diff: Lib/test/test_cmd_line.py

Issue 18756: os.urandom() fails under high load
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Include/pythonrun.h ('k') | Lib/test/test_os.py » ('j') | Python/random.c » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -361,9 +361,14 @@ class CmdLineTest(unittest.TestCase):
code = """if 1:
import os, sys
for i, s in enumerate({streams}):
+ print(i, s)
Benjamin Peterson 2013/08/24 21:54:05 *cough*
if getattr(sys, s) is not None:
- os._exit(i + 1)
- os._exit(42)""".format(streams=streams)
+ sys.exit(i + 1)
+ if os.name == 'posix':
+ # urandom() uses an early-allocated fd on POSIX, check
+ # that the fd wasn't butchered.
+ os.urandom(1)
+ sys.exit(42)""".format(streams=streams)
def preexec():
if 'stdin' in streams:
os.close(0)
@@ -379,7 +384,7 @@ class CmdLineTest(unittest.TestCase):
preexec_fn=preexec)
out, err = p.communicate()
self.assertEqual(test.support.strip_python_stderr(err), b'')
- self.assertEqual(p.returncode, 42)
+ self.assertEqual(p.returncode, 42, out)
def test_no_stdin(self):
self._test_no_stdio(['stdin'])
« no previous file with comments | « Include/pythonrun.h ('k') | Lib/test/test_os.py » ('j') | Python/random.c » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+