Commit 113edaab authored by Stefan Behnel's avatar Stefan Behnel

implement len(unicode) for PEP 393

--HG--
extra : rebase_source : 211fa0c1058750151e3524d4ca5854a86ed5289f
parent 7c01e848
...@@ -578,6 +578,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -578,6 +578,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
#define Py_TPFLAGS_HAVE_NEWBUFFER 0 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif #endif
/* new Py3.3 unicode representation (PEP 393) */
#ifdef PyUnicode_GET_LENGTH
#define __Pyx_PyUnicode_GET_LENGTH PyUnicode_GET_LENGTH
#else
#define __Pyx_PyUnicode_GET_LENGTH PyUnicode_GET_SIZE
#endif
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type #define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject #define PyStringObject PyUnicodeObject
......
...@@ -2037,7 +2037,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform): ...@@ -2037,7 +2037,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
]) ])
_map_to_capi_len_function = { _map_to_capi_len_function = {
Builtin.unicode_type : "PyUnicode_GET_SIZE", Builtin.unicode_type : "__Pyx_PyUnicode_GET_LENGTH",
Builtin.bytes_type : "PyBytes_GET_SIZE", Builtin.bytes_type : "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",
......
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