This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients doerwalter, ezio.melotti, lemburg, ncoghlan, serhiy.storchaka, vstinner
Date 2013-11-22.11:43:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385120605.25.0.594725951158.issue19619@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-11-22 11:43:25vstinnersetrecipients: + vstinner, lemburg, doerwalter, ncoghlan, ezio.melotti, serhiy.storchaka
2013-11-22 11:43:25vstinnersetmessageid: <1385120605.25.0.594725951158.issue19619@psf.upfronthosting.co.za>
2013-11-22 11:43:25vstinnerlinkissue19619 messages
2013-11-22 11:43:24vstinnercreate