diff options
Diffstat (limited to 'siplib/sip-tqt.h')
-rw-r--r-- | siplib/sip-tqt.h | 94 |
1 files changed, 2 insertions, 92 deletions
diff --git a/siplib/sip-tqt.h b/siplib/sip-tqt.h index e3a306f..7fb0bb5 100644 --- a/siplib/sip-tqt.h +++ b/siplib/sip-tqt.h @@ -46,8 +46,8 @@ extern "C" { /* Sanity check on the Python version. */ -#if PY_VERSION_HEX < 0x02030000 -#error "This version of SIP-TQt requires Python v2.3 or later" +#if PY_VERSION_HEX < 0x03020000 +#error "This version of SIP-TQt requires Python v3.2 or later" #endif @@ -178,63 +178,12 @@ extern "C" { #endif -/* Some Python compatibility stuff. */ -#if PY_VERSION_HEX >= 0x02050000 - #define SIP_SSIZE_T Py_ssize_t #define SIP_MLNAME_CAST(s) (s) #define SIP_MLDOC_CAST(s) (s) #define SIP_TPNAME_CAST(s) (s) -#else - -#define SIP_SSIZE_T int - -#define SIP_MLNAME_CAST(s) ((char *)(s)) -#define SIP_MLDOC_CAST(s) ((char *)(s)) -#define SIP_TPNAME_CAST(s) ((char *)(s)) - -#endif - -#if PY_MAJOR_VERSION >= 3 - -#define SIPLong_FromLong PyLong_FromLong -#define SIPLong_AsLong PyLong_AsLong - -#define SIPBytes_Check PyBytes_Check -#define SIPBytes_FromString PyBytes_FromString -#define SIPBytes_FromStringAndSize PyBytes_FromStringAndSize -#define SIPBytes_AS_STRING PyBytes_AS_STRING -#define SIPBytes_GET_SIZE PyBytes_GET_SIZE - -#if (PY_MAJOR_VERSION > 3) || ((PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION >= 1)) -#define SIP_USE_PYCAPSULE -#endif - -#if (PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION < 2) -#define SIP_SUPPORT_PYCOBJECT -#endif - -#else - -#define SIPLong_FromLong PyInt_FromLong -#define SIPLong_AsLong PyInt_AsLong - -#define SIPBytes_Check PyString_Check -#define SIPBytes_FromString PyString_FromString -#define SIPBytes_FromStringAndSize PyString_FromStringAndSize -#define SIPBytes_AS_STRING PyString_AS_STRING -#define SIPBytes_GET_SIZE PyString_GET_SIZE - -#if PY_MINOR_VERSION >= 7 -#define SIP_USE_PYCAPSULE -#endif - -#define SIP_SUPPORT_PYCOBJECT - -#endif - #if !defined(Py_REFCNT) #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #endif @@ -371,13 +320,8 @@ typedef void *(*sipInitFunc)(sipSimpleWrapper *, PyObject *, PyObject *, PyObject **, PyObject **, PyObject **); typedef int (*sipTraverseFunc)(void *, visitproc, void *); typedef int (*sipClearFunc)(void *); -#if PY_MAJOR_VERSION >= 3 typedef int (*sipGetBufferFunc)(PyObject *, void *, Py_buffer *, int); typedef void (*sipReleaseBufferFunc)(PyObject *, void *, Py_buffer *); -#else -typedef SIP_SSIZE_T (*sipBufferFunc)(PyObject *, void *, SIP_SSIZE_T, void **); -typedef SIP_SSIZE_T (*sipSegCountFunc)(PyObject *, void *, SIP_SSIZE_T *); -#endif typedef void (*sipDeallocFunc)(sipSimpleWrapper *); typedef void *(*sipCastFunc)(void *, const struct _sipTypeDef *); typedef const struct _sipTypeDef *(*sipSubClassConvertFunc)(void **); @@ -509,9 +453,6 @@ typedef enum { typedef enum { str_slot, /* __str__ */ int_slot, /* __int__ */ -#if PY_MAJOR_VERSION < 3 - long_slot, /* __long__ */ -#endif float_slot, /* __float__ */ len_slot, /* __len__ */ contains_slot, /* __contains__ */ @@ -554,18 +495,13 @@ typedef enum { ne_slot, /* __ne__ */ gt_slot, /* __gt__ */ ge_slot, /* __ge__ */ -#if PY_MAJOR_VERSION < 3 - cmp_slot, /* __cmp__ */ -#endif bool_slot, /* __bool__, __nonzero__ */ neg_slot, /* __neg__ */ repr_slot, /* __repr__ */ hash_slot, /* __hash__ */ pos_slot, /* __pos__ */ abs_slot, /* __abs__ */ -#if PY_VERSION_HEX >= 0x02050000 index_slot, /* __index__ */ -#endif iter_slot, /* __iter__ */ next_slot, /* __next__ */ } sipPySlotType; @@ -736,25 +672,11 @@ typedef struct _sipClassTypeDef { /* The clear function. */ sipClearFunc ctd_clear; -#if PY_MAJOR_VERSION >= 3 /* The get buffer function. */ sipGetBufferFunc ctd_getbuffer; /* The release buffer function. */ sipReleaseBufferFunc ctd_releasebuffer; -#else - /* The read buffer function. */ - sipBufferFunc ctd_readbuffer; - - /* The write buffer function. */ - sipBufferFunc ctd_writebuffer; - - /* The segment count function. */ - sipSegCountFunc ctd_segcount; - - /* The char buffer function. */ - sipBufferFunc ctd_charbuffer; -#endif /* The deallocation function. */ sipDeallocFunc ctd_dealloc; @@ -1196,11 +1118,6 @@ typedef struct _sipPyMethod { /* Self if it is a bound method. */ PyObject *mself; - -#if PY_MAJOR_VERSION < 3 - /* The class. */ - PyObject *mclass; -#endif } sipPyMethod; @@ -1474,16 +1391,9 @@ typedef struct _sipTQtAPI { #define sipIsExactWrappedType(wt) (sipTypeAsPyTypeObject((wt)->type) == (PyTypeObject *)(wt)) -#if PY_VERSION_HEX >= 0x03020000 #define sipConvertFromSliceObject(o,len,start,stop,step,slen) \ PySlice_GetIndicesEx((o), (len), (start), (stop), \ (step), (slen)) -#else -#define sipConvertFromSliceObject(o,len,start,stop,step,slen) \ - PySlice_GetIndicesEx((PySliceObject *)(o), (len), (start), (stop), \ - (step), (slen)) -#endif - /* * The following are deprecated parts of the public API. |