[Python-checkins] cpython: Make TypeError message from Command.__init__ more useful

eric.araujo python-checkins at python.org
Fri Jul 29 14:35:31 CEST 2011


http://hg.python.org/cpython/rev/b788eaff72bc
changeset:   71573:b788eaff72bc
user:        Éric Araujo <merwok at netwok.org>
date:        Fri Jul 29 02:32:41 2011 +0200
summary:
  Make TypeError message from Command.__init__ more useful

files:
  Lib/packaging/command/cmd.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/packaging/command/cmd.py b/Lib/packaging/command/cmd.py
--- a/Lib/packaging/command/cmd.py
+++ b/Lib/packaging/command/cmd.py
@@ -57,7 +57,8 @@
         from packaging.dist import Distribution
 
         if not isinstance(dist, Distribution):
-            raise TypeError("dist must be a Distribution instance")
+            raise TypeError("dist must be an instance of Distribution, not %r"
+                            % type(dist))
         if self.__class__ is Command:
             raise RuntimeError("Command is an abstract class")
 

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


More information about the Python-checkins mailing list