Fix overflow with parameters > LONG_MAX with Python 3.

The typemap incorrectly called PyInt_AsLong() if PyInt_Check() passed, but
this check is the same as PyLong_Check() for Python 3 and so the correct
PyLong_AsUnsignedLong() function was never called. As a consequence, passing
any value greater than LONG_MAX (e.g. 0x87654321 on 32 bit architectures) to a
function taking unsigned int, unsigned long or size_t parameter failed with an
overflow error being generated.

Fix this by simply disabling the part of the code dealing with PyInts for
Python 3 as there is no distinction between PyInt and PyLong there any more.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13877 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vadim Zeitlin 2012-11-09 17:57:42 +00:00
commit 0ca11c8b6f
2 changed files with 8 additions and 1 deletions

View file

@ -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: