diff --git a/CHANGES.current b/CHANGES.current index d36e76d62..913951fec 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -4,6 +4,10 @@ See the RELEASENOTES file for a summary of changes in each release. Version 2.0.9 (in progress) =========================== + +2012-11-09: vzeitlin + [Python] Fix overflow when passing values greater than LONG_MAX from Python 3 for parameters with unsigned long C type. + 2012-10-26: wsfulton Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously the name was ignored during the typemap search. Applies to the following list of typemaps: diff --git a/Lib/python/pyprimtypes.swg b/Lib/python/pyprimtypes.swg index 290f9312f..3fbd86a21 100644 --- a/Lib/python/pyprimtypes.swg +++ b/Lib/python/pyprimtypes.swg @@ -109,6 +109,7 @@ SWIG_From_dec(unsigned long)(unsigned long value) SWIGINTERN int SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val) { +%#if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(obj)) { long v = PyInt_AsLong(obj); if (v >= 0) { @@ -117,7 +118,9 @@ SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val) } else { return SWIG_OverflowError; } - } else if (PyLong_Check(obj)) { + } else +%#endif + if (PyLong_Check(obj)) { unsigned long v = PyLong_AsUnsignedLong(obj); if (!PyErr_Occurred()) { if (val) *val = v;