[Python-checkins] cpython: Replace assert with a proper error

antoine.pitrou python-checkins at python.org
Tue Jan 14 21:02:49 CET 2014


http://hg.python.org/cpython/rev/0bb3c098c64a
changeset:   88481:0bb3c098c64a
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Tue Jan 14 21:02:43 2014 +0100
summary:
  Replace assert with a proper error

files:
  Tools/clinic/clinic.py |  6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -2343,9 +2343,11 @@
                 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)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list