Message203741
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. |
|
Date |
User |
Action |
Args |
2013-11-22 11:43:25 | vstinner | set | recipients:
+ vstinner, lemburg, doerwalter, ncoghlan, ezio.melotti, serhiy.storchaka |
2013-11-22 11:43:25 | vstinner | set | messageid: <1385120605.25.0.594725951158.issue19619@psf.upfronthosting.co.za> |
2013-11-22 11:43:25 | vstinner | link | issue19619 messages |
2013-11-22 11:43:24 | vstinner | create | |
|