Bug#833363: python-debian: please improve message when passing incorrect type to iter_paragraphs

Chris Lamb lamby at debian.org
Wed Aug 3 14:21:30 UTC 2016


Source: python-debian
Version: 0.1.28
Tags: patch
Severity: wishlist

Hi,

The attached patch replaces:

 TypeError: bytes or unicode/string required

with:

 TypeError: bytes or unicode/string required, not <class 'int'>

.. which is a little more useful for developers - they are almost
certainly going to do the same thing manually when debugging. :)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby at debian.org / chris-lamb.co.uk
       `-
-------------- next part --------------
diff --git a/lib/debian/deb822.py b/lib/debian/deb822.py
index c1dcb17..403fd95 100644
--- a/lib/debian/deb822.py
+++ b/lib/debian/deb822.py
@@ -1269,7 +1269,7 @@ class _gpg_multivalued(_multivalued):
             return s
         if isinstance(s, six.string_types):
             return s.encode(encoding)
-        raise TypeError('bytes or unicode/string required')
+        raise TypeError('bytes or unicode/string required, not %s' % type(s))
 
 
 class Dsc(_gpg_multivalued):


More information about the pkg-python-debian-maint mailing list