From 09f358073d02ea982f4ceeaeeb1269a9038e12ce Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 1 Nov 2009 16:58:44 +0100 Subject: [PATCH] cleanup --- Cython/Compiler/Optimize.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 853bde14..236a1c17 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -835,6 +835,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): else: return function_handler(node, arg_tuple) elif function.is_attribute: + attr_name = function.attribute arg_list = arg_tuple.args self_arg = function.obj obj_type = self_arg.type @@ -852,10 +853,12 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): else: type_name = "object" # safety measure method_handler = self._find_handler( - "method_%s_%s" % (type_name, function.attribute), kwargs) + "method_%s_%s" % (type_name, attr_name), kwargs) if method_handler is None: - method_handler = self._find_handler( - "methodany_%s" % function.attribute, kwargs) + if attr_name in TypeSlots.method_name_to_slot \ + or attr_name == '__new__': + method_handler = self._find_handler( + "slot%s" % attr_name, kwargs) if method_handler is None: return node if self_arg is not None: @@ -1043,7 +1046,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): PyrexTypes.CFuncTypeArg("type", Builtin.type_type, None) ]) - def _handle_simple_methodany___new__(self, node, args, is_unbound_method): + def _handle_simple_slot__new__(self, node, args, is_unbound_method): """Replace 'exttype.__new__(exttype)' by a call to exttype->tp_new() """ obj = node.function.obj -- 2.26.2