[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-30 Thread Florent Xicluna
Changes by Florent Xicluna : Removed file: http://bugs.python.org/file15560/issue4770_binascii_py3k.diff ___ Python tracker ___ ___ Python-bugs

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread flox
Changes by flox : Added file: http://bugs.python.org/file15563/issue4770_binascii_py3k_v2.diff ___ Python tracker ___ ___ Python-bugs-list mail

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread flox
Changes by flox : Removed file: http://bugs.python.org/file15562/issue4770_binascii_py3k_v2.diff ___ Python tracker ___ ___ Python-bugs-list ma

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread flox
flox added the comment: Patch updated: * Added documentation * Switched to "payload.encode('ascii')" in the "email.message" module Note: there was no ambiguity on the first line of the documentation: « [These functions] convert between binary and various ASCII-encoded binary representations »

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread flox
flox added the comment: I perform a "grep" on the email package (with patch applied). There's some places where 'raw-unicode-escape' is used. I understand that all "payload.encode('raw-unicode-escape')" should be changed to "payload.encode('ascii')" when the payload is processed by another tran

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: The email interface ate part of the code snippet. Here's the complete version: >>> import base64 >>> base64.b64decode('äöü'.encode('raw-unicode-escape')) b'' >>> base64.b64decode('äöü'.encode('ascii')) Traceback (most recent call last): File "", line 1, i

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: I agree with Marc-André that enforcing ASCII looks like the only sensible solution. Perhaps Barry knows the purpose of using "raw-unicode-escape" here, though? -- nosy: +barry, pitrou ___ Python tracker

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: flox wrote: > > flox added the comment: > >> Are you sure that this patch is correct (which RFC says >> that quoted printable should use our raw-unicode-escape >> codec ?): > > I am not sure of anything. It is an "educated guess" at the most. > Since 'ba

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread flox
flox added the comment: > Are you sure that this patch is correct (which RFC says > that quoted printable should use our raw-unicode-escape > codec ?): I am not sure of anything. It is an "educated guess" at the most. Since 'base64' and 'x-uuencode' both use 'raw-unicode-escape'... See longer

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: flox wrote: > > flox added the comment: > > This patch removes implicit encoding in binascii functions: > - a2b_hex (=unhexlify) > - a2b_qp > - rledecode_hqx > > * Tests module "test_binascii" is reviewed and simplified. > * Fixes for "email", "pic

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread flox
flox added the comment: This patch removes implicit encoding in binascii functions: - a2b_hex (=unhexlify) - a2b_qp - rledecode_hqx * Tests module "test_binascii" is reviewed and simplified. * Fixes for "email", "pickle" and "quopri" modules to encode input. All tests pass. -- k

[issue4770] binascii module, crazy error messages, unexpected behavior

2009-12-14 Thread flox
flox added the comment: I agree, we need consistency between all functions of this package. I've run a small script to check what happens for all 16 functions of the binascii package when they receive unicode input... See attached script (and sample output). IMHO 4 functions should be fixed t

[issue4770] binascii module, crazy error messages, unexpected behavior

2008-12-30 Thread STINNER Victor
STINNER Victor added the comment: See also issue #4769 (want base64.b64decode(str)). -- nosy: +haypo ___ Python tracker ___ ___ Python

[issue4770] binascii module, crazy error messages, unexpected behavior

2008-12-29 Thread David M. Beazley
David M. Beazley added the comment: Given the low-level nature of this module, I can understand the motivation to make it all bytes. However, I'm going to respectfully disagree with that and claim that making binascii all bytes really goes against the whole spirit of what Python 3.0 has trie

[issue4770] binascii module, crazy error messages, unexpected behavior

2008-12-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Item 1 was most probably fixed recently with r67929. Concerning item 2, I think it was decided that binascii is a bytes-only module. I suggest to close this issue as "out of date". -- nosy: +amaury.forgeotdarc ___

[issue4770] binascii module, crazy error messages, unexpected behavior

2008-12-29 Thread David M. Beazley
New submission from David M. Beazley : 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.b