homepage

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.

classification
Title: base64 newlines - documentation (again)
Type: Stage:
Components: Documentation Versions: Python 2.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: barry, fdrake, p_rouse, rhettinger
Priority: normal Keywords:

Created on 2002年04月22日 11:41 by p_rouse, last changed 2022年04月10日 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
base64.diff rhettinger, 2002年05月14日 16:11 Patch to libbase64.tex
base64-2.diff rhettinger, 2002年05月15日 08:13 Revised patch to libbase64.tex
base64-3.diff rhettinger, 2002年05月15日 14:57 Patch with Barry's wording
Messages (12)
msg10465 - (view) Author: Paul Rouse (p_rouse) Date: 2002年04月22日 11:41
The documentation fix for bug 463330, describing the
newline added by base64.encode and base64.encodestring
appears to be incorrect!
The "courtesy newline" is appended to the result, not
the input (at line 466 of binsacii.c), so it is *not*
true that
base64.encodestring('hello') ==
base64.encodestring('hello\n')
In fact:
 base64.encodestring('hello') == 'aGVsbG8=\n'
 base64.encodestring('hello\n') == 'aGVsbG8K\n'
This applies to documentation for 2.2 and 2.2.1, and
actual behaviour has been checked in 2.2 
msg10466 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002年05月14日 07:40
Logged In: YES 
user_id=80475
Barry, is this the intended behavior or should the comment 
in the docs be eliminated? The conversation in 
www.python.org/sf/463330 was not clear to me on this point.
Confirmed:
>>> import base64
>>> v = base64.encodestring('hello!')
>>> w = base64.encodestring('hello!\n')
>>> v == w, v , w
(False, 'aGVsbG8h\n', 'aGVsbG8hCg==\n')
msg10467 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002年05月14日 13:52
Logged In: YES 
user_id=12800
The intended behavior is irrelevant <wink>. Since this is
how the base64 module works, it needs to be correctly
documented. It's way too late to be changing this behavior,
as broken as some might think it is.:)
Note that the email package has an RFC 2045-2047 compliant
base64 encoding module called email.base64MIME. It
currently isn't documented (but will be before 2.3 is released).
Reassigning to Fred so he can correct the base64 documentation.
msg10468 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002年05月14日 16:11
Logged In: YES 
user_id=80475
Fred, is the attached patch okay to commit to 2.3 and 
release 22-maint?
msg10469 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002年05月15日 02:40
Logged In: YES 
user_id=3066
Barry, you're the MIME guru, tell Raymond whether he should
check in his patch. ;-)
msg10470 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002年05月15日 04:51
Logged In: YES 
user_id=12800
I'm not sure the patch is sufficient. You need to at least
explain that a newline is always added to the output.
msg10471 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002年05月15日 08:13
Logged In: YES 
user_id=80475
Please approve the new patch.
msg10472 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002年05月15日 13:57
Logged In: YES 
user_id=12800
Actually, I realized encodestring() is a bit more subtle
than that. I think what it actually does is "return a
string containing one or more lines of base64-encoded data"
always including an extra trailing newline.
msg10473 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002年05月15日 14:57
Logged In: YES 
user_id=80475
Inserted new wording into patch below.
Do you also want this backported to release22-maint?
msg10474 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002年05月15日 15:06
Logged In: YES 
user_id=3066
I think the patch should apply to both release21-maint and
release22-maint as well as the trunk. I don't think this
describes a recently introduced behavior in the base64 module.
msg10475 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002年05月15日 16:28
Logged In: YES 
user_id=12800
Fred's right, the behavior is long standing. I'm good with
the patch. Reassigning to Raymond for application of patch,
who should close this report once that's done.
msg10476 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002年05月16日 04:39
Logged In: YES 
user_id=80475
Committed as libbase64.tex 1.21 and 1.20.6.1.
Closing bug.
History
Date User Action Args
2022年04月10日 16:05:15adminsetgithub: 36480
2002年04月22日 11:41:16p_rousecreate

AltStyle によって変換されたページ (->オリジナル) /