Commit d9ce56c7 authored by Stefan Behnel's avatar Stefan Behnel

make 'complex' the C double complex type instead of Python's complex object type

parent 3e75aa6c
...@@ -786,6 +786,14 @@ class CSimpleBaseTypeNode(CBaseTypeNode): ...@@ -786,6 +786,14 @@ class CSimpleBaseTypeNode(CBaseTypeNode):
error(self.pos, "can only complexify c numeric types") error(self.pos, "can only complexify c numeric types")
type = PyrexTypes.CComplexType(type) type = PyrexTypes.CComplexType(type)
type.create_declaration_utility_code(env) type.create_declaration_utility_code(env)
elif type is Builtin.complex_type:
# Special case: optimise builtin complex type into C's
# double complex. The parser cannot do this (as for the
# normal scalar types) as the user may have redeclared the
# 'complex' type. Testing for the exact type here works.
type = PyrexTypes.c_double_complex_type
type.create_declaration_utility_code(env)
self.complex = True
if type: if type:
return type return type
else: else:
......
...@@ -2318,7 +2318,7 @@ modifiers_and_name_to_type = { ...@@ -2318,7 +2318,7 @@ modifiers_and_name_to_type = {
(1, 0, "double"): c_double_type, (1, 0, "double"): c_double_type,
(1, 1, "double"): c_longdouble_type, (1, 1, "double"): c_longdouble_type,
(1, 0, "complex"): c_float_complex_type, (1, 0, "complex"): c_double_complex_type, # C: float, Python: double => Python wins
(1, 0, "floatcomplex"): c_float_complex_type, (1, 0, "floatcomplex"): c_float_complex_type,
(1, 0, "doublecomplex"): c_double_complex_type, (1, 0, "doublecomplex"): c_double_complex_type,
(1, 1, "doublecomplex"): c_longdouble_complex_type, (1, 1, "doublecomplex"): c_longdouble_complex_type,
......
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