Mailing List Archive

[issue4428] make io.BufferedWriter observe max_buffer_size limits
Antoine Pitrou <pitrou@free.fr> added the comment:

Hi!

that sounds
> like a behavior change. I'd be fine with removing it for the 3.1/2.7
version of
> this code (though I hope people will be using the C implementation
instead).

Well, either it's supported and it will have to go through a deprecation
phase, or it's unsupported and it can be ripped out right now...

I don't think it should be supported at all, given that the semantics of
writing an iterable of ints are totally non-obvious. Reading both the
PEP and the docstrings in io.py, I only see mentions of "bytes" and
"buffer", not of an iterable of ints. Perhaps Guido should pronounce.

(do you know of any code relying on this behaviour? the C version
obviously does not support it and all regression tests pass fine, except
for an SSL bug I filed)

http://codereview.appspot.com/12470

----------
nosy: +pitrou
title: io.BufferedWriter does not observe buffer size limits -> make io.BufferedWriter observe max_buffer_size limits

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4428] make io.BufferedWriter observe max_buffer_size limits [ In reply to ]
Gregory P. Smith <greg@krypto.org> added the comment:

I know of no code relying on this behavior, I merely duplicated the
behavior that existed while writing the patch. I'm happy to simplify.
Adding Guido to the CC list for a pronouncement.

Guido is it okay to change io.BufferedWriter.write() in release30-maint
to no longer accept iterables that do not support len() and things that
do not support the buffer API?

Antoine already notes in the codereview that other existing io classes
such as FileIO currently do not support non bytes/buffer or buffer-api
supporting inputs: http://codereview.appspot.com/12470/patch/1/3

----------
nosy: +gvanrossum

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4428] make io.BufferedWriter observe max_buffer_size limits [ In reply to ]
Guido van Rossum <guido@python.org> added the comment:

@Gregory, that sounds like an odd enough use case to skip. However you
might want to look for __length_hint__ before giving up?

OTOH unless the use case is real, why not support it but making it slow?

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4428] make io.BufferedWriter observe max_buffer_size limits [ In reply to ]
Changes by Gregory P. Smith <greg@krypto.org>:


Added file: http://bugs.python.org/file12914/issue4428-io-bufwrite-gps05.diff

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4428] make io.BufferedWriter observe max_buffer_size limits [ In reply to ]
Gregory P. Smith <greg@krypto.org> added the comment:

I've uploaded a new patch set with more extensive unit tests. It also
handles the case of writing array.array objects (or anything with a
memoryview itemsize > 1). The previous code would buffer by item rather
than by byte. it has been updated in codereview as well.

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4428] make io.BufferedWriter observe max_buffer_size limits [ In reply to ]
Gregory P. Smith <greg@krypto.org> added the comment:

fwiw, I decided Guido and Antoine were right and took out the support
for input that did not support len() to keep things a bit simpler.

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4428>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com