From 468648c94c78393479009b1df7f59200418a955a Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 28 Nov 2009 09:10:25 +0100 Subject: [PATCH] let char*->bytes conversion know that it returns bytes --- Cython/Compiler/ExprNodes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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" -- 2.26.2