cleanup, support unbound method calls to bytes.decode()
authorStefan Behnel <scoder@users.berlios.de>
Mon, 26 Oct 2009 06:52:43 +0000 (07:52 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Mon, 26 Oct 2009 06:52:43 +0000 (07:52 +0100)
Cython/Compiler/Optimize.py

index 0f686a0bcee95e52cf927162f7228306f2cb0dc3..57a86db09dff73cbcd698bea3e7e6fcec2eed112 100644 (file)
@@ -1033,8 +1033,6 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
         if len(args) < 1 or len(args) > 3:
             self._error_wrong_arg_count('bytes.decode', node, args, '1-3')
             return node
-        if is_unbound_method:
-            return node
         if not isinstance(args[0], ExprNodes.SliceIndexNode):
             # we need the string length as a slice end index
             return node
@@ -1069,12 +1067,6 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
                 is_temp = node.is_temp,
                 )
 
-            return self._substitute_method_call(
-                node, decode_function,
-                self.PyUnicode_DecodeXyz_func_type,
-                'decode', is_unbound_method,
-                [string_node, stop, error_handling_node])
-
         return ExprNodes.PythonCapiCallNode(
             node.pos, "PyUnicode_Decode",
             self.PyUnicode_Decode_func_type,
@@ -1082,12 +1074,6 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
             is_temp = node.is_temp,
             )
 
-        return self._substitute_method_call(
-            node, "PyUnicode_Decode",
-            self.PyUnicode_Decode_func_type,
-            'decode', is_unbound_method,
-            [string_node, stop, encoding_node, error_handling_node])
-
     def _find_special_codec_name(self, encoding):
         try:
             requested_codec = codecs.getencoder(encoding)