[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 463a09a3bfff by Victor Stinner in branch 'default':
Issue #25357: Add an optional newline paramer to binascii.b2a_base64().
https://hg.python.org/cpython/rev/463a09a3bfff

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-11 Thread STINNER Victor

STINNER Victor added the comment:

Thanks for reviews Serhiy & Martin.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

With Martin's comments the patch LGTM.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-09 Thread Martin Panter

Martin Panter added the comment:

The “newline” name seems as good as any. The patch looks good in general. I 
left a few comments.

I agree with not bothering for the UU encoder. That encoding has an embedded 
line length byte at the start of each line, so it makes less sense to omit 
newlines. Base-64 is used in places such as URLs where multiline output is not 
relevant, but I don’t know of a similar case for the UU encoding.

If I was doing it, I wouldn’t bother with a test case for keyword-only-ness, 
but suit yourself.

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-09 Thread STINNER Victor

New submission from STINNER Victor:

The base64.b64encode() function calls binascii.b2a_base64() and then strips the 
newline. It would be more efficient to directly not add a newline.

Attached patch adds an optional newline parameter to binascii.b2a_base64(). It 
also modifies base64.b64encode() to call binascii.b2a_base64() with 
newline=False.

--
files: binascii_b2a_base64_newline.patch
keywords: patch
messages: 252625
nosy: haypo
priority: normal
severity: normal
status: open
title: Add an optional newline parameter to binascii.b2a_base64() to not add a 
newline
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file40731/binascii_b2a_base64_newline.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

+1. Not sure about the parameter name, but if no one suggests better, it LGTM. 
Added comments on Rietveld.

What about adding the same parameter to binascii.b2a_uu()?

--
nosy: +ncoghlan, pitrou, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-09 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I forgot to add an unit test.

> What about adding the same parameter to binascii.b2a_uu()?

This function is used in Lib/encodings/uu_codec.py and Lib/uu.py, but the 
newline is not stripped. So I don't think that it's worth to add an optional 
parameter.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-09 Thread STINNER Victor

STINNER Victor added the comment:

Updated patch to take Serhiy's comments in account and now with an unit test!

--
Added file: http://bugs.python.org/file40733/binascii_b2a_base64_newline-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25357] Add an optional newline parameter to binascii.b2a_base64() to not add a newline

2015-10-09 Thread STINNER Victor

STINNER Victor added the comment:

Oh by the way, the new parameter is a keyword only parameter. It's not possible 
to write b2a_base64(data, False). Maybe I should also add an unit test for this.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com