summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorTomáš Chvátal <tchvatal@suse.com>2015-12-22 17:38:41 +0100
committerMichael Stahl <mstahl@redhat.com>2016-01-07 13:48:45 +0000
commitc4c8543641c6dc3ea6b9373e9444c8a36b3fadc9 (patch)
tree363103ddf1ee3946afd5d685dd0b2759719aa5a3 /pyuno
parent1b436e4635a4567dcb5324ec4643b541caac8b26 (diff)
Pyuno add compat for python 2.6
Change-Id: I3e40a8006278b094d494820e6f47628c6579e78a Reviewed-on: https://gerrit.libreoffice.org/20883 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/21194
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/module/pyuno.cxx5
-rw-r--r--pyuno/source/module/pyuno_impl.hxx4
2 files changed, 9 insertions, 0 deletions
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 75f3507d31b1..1f11f3db78a8 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -325,9 +325,14 @@ sal_Int32 lcl_PyNumber_AsSal_Int32( PyObject *pObj )
// Convert Python number to platform long, then check actual value against
// bounds of sal_Int32
+#if PY_VERSION_HEX >= 0x02070000
int nOverflow;
long nResult = PyLong_AsLongAndOverflow( pObj, &nOverflow );
if ( nOverflow || nResult > SAL_MAX_INT32 || nResult < SAL_MIN_INT32) {
+#else
+ long nResult = PyLong_AsLong( pObj );
+ if ( nResult > SAL_MAX_INT32 || nResult < SAL_MIN_INT32) {
+#endif
PyErr_SetString( PyExc_IndexError, "Python int too large to convert to UNO long" );
return -1;
}
diff --git a/pyuno/source/module/pyuno_impl.hxx b/pyuno/source/module/pyuno_impl.hxx
index c5d8190989cf..39a0952361d9 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -26,6 +26,10 @@
#include <Python.h>
+#if PY_VERSION_HEX < 0x02070000
+typedef long Py_hash_t;
+#endif
+
//Must define PyVarObject_HEAD_INIT for Python 2.5 or older
#ifndef PyVarObject_HEAD_INIT
#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,