Commit 151c05d1 authored by Stefan Behnel's avatar Stefan Behnel

Do not try to automatically infer ctuple types if one of the items is a memoryview.

parent 9f3f99fd
...@@ -7757,10 +7757,10 @@ class TupleNode(SequenceNode): ...@@ -7757,10 +7757,10 @@ class TupleNode(SequenceNode):
if self.mult_factor or not self.args: if self.mult_factor or not self.args:
return tuple_type return tuple_type
arg_types = [arg.infer_type(env) for arg in self.args] arg_types = [arg.infer_type(env) for arg in self.args]
if any(type.is_pyobject or type.is_unspecified or type.is_fused for type in arg_types): if any(type.is_pyobject or type.is_memoryviewslice or type.is_unspecified or type.is_fused
for type in arg_types):
return tuple_type return tuple_type
else: return env.declare_tuple_type(self.pos, arg_types).type
return env.declare_tuple_type(self.pos, arg_types).type
def analyse_types(self, env, skip_children=False): def analyse_types(self, env, skip_children=False):
if len(self.args) == 0: if len(self.args) == 0:
...@@ -7774,7 +7774,8 @@ class TupleNode(SequenceNode): ...@@ -7774,7 +7774,8 @@ class TupleNode(SequenceNode):
arg.starred_expr_allowed_here = True arg.starred_expr_allowed_here = True
self.args[i] = arg.analyse_types(env) self.args[i] = arg.analyse_types(env)
if (not self.mult_factor and if (not self.mult_factor and
not any((arg.is_starred or arg.type.is_pyobject or arg.type.is_fused) for arg in self.args)): not any((arg.is_starred or arg.type.is_pyobject or arg.type.is_memoryviewslice or arg.type.is_fused)
for arg in self.args)):
self.type = env.declare_tuple_type(self.pos, (arg.type for arg in self.args)).type self.type = env.declare_tuple_type(self.pos, (arg.type for arg in self.args)).type
self.is_temp = 1 self.is_temp = 1
return self return self
......
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