Message78470
See Issue 4869 for a related bug.
Most of the functions in binascii are meant to go from binary data to
textual representations (hex digits, base64, binhex, etc.). There are
numerous problems:
1. Misleading error messages. For example:
>>> binascii.b2a_base64("Some text")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: b2a_base64() argument 1 must be string or buffer, not str
>>> binascii.crc32("Some text")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: crc32() argument 1 must be string or buffer, not str
>>>
Huh? Didn't I just pass a string? Error message should say "argument
1 must be bytes or buffer, not str".
This problem shows up with most of the other encoding functions too
(i.e., b2a_uu).
2. Expected behavior with encoding/decoding.
The functions in this module are going from binary to text. To be
consistent, I think the result of encoding operations such as b2a_uu(),
b2a_base64(), should be strings, not bytes.
Similarly, decoding operations are going from text back to bytes. I
think the input arguments should be allowed to be str (in addition to
bytes if you want). |
|
Date |
User |
Action |
Args |
2008-12-29 18:00:53 | beazley | set | recipients:
+ beazley |
2008-12-29 18:00:53 | beazley | set | messageid: <1230573653.7.0.91596129114.issue4770@psf.upfronthosting.co.za> |
2008-12-29 18:00:35 | beazley | link | issue4770 messages |
2008-12-29 18:00:35 | beazley | create | |
|