Commit 8b6332e4 authored by Stefan Behnel's avatar Stefan Behnel

comments

parent 49d33ef7
...@@ -1237,7 +1237,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): ...@@ -1237,7 +1237,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
_map_to_capi_len_function = { _map_to_capi_len_function = {
Builtin.unicode_type : "PyUnicode_GET_SIZE", 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.bytes_type : "__Pyx_PyBytes_GET_SIZE",
Builtin.list_type : "PyList_GET_SIZE", Builtin.list_type : "PyList_GET_SIZE",
Builtin.tuple_type : "PyTuple_GET_SIZE", Builtin.tuple_type : "PyTuple_GET_SIZE",
...@@ -1247,7 +1247,8 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): ...@@ -1247,7 +1247,8 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
}.get }.get
def _handle_simple_function_len(self, node, pos_args): 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: if len(pos_args) != 1:
self._error_wrong_arg_count('len', node, pos_args, 1) self._error_wrong_arg_count('len', node, pos_args, 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment