From: Stefan Behnel Date: Tue, 23 Mar 2010 19:13:05 +0000 (+0100) Subject: comments X-Git-Tag: 0.13.beta0~253 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8b6332e4bf1a6e244392912b101d57714095643d;p=cython.git comments --- diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index db1750d0..7fa1a9d0 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -1237,7 +1237,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): _map_to_capi_len_function = { Builtin.unicode_type : "PyUnicode_GET_SIZE", - Builtin.str_type : "Py_SIZE", + Builtin.str_type : "Py_SIZE", # works in Py2 and Py3 Builtin.bytes_type : "__Pyx_PyBytes_GET_SIZE", Builtin.list_type : "PyList_GET_SIZE", Builtin.tuple_type : "PyTuple_GET_SIZE", @@ -1247,7 +1247,8 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): }.get def _handle_simple_function_len(self, node, pos_args): - """Replace len(char*) by the equivalent call to strlen(). + """Replace len(char*) by the equivalent call to strlen() and + len(known_builtin_type) by an equivalent C-API call. """ if len(pos_args) != 1: self._error_wrong_arg_count('len', node, pos_args, 1)