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
Kirill Smelkov
cython
Commits
dfcaadb7
Commit
dfcaadb7
authored
Jan 18, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply some safety fixes in test code
parent
d3e6486c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
Cython/Debugger/Tests/TestLibCython.py
Cython/Debugger/Tests/TestLibCython.py
+23
-13
No files found.
Cython/Debugger/Tests/TestLibCython.py
View file @
dfcaadb7
...
@@ -43,7 +43,7 @@ def test_gdb():
...
@@ -43,7 +43,7 @@ def test_gdb():
# gdb was not installed
# gdb was not installed
have_gdb
=
False
have_gdb
=
False
else
:
else
:
gdb_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
gdb_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
,
'ignore'
)
p
.
wait
()
p
.
wait
()
p
.
stdout
.
close
()
p
.
stdout
.
close
()
...
@@ -54,17 +54,23 @@ def test_gdb():
...
@@ -54,17 +54,23 @@ def test_gdb():
if
gdb_version_number
>=
[
7
,
2
]:
if
gdb_version_number
>=
[
7
,
2
]:
python_version_script
=
tempfile
.
NamedTemporaryFile
(
mode
=
'w+'
)
python_version_script
=
tempfile
.
NamedTemporaryFile
(
mode
=
'w+'
)
python_version_script
.
write
(
'python import sys; print("%s %s" % sys.version_info[:2])'
)
python_version_script
.
flush
()
p
=
subprocess
.
Popen
([
'gdb'
,
'-batch'
,
'-x'
,
python_version_script
.
name
],
stdout
=
subprocess
.
PIPE
)
python_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
try
:
try
:
python_version_number
=
list
(
map
(
int
,
python_version
.
split
()))
python_version_script
.
write
(
except
ValueError
:
'python import sys; print("%s %s" % sys.version_info[:2])'
)
have_gdb
=
False
python_version_script
.
flush
()
p
=
subprocess
.
Popen
([
'gdb'
,
'-batch'
,
'-x'
,
python_version_script
.
name
],
stdout
=
subprocess
.
PIPE
)
try
:
python_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
finally
:
p
.
stdout
.
close
()
try
:
python_version_number
=
list
(
map
(
int
,
python_version
.
split
()))
except
ValueError
:
have_gdb
=
False
finally
:
python_version_script
.
close
()
# Be Python 3 compatible
# Be Python 3 compatible
if
(
not
have_gdb
if
(
not
have_gdb
...
@@ -146,6 +152,7 @@ class DebuggerTestCase(unittest.TestCase):
...
@@ -146,6 +152,7 @@ class DebuggerTestCase(unittest.TestCase):
finally
:
finally
:
optimization_disabler
.
restore_state
()
optimization_disabler
.
restore_state
()
sys
.
stderr
=
stderr
sys
.
stderr
=
stderr
new_stderr
.
close
()
# ext = Cython.Distutils.extension.Extension(
# ext = Cython.Distutils.extension.Extension(
# 'codefile',
# 'codefile',
...
@@ -250,8 +257,11 @@ class GdbDebuggerTestCase(DebuggerTestCase):
...
@@ -250,8 +257,11 @@ class GdbDebuggerTestCase(DebuggerTestCase):
python_version_script
.
flush
()
python_version_script
.
flush
()
p
=
subprocess
.
Popen
([
'gdb'
,
'-batch'
,
'-x'
,
python_version_script
.
name
],
p
=
subprocess
.
Popen
([
'gdb'
,
'-batch'
,
'-x'
,
python_version_script
.
name
],
stdout
=
subprocess
.
PIPE
)
stdout
=
subprocess
.
PIPE
)
python_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
try
:
p
.
wait
()
python_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
finally
:
p
.
stdout
.
close
()
try
:
try
:
python_version_number
=
list
(
map
(
int
,
python_version
.
split
()))
python_version_number
=
list
(
map
(
int
,
python_version
.
split
()))
except
ValueError
:
except
ValueError
:
...
...
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