Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
3343a2e5
Commit
3343a2e5
authored
May 02, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add helper for passing collected bytes output through to sys.stdout
parent
f54826aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
Cython/Utils.py
Cython/Utils.py
+9
-0
runtests.py
runtests.py
+3
-8
No files found.
Cython/Utils.py
View file @
3343a2e5
...
@@ -386,3 +386,12 @@ def captured_fd(stream=2, encoding=None):
...
@@ -386,3 +386,12 @@ def captured_fd(stream=2, encoding=None):
t
.
join
()
t
.
join
()
finally
:
finally
:
os
.
close
(
orig_stream
)
os
.
close
(
orig_stream
)
def
print_bytes
(
s
,
stream
=
sys
.
stdout
):
stream
.
flush
()
try
:
out
=
stream
.
buffer
# Py3
except
AttributeError
:
out
=
stream
# Py2
out
.
write
(
s
)
runtests.py
View file @
3343a2e5
...
@@ -867,7 +867,7 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -867,7 +867,7 @@ class CythonCompileTestCase(unittest.TestCase):
so_path = None
so_path = None
if not self.cython_only:
if not self.cython_only:
from Cython.Utils import captured_fd
from Cython.Utils import captured_fd
, print_bytes
get_stderr = None
get_stderr = None
try:
try:
with captured_fd(2) as get_stderr:
with captured_fd(2) as get_stderr:
...
@@ -878,15 +878,10 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -878,15 +878,10 @@ class CythonCompileTestCase(unittest.TestCase):
else:
else:
raise
raise
else:
else:
c_compiler_stderr = get_stderr()
c_compiler_stderr = get_stderr()
.strip()
if c_compiler_stderr:
if c_compiler_stderr:
print("
\
n
===
C
/
C
++
compiler
error
output
:
===
")
print("
\
n
===
C
/
C
++
compiler
error
output
:
===
")
sys.stdout.flush()
print_bytes(c_compiler_stderr)
try:
out = sys.stdout.buffer # Py3
except AttributeError:
out = sys.stdout # Py2
out.write(c_compiler_stderr)
if expected_errors == '_FAIL_C_COMPILE':
if expected_errors == '_FAIL_C_COMPILE':
# must raise this outside the try block
# must raise this outside the try block
raise RuntimeError('should have failed C compile')
raise RuntimeError('should have failed C compile')
...
...
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