[issue27704] bytes(x) is slow when x is bytearray

2016-08-15 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker

[issue27704] bytes(x) is slow when x is bytearray

2016-08-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your contribution Naoki. -- ___ Python tracker ___ ___

[issue27704] bytes(x) is slow when x is bytearray

2016-08-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset 789a42401009 by Serhiy Storchaka in branch 'default': Issue #27704: Optimized creating bytes and bytearray from byte-like objects https://hg.python.org/cpython/rev/789a42401009 -- nosy: +python-dev ___

[issue27704] bytes(x) is slow when x is bytearray

2016-08-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. -- assignee: -> serhiy.storchaka stage: -> commit review ___ Python tracker ___

[issue27704] bytes(x) is slow when x is bytearray

2016-08-09 Thread INADA Naoki
INADA Naoki added the comment: Thanks for comments. -- Added file: http://bugs.python.org/file44059/fast-bytearray-fromobject.patch ___ Python tracker

[issue27704] bytes(x) is slow when x is bytearray

2016-08-09 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Hi Serhiy Thank you for your feedback. Stephane -- ___ Python tracker ___

[issue27704] bytes(x) is slow when x is bytearray

2016-08-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: bytearray suffers from the same issue. It would be nice to optimize it too. -- nosy: +serhiy.storchaka ___ Python tracker

[issue27704] bytes(x) is slow when x is bytearray

2016-08-07 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: the patch seems to be fine. -- nosy: +haypo, matrixise ___ Python tracker ___

[issue27704] bytes(x) is slow when x is bytearray

2016-08-07 Thread INADA Naoki
New submission from INADA Naoki: When bytes(x), bytes_new checks if x is integer via PyNumber_AsSize_t(x). It cause TypeError internally. When x is not an integer, especially bytearray or memoryview, the internal exception cause significant overhead. # HEAD $ ./python -m timeit -s