diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-03-29 17:54:04 -0300 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-03-30 17:41:39 -0300 |
commit | 8af03b6247eb8620ebc91bed8006206a70e24d79 (patch) | |
tree | b64bae7361fa07f39becee1833d3bbfd0a314efa /libshiboken/basewrapper.h | |
parent | e5d554bb614ab0c1a9c057d2d191cb62b3355a82 (diff) |
Move all python2.5 compatibility code to a separate header.
Diffstat (limited to 'libshiboken/basewrapper.h')
-rw-r--r-- | libshiboken/basewrapper.h | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h index f192928a6..c3fd926d1 100644 --- a/libshiboken/basewrapper.h +++ b/libshiboken/basewrapper.h @@ -36,6 +36,7 @@ #define BASEWRAPPER_H #include <Python.h> +#include "python25compat.h" #include "bindingmanager.h" #include <list> #include <map> @@ -189,54 +190,6 @@ inline bool isShibokenType(const PyObject* pyObj) #define SbkBaseWrapper_validCppObject(pyobj) (((Shiboken::SbkBaseWrapper*)pyobj)->validCppObject) #define SbkBaseWrapper_setValidCppObject(pyobj,v) (((Shiboken::SbkBaseWrapper*)pyobj)->validCppObject = v) -/* The #defines below were taken from Cython-generated code to allow shiboken to be used with python2.5. - * Maybe not all of these defines are useful to us, time will tell which ones are really needed or not. - */ - -#if PY_VERSION_HEX < 0x02060000 -#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) -#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) -#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) -#define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, -#define PyType_Modified(t) - -typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; -} Py_buffer; - -#define PyBUF_SIMPLE 0 -#define PyBUF_WRITABLE 0x0001 -#define PyBUF_LOCK 0x0002 -#define PyBUF_FORMAT 0x0004 -#define PyBUF_ND 0x0008 -#define PyBUF_STRIDES (0x0010 | PyBUF_ND) -#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) -#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) -#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) -#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - -#endif -#if PY_MAJOR_VERSION < 3 -#define __Pyx_BUILTIN_MODULE_NAME "__builtin__" -#else -#define __Pyx_BUILTIN_MODULE_NAME "builtins" -#endif - -#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) -#define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif - LIBSHIBOKEN_API PyAPI_FUNC(PyObject*) SbkBaseWrapper_New(SbkBaseWrapperType* instanceType, void* cptr, |