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
Gwenaël Samain
cython
Commits
69139ead
Commit
69139ead
authored
Jul 25, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapt some more syntax to Py2/Py3
parent
4487fad9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/Pipeline.py
Cython/Compiler/Pipeline.py
+3
-3
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+7
-7
Cython/Shadow.py
Cython/Shadow.py
+2
-2
No files found.
Cython/Compiler/Nodes.py
View file @
69139ead
...
@@ -167,7 +167,7 @@ class CheckAnalysers(type):
...
@@ -167,7 +167,7 @@ class CheckAnalysers(type):
def
call
(
*
args
,
**
kwargs
):
def
call
(
*
args
,
**
kwargs
):
retval
=
func
(
*
args
,
**
kwargs
)
retval
=
func
(
*
args
,
**
kwargs
)
if
retval
is
None
:
if
retval
is
None
:
print
name
,
args
,
kwargs
print
(
'%s %s %s'
%
(
name
,
args
,
kwargs
))
return
retval
return
retval
return
call
return
call
...
...
Cython/Compiler/Pipeline.py
View file @
69139ead
...
@@ -15,7 +15,7 @@ from . import Naming
...
@@ -15,7 +15,7 @@ from . import Naming
#
#
def
dumptree
(
t
):
def
dumptree
(
t
):
# For quick debugging in pipelines
# For quick debugging in pipelines
print
t
.
dump
(
)
print
(
t
.
dump
()
)
return
t
return
t
def
abort_on_errors
(
node
):
def
abort_on_errors
(
node
):
...
@@ -321,12 +321,12 @@ def run_pipeline(pipeline, source, printtree=True):
...
@@ -321,12 +321,12 @@ def run_pipeline(pipeline, source, printtree=True):
if
phase
is
not
None
:
if
phase
is
not
None
:
if
DebugFlags
.
debug_verbose_pipeline
:
if
DebugFlags
.
debug_verbose_pipeline
:
t
=
time
()
t
=
time
()
print
"Entering pipeline phase %r"
%
phase
print
(
"Entering pipeline phase %r"
%
phase
)
if
not
printtree
and
isinstance
(
phase
,
PrintTree
):
if
not
printtree
and
isinstance
(
phase
,
PrintTree
):
continue
continue
data
=
phase
(
data
)
data
=
phase
(
data
)
if
DebugFlags
.
debug_verbose_pipeline
:
if
DebugFlags
.
debug_verbose_pipeline
:
print
" %.3f seconds"
%
(
time
()
-
t
)
print
(
" %.3f seconds"
%
(
time
()
-
t
)
)
except
CompileError
as
err
:
except
CompileError
as
err
:
# err is set
# err is set
Errors
.
report_error
(
err
)
Errors
.
report_error
(
err
)
...
...
Cython/Compiler/Visitor.py
View file @
69139ead
...
@@ -22,7 +22,7 @@ import cython
...
@@ -22,7 +22,7 @@ import cython
cython
.
declare
(
_PRINTABLE
=
tuple
)
cython
.
declare
(
_PRINTABLE
=
tuple
)
if
sys
.
version_info
>=
3
:
if
sys
.
version_info
[
0
]
>=
3
:
_PRINTABLE
=
(
bytes
,
str
,
int
,
float
)
_PRINTABLE
=
(
bytes
,
str
,
int
,
float
)
else
:
else
:
_PRINTABLE
=
(
str
,
unicode
,
long
,
int
,
float
)
_PRINTABLE
=
(
str
,
unicode
,
long
,
int
,
float
)
...
@@ -57,9 +57,9 @@ class TreeVisitor(object):
...
@@ -57,9 +57,9 @@ class TreeVisitor(object):
>>> tree = SampleNode(0, SampleNode(1), [SampleNode(2), SampleNode(3)])
>>> tree = SampleNode(0, SampleNode(1), [SampleNode(2), SampleNode(3)])
>>> class MyVisitor(TreeVisitor):
>>> class MyVisitor(TreeVisitor):
... def visit_SampleNode(self, node):
... def visit_SampleNode(self, node):
... print
"in", node.value, self.access_path
... print
("in %s %s" % (node.value, self.access_path)
... self.visitchildren(node)
... self.visitchildren(node)
... print
"out", node.value
... print
("out %s" % node.value)
...
...
>>> MyVisitor().visit(tree)
>>> MyVisitor().visit(tree)
in 0 []
in 0 []
...
@@ -162,11 +162,11 @@ class TreeVisitor(object):
...
@@ -162,11 +162,11 @@ class TreeVisitor(object):
handler_method
=
getattr
(
self
,
pattern
%
mro_cls
.
__name__
,
None
)
handler_method
=
getattr
(
self
,
pattern
%
mro_cls
.
__name__
,
None
)
if
handler_method
is
not
None
:
if
handler_method
is
not
None
:
return
handler_method
return
handler_method
print
type
(
self
),
cls
print
(
'%s: %s'
%
(
type
(
self
),
cls
))
if
self
.
access_path
:
if
self
.
access_path
:
print
self
.
access_path
print
(
self
.
access_path
)
print
self
.
access_path
[
-
1
][
0
].
pos
print
(
self
.
access_path
[
-
1
][
0
].
pos
)
print
self
.
access_path
[
-
1
][
0
].
__dict__
print
(
self
.
access_path
[
-
1
][
0
].
__dict__
)
raise
RuntimeError
(
"Visitor %r does not accept object: %s"
%
(
self
,
obj
))
raise
RuntimeError
(
"Visitor %r does not accept object: %s"
%
(
self
,
obj
))
def
visit
(
self
,
obj
):
def
visit
(
self
,
obj
):
...
...
Cython/Shadow.py
View file @
69139ead
...
@@ -240,7 +240,7 @@ class StructType(CythonType):
...
@@ -240,7 +240,7 @@ class StructType(CythonType):
for
key
,
value
in
cast_from
.
__dict__
.
items
():
for
key
,
value
in
cast_from
.
__dict__
.
items
():
setattr
(
self
,
key
,
value
)
setattr
(
self
,
key
,
value
)
else
:
else
:
for
key
,
value
in
data
.
ite
rite
ms
():
for
key
,
value
in
data
.
items
():
setattr
(
self
,
key
,
value
)
setattr
(
self
,
key
,
value
)
def
__setattr__
(
self
,
key
,
value
):
def
__setattr__
(
self
,
key
,
value
):
...
@@ -267,7 +267,7 @@ class UnionType(CythonType):
...
@@ -267,7 +267,7 @@ class UnionType(CythonType):
datadict
=
data
datadict
=
data
if
len
(
datadict
)
>
1
:
if
len
(
datadict
)
>
1
:
raise
AttributeError
(
"Union can only store one field at a time."
)
raise
AttributeError
(
"Union can only store one field at a time."
)
for
key
,
value
in
datadict
.
ite
rite
ms
():
for
key
,
value
in
datadict
.
items
():
setattr
(
self
,
key
,
value
)
setattr
(
self
,
key
,
value
)
def
__setattr__
(
self
,
key
,
value
):
def
__setattr__
(
self
,
key
,
value
):
...
...
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