diff options
author | Christian Tismer <tismer@stackless.com> | 2020-10-27 17:09:45 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2020-10-27 21:13:56 +0000 |
commit | 5de0db2391c719ef6c484813cc4aee61da355160 (patch) | |
tree | 93facde76f304de3118477d90163108e97018d09 /sources/shiboken2/libshiboken/voidptr.cpp | |
parent | dcced0742f383b1932d0e56323387fbd8aeb4513 (diff) |
remove traces of Python2 from C code
It will be assumed that Python is always Python 3.
All checks for Python 2 are removed.
This is the second part of cleaning up the C code
from references to Python 2.
Task-number: PYSIDE-904
Change-Id: I3006412c2a5bb65402101b0aac5a5f2fc79ce2f8
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/libshiboken/voidptr.cpp')
-rw-r--r-- | sources/shiboken2/libshiboken/voidptr.cpp | 38 |
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; } |