From: Stefan Behnel Date: Wed, 21 May 2008 16:56:31 +0000 (+0200) Subject: fix intern() builtin in Py3 X-Git-Tag: 0.9.8rc1~11^2~10^2~15^2~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=11b2d3a31e726f61c0cb4ed406efc5ee8951c90b;p=cython.git fix intern() builtin in Py3 --- diff --git a/Cython/Compiler/Builtin.py b/Cython/Compiler/Builtin.py index 68f6815b..e30f7c0e 100644 --- a/Cython/Compiler/Builtin.py +++ b/Cython/Compiler/Builtin.py @@ -24,7 +24,7 @@ builtin_function_table = [ #('hex', "", "", ""), #('id', "", "", ""), #('input', "", "", ""), - ('intern', "s", "O", "PyString_InternFromString"), + ('intern', "s", "O", "__Pyx_InternFromString"), ('isinstance', "OO", "b", "PyObject_IsInstance"), ('issubclass', "OO", "b", "PyObject_IsSubclass"), ('iter', "O", "O", "PyObject_GetIter"), @@ -118,8 +118,18 @@ bad: } """] +intern_utility_code = [""" +#if PY_MAJOR_VERSION >= 3 +# define __Pyx_InternFromString(s) PyUnicode_InternFromString(s) +#else +# define __Pyx_InternFromString(s) PyString_InternFromString(s) +#endif +""",""" +"""] + builtin_utility_code = { 'getattr3': getattr3_utility_code, + 'intern' : intern_utility_code, } builtin_scope = BuiltinScope()