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
0f339147
Commit
0f339147
authored
Sep 15, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.23.x'
parents
a3522a8a
2c9d175b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
6 deletions
+34
-6
CHANGES.rst
CHANGES.rst
+2
-0
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+4
-0
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+28
-6
No files found.
CHANGES.rst
View file @
0f339147
...
...
@@ -51,6 +51,8 @@ Other changes
Bugs fixed
----------
* Invalid C code for some builtin methods. This fixes ticket 856 again.
* Incorrect C code in helper functions for PyLong conversion and string
decoding. This fixes ticket 863, ticket 864 and ticket 865.
Original patch by Nikolaus Rath.
...
...
Cython/Compiler/Optimize.py
View file @
0f339147
...
...
@@ -4212,6 +4212,10 @@ class FinalOptimizePhase(Visitor.CythonTransform, Visitor.NodeRefCleanupMixin):
assignment
.
rhs
and
not
isinstance
(
assignment
.
rhs
,
non_method_nodes
)
for
assignment
in
entry
.
cf_assignments
)
if
may_be_a_method
:
if
(
node
.
self
and
function
.
is_attribute
and
isinstance
(
function
.
obj
,
ExprNodes
.
CloneNode
)
and
function
.
obj
.
arg
is
node
.
self
):
# function self object was moved into a CloneNode => undo
function
.
obj
=
function
.
obj
.
arg
node
=
self
.
replace
(
node
,
ExprNodes
.
PyMethodCallNode
.
from_node
(
node
,
function
=
function
,
arg_tuple
=
node
.
arg_tuple
,
type
=
node
.
type
))
return
node
...
...
Cython/Compiler/Visitor.py
View file @
0f339147
...
...
@@ -416,8 +416,7 @@ class NodeRefCleanupMixin(object):
def
visit_CloneNode
(
self
,
node
):
arg
=
node
.
arg
if
arg
not
in
self
.
_replacements
:
self
.
visitchildren
(
node
)
arg
=
node
.
arg
self
.
visitchildren
(
arg
)
node
.
arg
=
self
.
_replacements
.
get
(
arg
,
arg
)
return
node
...
...
@@ -679,6 +678,13 @@ class RecursiveNodeReplacer(VisitorTransform):
super
(
RecursiveNodeReplacer
,
self
).
__init__
()
self
.
orig_node
,
self
.
new_node
=
orig_node
,
new_node
def
visit_CloneNode
(
self
,
node
):
if
node
is
self
.
orig_node
:
return
self
.
new_node
if
node
.
arg
is
self
.
orig_node
:
node
.
arg
=
self
.
new_node
return
node
def
visit_Node
(
self
,
node
):
self
.
visitchildren
(
node
)
if
node
is
self
.
orig_node
:
...
...
@@ -725,6 +731,7 @@ def replace_node(ptr, value):
else
:
getattr
(
parent
,
attrname
)[
listidx
]
=
value
class
PrintTree
(
TreeVisitor
):
"""Prints a representation of the tree to standard output.
Subclass and override repr_of to provide more information
...
...
@@ -753,6 +760,25 @@ class PrintTree(TreeVisitor):
# under the parent-node, not displaying the list itself in
# the hierarchy.
def
visit_Node
(
self
,
node
):
self
.
_print_node
(
node
)
self
.
indent
()
self
.
visitchildren
(
node
)
self
.
unindent
()
return
node
def
visit_CloneNode
(
self
,
node
):
self
.
_print_node
(
node
)
self
.
indent
()
line
=
node
.
pos
[
1
]
if
self
.
_line_range
is
None
or
self
.
_line_range
[
0
]
<=
line
<=
self
.
_line_range
[
1
]:
print
(
"%s- %s: %s"
%
(
self
.
_indent
,
'arg'
,
self
.
repr_of
(
node
.
arg
)))
self
.
indent
()
self
.
visitchildren
(
node
.
arg
)
self
.
unindent
()
self
.
unindent
()
return
node
def
_print_node
(
self
,
node
):
line
=
node
.
pos
[
1
]
if
self
.
_line_range
is
None
or
self
.
_line_range
[
0
]
<=
line
<=
self
.
_line_range
[
1
]:
if
len
(
self
.
access_path
)
==
0
:
...
...
@@ -764,10 +790,6 @@ class PrintTree(TreeVisitor):
else
:
name
=
attr
print
(
"%s- %s: %s"
%
(
self
.
_indent
,
name
,
self
.
repr_of
(
node
)))
self
.
indent
()
self
.
visitchildren
(
node
)
self
.
unindent
()
return
node
def
repr_of
(
self
,
node
):
if
node
is
None
:
...
...
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