[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-24 Thread Xiang Zhang
Xiang Zhang added the comment: New changeset faa2cc63e45bc7d7ffab84bebe5a9f4fe065bd96 by Xiang Zhang in branch '3.6': bpo-28856: Let %b format for bytes support objects that follow the buffer protocol (GH-664) https://github.com/python/cpython/commit/faa2cc63e45bc7d7ffab84bebe5a9f4fe065bd96

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-24 Thread Xiang Zhang
Xiang Zhang added the comment: New changeset 7e2a54cdd977078b40b82182e46b201f8163f659 by Xiang Zhang in branch 'master': bpo-28856: Let %b format for bytes support objects that follow the buffer protocol (GH-546)

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-17 Thread Larry Hastings
Changes by Larry Hastings : -- pull_requests: +582 ___ Python tracker ___ ___

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-14 Thread Xiang Zhang
Xiang Zhang added the comment: I committed the suboptimal patch. I close this issue now and if there is any enhancement solution, let's make it another issue. Thank you all. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 3.5

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Following example copies the entire buffer object while copying only smart part is needed: m = memoryview(b'x'*10**6) b'%.100b' % m I don't know whether this is important use case that is worth an optimization. The workaround is using slicing

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-14 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +546 ___ Python tracker ___ ___ Python-bugs-list

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-13 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: @xiang.zhang - I am the OP for this issue, so naturally I expect this to be fixed. I have a work-around in place for my own code, so I have no opinion on the particular versions. I guess the normal policy on bug fixes should apply. --

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-13 Thread Ethan Furman
Ethan Furman added the comment: I suspect it was a simple oversight, and should be added now. Since it's been missing for so long I think we should put it in 3.7, maybe put it in 3.6 (maybe not, since it has two point releases out now), but definitely not in 3.5. --

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sometimes the implementation can expose drawbacks of initial design. I don't know whether there was good reason for omitting the support of the buffer protocol (in that case the PEP should be updated) or this is just an oversign. We should ask Ethan about

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-12 Thread Xiang Zhang
Xiang Zhang added the comment: What's your opinions Alexander and Ethan? -- ___ Python tracker ___ ___

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-07 Thread Stefan Krah
Stefan Krah added the comment: For '%b', it looks like the PEP supports it. I didn't follow the PEP discussions, I think Ethan will know more. -- ___ Python tracker

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-07 Thread Xiang Zhang
Xiang Zhang added the comment: Isn't this a discussed behaviour that is explicitly documented in PEP 461? -- ___ Python tracker ___

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: printf-style bytes formatting was added mainly for increasing compatibility with Python 2. It was restricted to support mostly features existing in Python 2. '%s' formatting in Python 3 supports bytes-like objects partially: >>> b'%s' % array('B', [1, 2])

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-07 Thread Xiang Zhang
Changes by Xiang Zhang : -- pull_requests: +449 ___ Python tracker ___ ___ Python-bugs-list

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2017-03-07 Thread Xiang Zhang
Changes by Xiang Zhang : -- components: +Interpreter Core stage: test needed -> patch review versions: +Python 3.5, Python 3.6, Python 3.7 ___ Python tracker

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2016-12-02 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +xiang.zhang ___ Python tracker ___ ___ Python-bugs-list

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2016-12-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +ethan.furman, serhiy.storchaka ___ Python tracker ___

[issue28856] %b format for bytes does not support objects that follow the buffer protocol

2016-12-01 Thread Alexander Belopolsky
New submission from Alexander Belopolsky: Python 3.7.0a0 (default:be70d64bbf88, Dec 1 2016, 21:21:25) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from array import array >>> a = array('B', [1,