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
b97b545e
Commit
b97b545e
authored
9 years ago
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix calls for all cdef methods whose names coincide with optimized ones.
parent
f75cad42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+11
-1
tests/run/list_pop.pyx
tests/run/list_pop.pyx
+10
-0
No files found.
Cython/Compiler/Optimize.py
View file @
b97b545e
...
@@ -2596,11 +2596,21 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin,
...
@@ -2596,11 +2596,21 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin,
],
],
exception_value
=
"-1"
)
exception_value
=
"-1"
)
def
_dispatch_to_method_handler
(
self
,
attr_name
,
self_arg
,
is_unbound_method
,
type_name
,
node
,
function
,
arg_list
,
kwargs
):
if
hasattr
(
function
,
'type'
)
and
function
.
type
.
is_cfunction
:
# Don't "optimize" already bound C calls.
return
node
return
super
(
OptimizeBuiltinCalls
,
self
).
_dispatch_to_method_handler
(
attr_name
,
self_arg
,
is_unbound_method
,
type_name
,
node
,
function
,
arg_list
,
kwargs
)
def
_handle_simple_method_object_append
(
self
,
node
,
function
,
args
,
is_unbound_method
):
def
_handle_simple_method_object_append
(
self
,
node
,
function
,
args
,
is_unbound_method
):
"""Optimistic optimisation as X.append() is almost always
"""Optimistic optimisation as X.append() is almost always
referring to a list.
referring to a list.
"""
"""
if
function
.
type
.
is_cfunction
or
len
(
args
)
!=
2
or
node
.
result_is_used
:
if
len
(
args
)
!=
2
or
node
.
result_is_used
:
return
node
return
node
return
ExprNodes
.
PythonCapiCallNode
(
return
ExprNodes
.
PythonCapiCallNode
(
...
...
This diff is collapsed.
Click to expand it.
tests/run/list_pop.pyx
View file @
b97b545e
...
@@ -7,6 +7,16 @@ class A:
...
@@ -7,6 +7,16 @@ class A:
print
args
print
args
return
None
return
None
cdef
class
B
:
"""
>>> B().call_pop()
'B'
"""
cdef
pop
(
self
):
return
"B"
def
call_pop
(
self
):
return
self
.
pop
()
@
cython
.
test_assert_path_exists
(
'//PythonCapiCallNode'
)
@
cython
.
test_assert_path_exists
(
'//PythonCapiCallNode'
)
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode/AttributeNode'
)
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode/AttributeNode'
)
...
...
This diff is collapsed.
Click to expand it.
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