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
7a3407c5
Commit
7a3407c5
authored
Aug 12, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include bound methods in method call optimisation
parent
e38a2cdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+10
-1
No files found.
Cython/Compiler/Optimize.py
View file @
7a3407c5
...
...
@@ -3765,7 +3765,16 @@ class FinalOptimizePhase(Visitor.CythonTransform, Visitor.NodeRefCleanupMixin):
node
.
args
[
1
]
=
ExprNodes
.
CastNode
(
node
.
args
[
1
],
PyTypeObjectPtr
)
elif
node
.
function
.
type
.
is_pyobject
and
node
.
function
.
type
is
not
Builtin
.
type_type
:
# we could do it for all calls, but attributes are most likely to result in a method call
if
node
.
function
.
is_attribute
:
function
=
node
.
function
likely_method
=
function
.
is_attribute
if
not
likely_method
and
function
.
is_name
and
function
.
cf_state
:
# not an attribute itself, but might have been assigned from one (e.g. bound method)
for
assignment
in
function
.
cf_state
:
value
=
assignment
.
rhs
if
value
.
is_attribute
and
value
.
obj
.
type
.
is_pyobject
and
value
.
obj
.
type
is
not
Builtin
.
type_type
:
likely_method
=
True
break
if
likely_method
:
if
isinstance
(
node
.
arg_tuple
,
ExprNodes
.
TupleNode
)
and
not
(
node
.
arg_tuple
.
mult_factor
or
(
node
.
arg_tuple
.
is_literal
and
node
.
arg_tuple
.
args
)):
node
=
self
.
replace
(
node
,
ExprNodes
.
PyMethodCallNode
.
from_node
(
...
...
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