On 5/19/11 3:35 PM, Stefan Behnel wrote:
This is already optimised in Cython/Compiler/Optimize.py ("tailmatch"),
basically because it allows different numbers of arguments that need to
be dealt with. It may be worth going the same route for "str". The
decision usually depends on how complex the code transformation is. The
method table in Builtins is clearly limited.
I'll look at doing this in Optimize.py. The hunk of my patch below
fixes a generic bug, though. Without it a utility function for a method
is used, but the definition of it is never injected into the C file.
Thanks,
John
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index 6ab8be0..ac7ca67 100755
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -3746,6 +3746,8 @@ class AttributeNode(ExprNode):
if entry.is_variable or entry.is_cmethod:
self.type = entry.type
self.member = entry.cname
+ if entry.utility_code:
+ env.use_utility_code(entry.utility_code)
return
else:
# If it's not a variable or C method, it must be a
Python
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel