Commit cd5fb480 authored by Stefan Behnel's avatar Stefan Behnel

Allow any type in dataclasses.InitVar() again.

parent f73108cc
......@@ -1223,7 +1223,9 @@ class TemplatedTypeNode(CBaseTypeNode):
error(template_node.pos, "unknown type in template argument")
type = error_type
elif type and base_type.python_type_constructor_name and not (type.is_pyobject or type.is_memoryviewslice):
if type.is_numeric and template_node.is_name and template_node.name in ('int', 'long', 'float', 'complex'):
if base_type.python_type_constructor_name not in ('dataclasses.InitVar',):
pass # Allow any type (Python or C) for these.
elif type.is_numeric and template_node.is_name and template_node.name in ('int', 'long', 'float', 'complex'):
# int, long, float, complex => make sure we use the Python types
type = env.builtin_scope().lookup_here(template_node.name).type
else:
......
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