aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken/voidptr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/libshiboken/voidptr.cpp')
-rw-r--r--sources/shiboken2/libshiboken/voidptr.cpp38
1 files changed, 0 insertions, 38 deletions
diff --git a/sources/shiboken2/libshiboken/voidptr.cpp b/sources/shiboken2/libshiboken/voidptr.cpp
index a21a4482f..1ef1aea09 100644
--- a/sources/shiboken2/libshiboken/voidptr.cpp
+++ b/sources/shiboken2/libshiboken/voidptr.cpp
@@ -280,44 +280,11 @@ static int SbkVoidPtrObject_getbuffer(PyObject *obj, Py_buffer *view, int flags)
return 0;
}
-#if PY_VERSION_HEX < 0x03000000
-
-static Py_ssize_t SbkVoidPtrObject_readbufferproc(PyObject *self, Py_ssize_t segment, void **ptrptr)
-{
- if (segment || !Shiboken::Object::isValid(self))
- return -1;
-
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
- *ptrptr = reinterpret_cast<void *>(sbkObject->cptr);
- return sbkObject->size;
-}
-
-static Py_ssize_t SbkVoidPtrObject_segcountproc(PyObject *self, Py_ssize_t *lenp)
-{
- if (lenp) {
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
- *lenp = sbkObject->size;
- }
- return 1;
-}
-
-PyBufferProcs SbkVoidPtrObjectBufferProc = {
- &SbkVoidPtrObject_readbufferproc, // bf_getreadbuffer
- (writebufferproc)&SbkVoidPtrObject_readbufferproc, // bf_getwritebuffer
- &SbkVoidPtrObject_segcountproc, // bf_getsegcount
- (charbufferproc)&SbkVoidPtrObject_readbufferproc, // bf_getcharbuffer
- (getbufferproc)SbkVoidPtrObject_getbuffer, // bf_getbuffer
-};
-
-#else
-
static PyBufferProcs SbkVoidPtrObjectBufferProc = {
(getbufferproc)SbkVoidPtrObject_getbuffer, // bf_getbuffer
(releasebufferproc)nullptr // bf_releasebuffer
};
-#endif
-
// Void pointer type definition.
static PyType_Slot SbkVoidPtrType_slots[] = {
{Py_tp_repr, (void *)SbkVoidPtrObject_repr},
@@ -347,12 +314,7 @@ PyTypeObject *SbkVoidPtrTypeF(void)
static PyTypeObject *type = nullptr;
if (!type) {
type = reinterpret_cast<PyTypeObject *>(SbkType_FromSpec(&SbkVoidPtrType_spec));
-#if PY_VERSION_HEX < 0x03000000
- type->tp_as_buffer = &SbkVoidPtrObjectBufferProc;
- type->tp_flags |= Py_TPFLAGS_HAVE_NEWBUFFER;
-#else
PepType_AS_BUFFER(type) = &SbkVoidPtrObjectBufferProc;
-#endif
}
return type;
}