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
9e1f938e
Commit
9e1f938e
authored
May 24, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cygdb and its tests when run in Py3
parent
0241a594
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
29 deletions
+20
-29
Cython/Debugger/Cygdb.py
Cython/Debugger/Cygdb.py
+4
-3
Cython/Debugger/Tests/TestLibCython.py
Cython/Debugger/Tests/TestLibCython.py
+13
-13
Cython/Debugger/libcython.py
Cython/Debugger/libcython.py
+3
-2
runtests.py
runtests.py
+0
-11
No files found.
Cython/Debugger/Cygdb.py
View file @
9e1f938e
...
...
@@ -50,9 +50,10 @@ def make_command_file(path_to_debug_info, prefix_code='', no_import=False):
virtualenv = os.getenv('VIRTUAL_ENV')
if virtualenv:
path_to_activate_this_py = os.path.join(virtualenv, 'bin', 'activate_this.py')
print("gdb command file: Activating virtualenv: %s; path_to_activate_this_py: %s"
% (virtualenv, path_to_activate_this_py,))
execfile(path_to_activate_this_py, dict(__file__=path_to_activate_this_py))
print("gdb command file: Activating virtualenv: %s; path_to_activate_this_py: %s" % (
virtualenv, path_to_activate_this_py))
with open(path_to_activate_this_py) as f:
exec(f.read(), dict(__file__=path_to_activate_this_py))
from Cython.Debugger import libcython, libpython
end
...
...
Cython/Debugger/Tests/TestLibCython.py
View file @
9e1f938e
...
...
@@ -21,11 +21,8 @@ root = os.path.dirname(os.path.abspath(__file__))
codefile
=
os
.
path
.
join
(
root
,
'codefile'
)
cfuncs_file
=
os
.
path
.
join
(
root
,
'cfuncs.c'
)
f
=
open
(
codefile
)
try
:
source_to_lineno
=
dict
([
(
line
.
strip
(),
i
+
1
)
for
i
,
line
in
enumerate
(
f
)
])
finally
:
f
.
close
()
with
open
(
codefile
)
as
f
:
source_to_lineno
=
dict
((
line
.
strip
(),
i
+
1
)
for
i
,
line
in
enumerate
(
f
))
# Cython.Distutils.__init__ imports build_ext from build_ext which means we
# can't access the module anymore. Get it from sys.modules instead.
...
...
@@ -76,8 +73,8 @@ def test_gdb():
# Be Python 3 compatible
if
(
not
have_gdb
or
gdb_version_number
<
[
7
,
2
]
or
python_version_number
<
[
2
,
6
]):
or
gdb_version_number
<
[
7
,
2
]
or
python_version_number
<
[
2
,
6
]):
warnings
.
warn
(
'Skipping gdb tests, need gdb >= 7.2 with Python >= 2.6'
)
have_gdb
=
False
...
...
@@ -197,6 +194,8 @@ class GdbDebuggerTestCase(DebuggerTestCase):
def excepthook(type, value, tb):
traceback.print_exception(type, value, tb)
sys.stderr.flush()
sys.stdout.flush()
os._exit(1)
sys.excepthook = excepthook
...
...
@@ -220,11 +219,8 @@ class GdbDebuggerTestCase(DebuggerTestCase):
self
.
gdb_command_file
=
cygdb
.
make_command_file
(
self
.
tempdir
,
prefix_code
)
f
=
open
(
self
.
gdb_command_file
,
'a'
)
try
:
with
open
(
self
.
gdb_command_file
,
'a'
)
as
f
:
f
.
write
(
code
)
finally
:
f
.
close
()
args
=
[
'gdb'
,
'-batch'
,
'-x'
,
self
.
gdb_command_file
,
'-n'
,
'--args'
,
sys
.
executable
,
'-c'
,
'import codefile'
]
...
...
@@ -239,7 +235,7 @@ class GdbDebuggerTestCase(DebuggerTestCase):
self
.
p
=
subprocess
.
Popen
(
args
,
stdout
=
open
(
os
.
devnull
,
'w'
)
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
env
=
env
)
...
...
@@ -266,19 +262,23 @@ class TestAll(GdbDebuggerTestCase):
return
out
,
err
=
self
.
p
.
communicate
()
out
=
out
.
decode
(
'UTF-8'
)
err
=
err
.
decode
(
'UTF-8'
)
exit_status
=
self
.
p
.
returncode
if
exit_status
==
1
:
sys
.
stderr
.
write
(
out
)
sys
.
stderr
.
write
(
err
)
elif
exit_status
>=
2
:
border
=
u'*'
*
30
start
=
u'%s v INSIDE GDB v %s'
%
(
border
,
border
)
stderr
=
u'%s v STDERR v %s'
%
(
border
,
border
)
end
=
u'%s ^ INSIDE GDB ^ %s'
%
(
border
,
border
)
errmsg
=
u'
\
n
%s
\
n
%s%s'
%
(
start
,
err
,
end
)
errmsg
=
u'
\
n
%s
\
n
%s%s'
%
(
start
,
out
,
stderr
,
err
,
end
)
sys
.
stderr
.
write
(
errmsg
)
self
.
assertEqual
(
exit_status
,
0
)
if
__name__
==
'__main__'
:
...
...
Cython/Debugger/libcython.py
View file @
9e1f938e
...
...
@@ -503,10 +503,11 @@ class CythonParameter(gdb.Parameter):
if
default
is
not
None
:
self
.
value
=
default
def
__
nonzero
__
(
self
):
def
__
bool
__
(
self
):
return
bool
(
self
.
value
)
__bool__
=
__nonzero__
# python 3
__nonzero__
=
__bool__
# Python 2
class
CompleteUnqualifiedFunctionNames
(
CythonParameter
):
"""
...
...
runtests.py
View file @
9e1f938e
...
...
@@ -284,14 +284,6 @@ VER_DEP_MODULES = {
]),
}
# files that should not be converted to Python 3 code with 2to3
KEEP_2X_FILES = [
os.path.join('Cython', 'Debugger', 'Tests', 'test_libcython_in_gdb.py'),
os.path.join('Cython', 'Debugger', 'Tests', 'test_libpython_in_gdb.py'),
os.path.join('Cython', 'Debugger', 'libcython.py'),
os.path.join('Cython', 'Debugger', 'libpython.py'),
]
COMPILER = None
INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ]
CFLAGS = os.getenv('CFLAGS', '').split()
...
...
@@ -1509,9 +1501,6 @@ def refactor_for_py3(distdir, cy3_dir):
''')
sys.path.insert(0, cy3_dir)
for keep_2x_file in KEEP_2X_FILES:
destfile = os.path.join(cy3_dir, keep_2x_file)
shutil.copy(keep_2x_file, destfile)
class PendingThreadsError(RuntimeError):
pass
...
...
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