Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8a1724bf
Commit
8a1724bf
authored
Feb 15, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use os.devnull instead of hardcoded '/dev/null'.
parent
a53bee51
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
9 deletions
+6
-9
Lib/test/test_cgi.py
Lib/test/test_cgi.py
+2
-2
Lib/test/test_sysconfig.py
Lib/test/test_sysconfig.py
+2
-2
Tools/compiler/compile.py
Tools/compiler/compile.py
+2
-5
No files found.
Lib/test/test_cgi.py
View file @
8a1724bf
...
...
@@ -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
\
n
Testing log 2
\
n
"
)
if
os
.
path
.
exists
(
"/dev/null"
):
if
os
.
path
.
exists
(
os
.
devnull
):
cgi
.
logfp
=
None
cgi
.
logfile
=
"/dev/null"
cgi
.
logfile
=
os
.
devnull
cgi
.
initlog
(
"%s"
,
"Testing log 3"
)
cgi
.
log
(
"Testing log 4"
)
...
...
Lib/test/test_sysconfig.py
View file @
8a1724bf
...
...
@@ -294,7 +294,7 @@ class TestSysConfig(unittest.TestCase):
if
'MACOSX_DEPLOYMENT_TARGET'
in
env
:
del
env
[
'MACOSX_DEPLOYMENT_TARGET'
]
with
open
(
'/dev/null'
,
'w'
)
as
devnull_fp
:
with
open
(
os
.
devnull
,
'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
(
'/dev/null'
),
stderr
=
open
(
os
.
devnull
),
env
=
env
)
test_platform
=
p
.
communicate
()[
0
].
strip
()
test_platform
=
test_platform
.
decode
(
'utf-8'
)
...
...
Tools/compiler/compile.py
View file @
8a1724bf
import
os
import
sys
import
getopt
...
...
@@ -16,11 +17,7 @@ def main():
VERBOSE
=
1
visitor
.
ASTVisitor
.
VERBOSE
=
visitor
.
ASTVisitor
.
VERBOSE
+
1
if
k
==
'-q'
:
if
sys
.
platform
[:
3
]
==
"win"
:
f
=
open
(
'nul'
,
'wb'
)
# /dev/null fails on Windows...
else
:
f
=
open
(
'/dev/null'
,
'wb'
)
sys
.
stdout
=
f
sys
.
stdout
=
open
(
os
.
devnull
,
'wb'
)
if
k
==
'-d'
:
DISPLAY
=
1
if
k
==
'-c'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment