[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-12-03 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Thank you Gregory for the review! Committed to r59314. -- resolution: -> accepted status: open -> closed __ Tracker <[EMAIL PROTECTED]> __ ___

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-12-02 Thread Gregory P. Smith
Gregory P. Smith added the comment: reading 5.patch over... Any particular reason for using buf_size = 32 when the length isn't known up front? add a comment saying why (or that its just a magic guess). anyways it sounds like a fine starting value. picking anything "better" would require prof

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-12-02 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Done. Is there any other issue with the patch? Added file: http://bugs.python.org/file8857/byte_extend-5.patch __ Tracker <[EMAIL PROTECTED]> __Index: Objec

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-12-02 Thread Gregory P. Smith
Gregory P. Smith added the comment: "There is still another possible leak if the PyMem_Realloc return NULL (i.e., the system is out of memory), but I don't think it worth fixing." Do it. It looks easy: a Py_DECREF(it) before the return PyErr_NoMemory(). __ Track

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-12-02 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Here yet another revision of the patch. This one makes bytearray.extend() try to determine the length of its argument a bit more aggressively -- i.e., also uses PyObject_Length(). Added file: http://bugs.python.org/file8856/byte_extend-4.patch _

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-12-01 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: There is a reference leak in my previous patches. So, I updated (again) the patch. There is still another possible leak if the PyMem_Realloc return NULL (i.e., the system is out of memory), but I don't think it worth fixing. Added file: http://bugs.python.

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-12-01 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Made 2 minor enhancements to the patch: + Added the proper type-cast to PyMem_Realloc call. + Changed (len >> 1) to (len >> 1) + 1, just to be sure that the buffer doesn't overflow if __length_hint__ return 0 or 1 erroneously. Added file: http://bug

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-12-01 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Here a patch that adds support for any iterable (or sequence) of integers to bytearray.extend(). -- assignee: -> alexandre.vassalotti keywords: +patch nosy: +alexandre.vassalotti resolution: accepted -> Added file: http://bugs.python.org/file8847

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-11-08 Thread Christian Heimes
Changes by Christian Heimes: -- components: +Interpreter Core priority: -> low resolution: -> accepted type: -> rfe __ Tracker <[EMAIL PROTECTED]> __ ___

[issue1283] PyBytes (buffer) .extend method needs to accept any iterable of ints

2007-10-15 Thread Gregory P. Smith
New submission from Gregory P. Smith: The PyBytes (pep3137 buffer) .extend() method currently only accepts as input something supporting the pep3118 buffer API. It also needs to accept an iterable of ints in the 0..255 range. -- keywords: py3k messages: 56478 nosy: gregory.p.smith sever