[issue4769] b64decode should accept strings or bytes

2010-05-19 Thread Dan Buch
Dan Buch added the comment: This appears to still be an issue in py3k. I've attached the command and output when running ``python3 -m base64`` with various options and inputs. If there's consensus on a solution, I'd be happy to take a crack at making a patch. -- nosy: +meatballhat A

[issue4769] b64decode should accept strings or bytes

2010-05-21 Thread STINNER Victor
STINNER Victor added the comment: Attached base64_main.patch fixes errors described in b64-decode-str-bytes-typeerror.txt. -- ___ Python tracker ___

[issue4769] b64decode should accept strings or bytes

2010-05-22 Thread Dan Buch
Dan Buch added the comment: @haypo - what patch? :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue4769] b64decode should accept strings or bytes

2010-05-22 Thread STINNER Victor
STINNER Victor added the comment: This one! -- keywords: +patch Added file: http://bugs.python.org/file17441/base64_main.patch ___ Python tracker ___

[issue4769] b64decode should accept strings or bytes

2010-05-25 Thread STINNER Victor
STINNER Victor added the comment: I commited base64_main.patch (+ tests): 3.2 (r81533) and 3.1 (r81534). -- ___ Python tracker ___ ___

[issue4769] b64decode should accept strings or bytes

2010-05-25 Thread STINNER Victor
STINNER Victor added the comment: Accept unicode string is not "pure", but I agree that it's convinient. Here is a patch: * base64.b(16|32|64)encode and b64.encodebytes accept unicode string * unicode is first encoded to utf-8 to get a byte string * Update the docstrings and the documentatio

[issue4769] b64decode should accept strings or bytes

2010-05-25 Thread STINNER Victor
STINNER Victor added the comment: > I commited base64_main.patch (+ tests): 3.2 (r81533) and 3.1 (r81534). Hum, the test fails on Windows: fixed by r81535 (3.2) and r81536 (3.1). -- ___ Python tracker

[issue4769] b64decode should accept strings or bytes

2010-06-01 Thread R. David Murray
R. David Murray added the comment: The patch appears to be fixing the wrong functions. It is decode that needs to accept unicode. Encode should still be restricted to bytes. -- nosy: +r.david.murray ___ Python tracker

[issue4769] b64decode should accept strings or bytes

2010-06-06 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file17441/base64_main.patch ___ Python tracker ___ ___ Python-bugs-list mailin

[issue4769] b64decode should accept strings or bytes

2010-06-07 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +merwok ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org

[issue4769] b64decode should accept strings or bytes

2010-06-14 Thread STINNER Victor
Changes by STINNER Victor : -- versions: +Python 3.2 -Python 3.0 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue4769] b64decode should accept strings or bytes

2010-09-05 Thread R. David Murray
R. David Murray added the comment: After thinking about it, I'm inclined to reject this and say that quopri should be fixed to reject string input to decode. On python-dev Guido opined that a kind of polymorphism in the stdlib was good (bytes in --> bytes out, string in --> string out). str

[issue4769] b64decode should accept strings or bytes

2010-10-27 Thread Éric Araujo
Changes by Éric Araujo : -- status: pending -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue4769] b64decode should accept strings or bytes

2008-12-29 Thread David M. Beazley
New submission from David M. Beazley : The whole point of base64 encoding is to safely encode binary data into text characters. Thus, the base64.b64decode() function should equally accept text strings or binary strings as input. For example, there is a reasonable expectation that something li

[issue4769] b64decode should accept strings or bytes

2008-12-29 Thread David M. Beazley
David M. Beazley added the comment: Note: This problem applies to all of the other decoders/encoders in the base64 too (b16, b32, etc.) ___ Python tracker ___ ___

[issue4769] b64decode should accept strings or bytes

2008-12-30 Thread David M. Beazley
David M. Beazley added the comment: One more followup. The quopri module (which is highly related to base64 in that quopri and base64 are often used together within MIME) does accept both unicode and byte strings when decoding. For example, this works: >>> quopri.decodestring('Hello World

[issue4769] b64decode should accept strings or bytes

2009-01-01 Thread James Brotchie
Changes by James Brotchie : -- nosy: +brotchie ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

[issue4769] b64decode should accept strings or bytes

2009-01-01 Thread STINNER Victor
STINNER Victor added the comment: About quoted printable, there are two implementations: - binascii.a2b_qp() (Modules/binascii.c): C implementation, use PyArg_ParseTupleAndKeywords(args, kwargs, "s*|i", ...) to parse the data - quopri.decode() (Lib/quopri.py): Python implementation => quo

[issue4769] b64decode should accept strings or bytes

2009-01-01 Thread STINNER Victor
STINNER Victor added the comment: > If the input to b64decode is a str, just do a encode('ascii') > operation on it and proceed. If that fails, it wasn't valid > Base64 to begin with. On unicode encode error, should we raise an UnicodeEncodeError or a binascii.Error? And there is also the p

[issue4769] b64decode should accept strings or bytes

2009-01-19 Thread HiroakiKawai
Changes by HiroakiKawai : -- nosy: +kawai ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org