mirror of
https://github.com/python/cpython.git
synced 2026-01-06 23:42:34 +00:00
Replace assert with a proper error
This commit is contained in:
parent
f5207e617b
commit
d7fb7919e3
1 changed files with 4 additions and 2 deletions
|
|
@ -2343,9 +2343,11 @@ def state_modulename_name(self, line):
|
|||
fail("Badly-formed annotation for " + full_name + ": " + returns)
|
||||
try:
|
||||
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:
|
||||
fail("Error: No available return converter called " + repr(name))
|
||||
fail("No available return converter called " + repr(name))
|
||||
return_converter = return_converters[name](**kwargs)
|
||||
except ValueError:
|
||||
fail("Badly-formed annotation for " + full_name + ": " + returns)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue