From 8b6332e4bf1a6e244392912b101d57714095643d Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 23 Mar 2010 20:13:05 +0100 Subject: [PATCH] comments --- Cython/Compiler/Optimize.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) -- 2.26.2