Commit 566ecc3b authored by Stefan Behnel's avatar Stefan Behnel

Increase warning level for legacy "dict in annotations" typing.

parent f18e3c9f
...@@ -13677,7 +13677,7 @@ class AnnotationNode(ExprNode): ...@@ -13677,7 +13677,7 @@ class AnnotationNode(ExprNode):
explicit_pytype = explicit_ctype = False explicit_pytype = explicit_ctype = False
if annotation.is_dict_literal: if annotation.is_dict_literal:
warning(annotation.pos, warning(annotation.pos,
"Dicts should no longer be used as type annotations. Use 'cython.int' etc. directly.") "Dicts should no longer be used as type annotations. Use 'cython.int' etc. directly.", level=1)
for name, value in annotation.key_value_pairs: for name, value in annotation.key_value_pairs:
if not name.is_string_literal: if not name.is_string_literal:
continue continue
...@@ -13689,7 +13689,7 @@ class AnnotationNode(ExprNode): ...@@ -13689,7 +13689,7 @@ class AnnotationNode(ExprNode):
explicit_ctype = True explicit_ctype = True
annotation = value annotation = value
if explicit_pytype and explicit_ctype: if explicit_pytype and explicit_ctype:
warning(annotation.pos, "Duplicate type declarations found in signature annotation") warning(annotation.pos, "Duplicate type declarations found in signature annotation", level=1)
arg_type = annotation.analyse_as_type(env) arg_type = annotation.analyse_as_type(env)
if annotation.is_name and not annotation.cython_attribute and annotation.name in ('int', 'long', 'float'): if annotation.is_name and not annotation.cython_attribute and annotation.name in ('int', 'long', 'float'):
# Map builtin numeric Python types to C types in safe cases. # Map builtin numeric Python types to C types in safe cases.
......
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