diff --git a/CHANGES.current b/CHANGES.current index 9b6d456dd..db12bd864 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.5 (in progress) =========================== +2011-11-04: szager + [python] Bug 3429388: python unsigned integer handling on 32-bit architectures. + 2011-11-03: wsfulton Expand special variables in typemap warnings, eg: diff --git a/Lib/python/pyhead.swg b/Lib/python/pyhead.swg index 803cd0745..206b81a37 100644 --- a/Lib/python/pyhead.swg +++ b/Lib/python/pyhead.swg @@ -4,6 +4,7 @@ #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyInt_Check(x) PyLong_Check(x) #define PyInt_AsLong(x) PyLong_AsLong(x) +#define PyInt_AsUnsignedLongMask(x) PyLong_AsUnsignedLongMask(x) #define PyInt_FromLong(x) PyLong_FromLong(x) #define PyString_Check(name) PyBytes_Check(name) #define PyString_FromString(x) PyUnicode_FromString(x) diff --git a/Lib/python/pyprimtypes.swg b/Lib/python/pyprimtypes.swg index aa5ddaf62..43a3375b7 100644 --- a/Lib/python/pyprimtypes.swg +++ b/Lib/python/pyprimtypes.swg @@ -100,13 +100,12 @@ SWIGINTERN int SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val) { if (PyInt_Check(obj)) { - long v = PyInt_AsLong(obj); - if (v >= 0) { + unsigned long v = PyInt_AsUnsignedLongMask(obj); + if (!PyErr_Occurred()) { if (val) *val = v; return SWIG_OK; - } else { - return SWIG_OverflowError; } + PyErr_Clear(); } else if (PyLong_Check(obj)) { unsigned long v = PyLong_AsUnsignedLong(obj); if (!PyErr_Occurred()) {