pyversion_compat.h revision 781d71db
1#include "Python.h"
2
3#if PY_VERSION_HEX < 0x02070000
4    #define PyMemoryView_FromBuffer(info) (PyErr_SetString(PyExc_NotImplementedError, \
5                    "new buffer interface is not available"), (PyObject *)NULL)
6    #define PyMemoryView_FromObject(object)     (PyErr_SetString(PyExc_NotImplementedError, \
7                                        "new buffer interface is not available"), (PyObject *)NULL)
8#endif
9
10#if PY_VERSION_HEX >= 0x03000000
11    // for buffers
12    #define Py_END_OF_BUFFER ((Py_ssize_t) 0)
13
14    #define PyObject_CheckReadBuffer(object) (0)
15
16    #define PyBuffer_FromMemory(ptr, s) (PyErr_SetString(PyExc_NotImplementedError, \
17                            "old buffer interface is not available"), (PyObject *)NULL)
18    #define PyBuffer_FromReadWriteMemory(ptr, s) (PyErr_SetString(PyExc_NotImplementedError, \
19                            "old buffer interface is not available"), (PyObject *)NULL)
20    #define PyBuffer_FromObject(object, offset, size)  (PyErr_SetString(PyExc_NotImplementedError, \
21                            "old buffer interface is not available"), (PyObject *)NULL)
22    #define PyBuffer_FromReadWriteObject(object, offset, size)  (PyErr_SetString(PyExc_NotImplementedError, \
23                            "old buffer interface is not available"), (PyObject *)NULL)
24
25#endif
26