> > bytes.frombuffer(x) is bytes(memoryview(x)) or memoryview(x).tobytes(). >
There is pitfall: memoryview should be closed.
So b = bytes.frombuffer(x) is:
with memoryview(x) as m:
b = bytes(m)
# or b = m.tobytes()
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
