Commit e6803ace authored by Antoine Pitrou's avatar Antoine Pitrou

Replace assert with a proper error

parent 5a95bf11
...@@ -2343,9 +2343,11 @@ class DSLParser: ...@@ -2343,9 +2343,11 @@ class DSLParser:
fail("Badly-formed annotation for " + full_name + ": " + returns) fail("Badly-formed annotation for " + full_name + ": " + returns)
try: try:
name, legacy, kwargs = self.parse_converter(module.body[0].returns) name, legacy, kwargs = self.parse_converter(module.body[0].returns)
assert not legacy if legacy:
fail("Legacy converter {!r} not allowed as a return converter"
.format(name))
if name not in return_converters: if name not in return_converters:
fail("Error: No available return converter called " + repr(name)) fail("No available return converter called " + repr(name))
return_converter = return_converters[name](**kwargs) return_converter = return_converters[name](**kwargs)
except ValueError: except ValueError:
fail("Badly-formed annotation for " + full_name + ": " + returns) fail("Badly-formed annotation for " + full_name + ": " + returns)
......
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