Re: [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread Alexander Belopolsky
On Fri, Jan 6, 2017 at 4:43 PM, Serhiy Storchaka wrote: > Compare these two calls: >> >> from array import array > bytes(array('h', [1, 2, 3])) > b'\x01\x00\x02\x00\x03\x00' >> >> and >> >> bytes(array('f', [1, 2, 3])) >

Re: [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread Serhiy Storchaka
On 06.01.17 21:31, Alexander Belopolsky wrote: On Thu, Jan 5, 2017 at 5:54 PM, Serhiy Storchaka > wrote: On 05.01.17 22:37, Alexander Belopolsky wrote: 2. For 3.7, I would like to see a drastically simplified bytes(x): 2.1.

Re: [Python-Dev] enable-framework Vs. Naught

2017-01-06 Thread Terry Reedy
On 1/6/2017 12:39 PM, André Lemos wrote: I have a C++ module that I am compiling to use inside of my Python installation under Mac OS. If I compile & link it against a Framework enabled Python installation, it works fine, but if I compile & link it against a /non/ enabled Framework

Re: [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread Alexander Belopolsky
On Thu, Jan 5, 2017 at 5:54 PM, Serhiy Storchaka wrote: > On 05.01.17 22:37, Alexander Belopolsky wrote: > >> I propose the following: >> >> 1. For 3.6, restore and document 3.5 behavior. Recommend that 3rd party >> types that are both integer-like and buffer-like implement

[Python-Dev] enable-framework Vs. Naught

2017-01-06 Thread André Lemos
Hi, I have a C++ module that I am compiling to use inside of my Python installation under Mac OS. If I compile & link it against a Framework enabled Python installation, it works fine, but if I compile & link it against a *non* enabled Framework installation that we use for distribution, I

[Python-Dev] Summary of Python tracker Issues

2017-01-06 Thread Python tracker
ACTIVITY SUMMARY (2016-12-30 - 2017-01-06) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open5685 (+22) closed 35253 (+45) total 40938 (+67) Open issues

Re: [Python-Dev] Context manager lifetime rules Was: Re: Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread INADA Naoki
>> > with memoryview(x) as m: >> > b = bytes(m) >> > # or b = m.tobytes() >> >> Thinking more about this, and after looking at my own code in asyncpg >> and uvloop, I'm now in favor of adding bytes.frombuffer() with the >> proposed signature: ``bytes.frombuffer(byteslike, length=-1,

[Python-Dev] Context manager lifetime rules Was: Re: Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread Hans-Peter Jansen
Hi Yury, adjusted subject, since I'm dragging the discussion away from it. On Donnerstag, 5. Januar 2017 20:28:26 Yury Selivanov wrote: > On 2017-01-05 7:11 PM, INADA Naoki wrote: > >> bytes.frombuffer(x) is bytes(memoryview(x)) or memoryview(x).tobytes(). > > > > There is pitfall: memoryview

Re: [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread Antoine Pitrou
On Thu, 5 Jan 2017 20:28:26 -0500 Yury Selivanov wrote: > On 2017-01-05 7:11 PM, INADA Naoki wrote: > >> bytes.frombuffer(x) is bytes(memoryview(x)) or memoryview(x).tobytes(). > >> > > There is pitfall: memoryview should be closed. > > So b = bytes.frombuffer(x) is: >

Re: [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread INADA Naoki
> > Thinking more about this, and after looking at my own code in asyncpg and > uvloop, I'm now in favor of adding bytes.frombuffer() with the proposed > signature: ``bytes.frombuffer(byteslike, length=-1, offset=0)`` > Do you prefer a signature proposed first? I thought it from asyncio usage

Re: [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread INADA Naoki
I submit an issue about it. See https://bugs.python.org/issue29178 On Fri, Jan 6, 2017 at 7:38 PM, INADA Naoki wrote: >> >> Thinking more about this, and after looking at my own code in asyncpg and >> uvloop, I'm now in favor of adding bytes.frombuffer() with the