summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-15 23:50:04 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-15 23:50:04 (GMT)
commit66a9b72c38e62308c0bf380baa1fe6a803cca338 (patch)
tree052273b36fe5ab7e7d70c8d594ea58044669d26a
parentc769040100c3957446acea6efed5c9ad4a552cf2 (diff)
parente06224340d9abe2b450ea6784868068079335f66 (diff)
downloadcpython-66a9b72c38e62308c0bf380baa1fe6a803cca338.zip
cpython-66a9b72c38e62308c0bf380baa1fe6a803cca338.tar.gz
cpython-66a9b72c38e62308c0bf380baa1fe6a803cca338.tar.bz2
Merge heads
-rw-r--r--Lib/test/test_cgi.py4
-rw-r--r--Lib/test/test_sysconfig.py4
-rw-r--r--Tools/compiler/compile.py7
3 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
index 04a1e48..c9cf095 100644
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -194,9 +194,9 @@ class CgiTests(unittest.TestCase):
cgi.initlog("%s", "Testing initlog 1")
cgi.log("%s", "Testing log 2")
self.assertEqual(cgi.logfp.getvalue(), "Testing initlog 1\nTesting log 2\n")
- if os.path.exists(os.devnull):
+ if os.path.exists("/dev/null"):
cgi.logfp = None
- cgi.logfile = os.devnull
+ cgi.logfile = "/dev/null"
cgi.initlog("%s", "Testing log 3")
cgi.log("Testing log 4")
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
index 18a85fd..a0b65df 100644
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -294,7 +294,7 @@ class TestSysConfig(unittest.TestCase):
if 'MACOSX_DEPLOYMENT_TARGET' in env:
del env['MACOSX_DEPLOYMENT_TARGET']
- with open(os.devnull, 'w') as devnull_fp:
+ with open('/dev/null', 'w') as devnull_fp:
p = subprocess.Popen([
sys.executable, '-c',
'import sysconfig; print(sysconfig.get_platform())',
@@ -320,7 +320,7 @@ class TestSysConfig(unittest.TestCase):
'import sysconfig; print(sysconfig.get_platform())',
],
stdout=subprocess.PIPE,
- stderr=open(os.devnull),
+ stderr=open('/dev/null'),
env=env)
test_platform = p.communicate()[0].strip()
test_platform = test_platform.decode('utf-8')
diff --git a/Tools/compiler/compile.py b/Tools/compiler/compile.py
index 9e5c801..9d50425 100644
--- a/Tools/compiler/compile.py
+++ b/Tools/compiler/compile.py
@@ -1,4 +1,3 @@
-import os
import sys
import getopt
@@ -17,7 +16,11 @@ def main():
VERBOSE = 1
visitor.ASTVisitor.VERBOSE = visitor.ASTVisitor.VERBOSE + 1
if k == '-q':
- sys.stdout = open(os.devnull, 'wb')
+ if sys.platform[:3]=="win":
+ f = open('nul', 'wb') # /dev/null fails on Windows...
+ else:
+ f = open('/dev/null', 'wb')
+ sys.stdout = f
if k == '-d':
DISPLAY = 1
if k == '-c':