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
8f1599cd
Commit
8f1599cd
authored
Jul 14, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exclude non-builtin C methods from builtins optimisation again
parent
083b8d94
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+0
-10
Cython/Compiler/Visitor.py
Cython/Compiler/Visitor.py
+5
-1
tests/run/append.pyx
tests/run/append.pyx
+13
-0
No files found.
Cython/Compiler/Optimize.py
View file @
8f1599cd
...
...
@@ -2596,16 +2596,6 @@ class OptimizeBuiltinCalls(Visitor.NodeRefCleanupMixin,
],
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
):
"""Optimistic optimisation as X.append() is almost always
referring to a list.
...
...
Cython/Compiler/Visitor.py
View file @
8f1599cd
...
...
@@ -598,7 +598,11 @@ class MethodDispatcherTransform(EnvTransform):
attr_name
=
function
.
attribute
if
function
.
type
.
is_pyobject
:
self_arg
=
function
.
obj
elif
node
.
self
:
elif
node
.
self
and
function
.
entry
:
entry
=
function
.
entry
.
as_variable
if
not
entry
or
not
entry
.
is_builtin
:
return
node
# C implementation of a Python builtin method - see if we find further matches
self_arg
=
node
.
self
arg_list
=
arg_list
[
1
:]
# drop CloneNode of self argument
else
:
...
...
tests/run/append.pyx
View file @
8f1599cd
...
...
@@ -52,6 +52,19 @@ def test_append(L):
return
L
def
test_append_typed
(
list
L
not
None
):
"""
>>> test_append_typed([])
None
None
[1, 2, (3, 4)]
"""
print
L
.
append
(
1
)
L
.
append
(
2
)
print
L
.
append
((
3
,
4
))
return
L
def
append_unused_retval
(
L
):
"""
>>> append_unused_retval([])
...
...
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