From: Stefan Behnel Date: Sat, 28 Nov 2009 08:10:25 +0000 (+0100) Subject: let char*->bytes conversion know that it returns bytes X-Git-Tag: 0.12.1~111 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=468648c94c78393479009b1df7f59200418a955a;p=cython.git let char*->bytes conversion know that it returns bytes --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 709d5a02..21b3bf1c 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -5690,11 +5690,15 @@ class CoerceToPyTypeNode(CoercionNode): type = py_object_type is_temp = 1 - def __init__(self, arg, env): + def __init__(self, arg, env, type=py_object_type): CoercionNode.__init__(self, arg) if not arg.type.create_to_py_utility_code(env): error(arg.pos, "Cannot convert '%s' to Python object" % arg.type) + if type is not py_object_type: + self.type = py_object_type + elif arg.type.is_string: + self.type = Builtin.bytes_type gil_message = "Converting to Python object"