Nick Coghlan added the comment:

Checking the other binary<->binary and str<->str codecs with input type and 
value restrictions:

- they all throw TypeError and get wrapped appropriately when asked to encode 
str input (rot_13 throws the output type error)

- rot_13 throws an appropriately wrapped AttributeError when asked to decode 
bytes or bytearray object

For bad value input, "uu_codec" is the only one that throws a normal 
ValueError, I couldn't figure out a way to get "quopri_codec" to complain about 
the input value and the others throw a module specific error:

    binascii (base64_codec, hex_codec) throws binascii.Error (a custom 
ValueError subclass)
    zlib (zlib_codec) throws zlib.error (inherits directly from Exception)

As with the OSError that escapes from bz2_codec, I think the simplest and most 
conservative option is to not worry about those at this point.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17828>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to