Commit 919ae401 authored by Stefan Behnel's avatar Stefan Behnel

keep type information when coercing from C complex to Python complex

parent 7dc3409c
......@@ -7074,12 +7074,17 @@ class CoerceToPyTypeNode(CoercionNode):
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:
if type is py_object_type:
# be specific about some known types
if arg.type.is_string:
self.type = bytes_type
elif arg.type is PyrexTypes.c_py_unicode_type:
self.type = unicode_type
elif arg.type.is_complex:
self.type = Builtin.complex_type
else:
# FIXME: check that the target type and the resulting type are compatible
pass
gil_message = "Converting to Python object"
......
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