diff options
author | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2019-02-27 16:54:31 +0100 |
---|---|---|
committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2019-03-15 16:47:46 +0000 |
commit | 45e3c96a8075d210b70eabdb2ef9c3f7f1ca17af (patch) | |
tree | 640e32355745259489fabcf7834c599cf717178d /testing | |
parent | 264f7fccaffa79d947b872a8179993ef547e069c (diff) |
Add toBytes() and BufferProtocol
VoidPtr:
Add toBytes() method that return a char* representation
of the void* pointer.
QByteArray:
The current implementation only provided the Buffer Protocol
for Python2, this patch includes the getbuffer implementation
for Python3.
Having a BufferProtocol implementation for Python3 allows the
initialization of VoidPtr to get access to the internal content,
so one can go back and forward with the representation of it:
ba = QByteArray(b"Hello World")
vp = VoidPtr(ba, ba.size())
vp.toBytes() # b"Hello World"
The BufferProtocol was also changed for Python2 including the new
buffer protocol (Py_TPFLAGS_HAVE_NEWBUFFER) function `bf_getbuffer`.
A test case was included.
Fixes: PYSIDE-934
Change-Id: I8936966da91b2dcc879c582cfc35e6a35f7a60b6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'testing')
0 files changed, 0 insertions, 0 deletions