projects
/
cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b4c27d3
)
drop redundant C->Py->C coercions after optimisations
author
Stefan Behnel
<scoder@users.berlios.de>
Sun, 21 Mar 2010 19:50:08 +0000
(20:50 +0100)
committer
Stefan Behnel
<scoder@users.berlios.de>
Sun, 21 Mar 2010 19:50:08 +0000
(20:50 +0100)
Cython/Compiler/Optimize.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/Optimize.py
b/Cython/Compiler/Optimize.py
index 5d587160a5a9c7a3417a01ba0636f9bc75105ffc..85a405a8797e904d3d7e8d2f782bb55a28f60557 100644
(file)
--- a/
Cython/Compiler/Optimize.py
+++ b/
Cython/Compiler/Optimize.py
@@
-962,6
+962,11
@@
class OptimizeBuiltinCalls(Visitor.EnvTransform):
return arg
else:
return arg.coerce_to(node.type, self.env_stack[-1])
+ if isinstance(arg, ExprNodes.CoerceToPyTypeNode):
+ if arg.type is PyrexTypes.py_object_type:
+ if node.type.assignable_from(arg.arg.type):
+ # completely redundant C->Py->C coercion
+ return arg.arg.coerce_to(node.type, self.env_stack[-1])
if not isinstance(arg, ExprNodes.SimpleCallNode):
return node
if not (node.type.is_int or node.type.is_float):