STINNER Victor added the comment:

If _is_text_encoding may change in Python 3.5, you should add a comment to warn 
users to not use it and explain its purpose, maybe with a reference to this 
issue.

--

We have talking about a very few codecs:

* base64: bytes => bytes
* bz2: bytes => bytes
* hex: bytes => bytes; decode supports also ASCII string (str) => bytes
* quopri: bytes => bytes
* rot_13: str => str
* uu: bytes => bytes
* zlib: bytes => bytes

I suppose that supporting ASCII string input to the hex decoder is a border 
effect of its implementation. I don't know if it is expected *for the codec*.

If we simplify the hex decoder to reject str types, all these codecs would have 
simply one type: same input and output type. Anyway, if you want something 
based on types, the special case for the hex decoder cannot be expressed with a 
type nor ABC. "ASCII string" is not a type.

So instead of  _is_text_encoding=False could be transform=bytes or 
transform=str. (I don't care of the name: transform_type, type, codec_type, 
data_type, etc.)

I know that bytes is not exact: bytearray, memoryview and any bytes-like object 
is accepted, but it is a probably enough for now.

----------

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

Reply via email to