diff options
| author | Stefan Behnel <stefan_ml@behnel.de> | 2012-11-30 10:40:28 +0100 |
|---|---|---|
| committer | Stefan Behnel <stefan_ml@behnel.de> | 2012-11-30 10:40:28 +0100 |
| commit | 1c3788b6f4dfed314cc6068f6aed8ff8eeb74c83 (patch) | |
| tree | d97984d6ef76fb15f52d2ab84d681da88f034c4e | |
| parent | f120adca97bf288b35d72f22750601ecdd2f262a (diff) | |
| download | python-lxml-1c3788b6f4dfed314cc6068f6aed8ff8eeb74c83.tar.gz | |
fix signature of PySlice_GetIndicesEx() in recent Python versions (3.2+)
| -rw-r--r-- | src/lxml/includes/etree_defs.h | 7 | ||||
| -rw-r--r-- | src/lxml/python.pxd | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/lxml/includes/etree_defs.h b/src/lxml/includes/etree_defs.h index ff596ce8..b66dad4b 100644 --- a/src/lxml/includes/etree_defs.h +++ b/src/lxml/includes/etree_defs.h @@ -65,6 +65,13 @@ #endif #endif +/* PySlice_GetIndicesEx() has wrong signature in Py<=3.1 */ +#if PY_VERSION_HEX >= 0x03020000 +# define _lx_PySlice_GetIndicesEx(o, l, b, e, s, sl) PySlice_GetIndicesEx(o, l, b, e, s, sl) +#else +# define _lx_PySlice_GetIndicesEx(o, l, b, e, s, sl) PySlice_GetIndicesEx(((PySliceObject*)o), l, b, e, s, sl) +#endif + #ifdef WITHOUT_THREADING # define PyEval_SaveThread() (NULL) # define PyEval_RestoreThread(state) diff --git a/src/lxml/python.pxd b/src/lxml/python.pxd index 36995645..99e19ad9 100644 --- a/src/lxml/python.pxd +++ b/src/lxml/python.pxd @@ -74,13 +74,11 @@ cdef extern from "Python.h": cdef bint PyTuple_CheckExact(object instance) cdef bint PySlice_Check(object instance) - ctypedef class __builtin__.slice [object PySliceObject]: - pass - cdef int _PyEval_SliceIndex(object value, Py_ssize_t* index) except 0 - cdef int PySlice_GetIndicesEx(slice slice, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, - Py_ssize_t *slicelength) except -1 + cdef int PySlice_GetIndicesEx "_lx_PySlice_GetIndicesEx" ( + object slice, Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, + Py_ssize_t *slicelength) except -1 cdef object PyObject_RichCompare(object o1, object o2, int op) cdef int PyObject_RichCompareBool(object o1, object o2, int op) |
