Commit ff35cf52 authored by Stefan Behnel's avatar Stefan Behnel

fix crash when calling non-trivial type constructors

parent 1f0a5deb
......@@ -2471,7 +2471,9 @@ class SimpleCallNode(CallNode):
self.arg_tuple = TupleNode(self.pos, args = self.args)
self.arg_tuple.analyse_types(env)
self.args = None
if func_type is Builtin.type_type and function.entry.is_builtin and \
if func_type is Builtin.type_type and function.is_name and \
function.entry and \
function.entry.is_builtin and \
function.entry.name in Builtin.types_that_construct_their_instance:
# calling a builtin type that returns a specific object type
if function.entry.name == 'float':
......
cdef class MyType:
def dup(self):
"""
>>> x1 = MyType()
>>> isinstance(x1, MyType)
True
>>> x2 = x1.dup()
>>> isinstance(x2, MyType)
True
>>> x1 != x2
True
"""
cdef MyType clone = <MyType>type(self)()
return clone
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