From: SourceForge.net <no...@so...> - 2012-07-16 18:55:39
|
Bugs item #3544716, was opened at 2012-07-16 11:55 Message generated for change (Tracker Item Submitted) made by rllewjones You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=3544716&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: python Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Russell Jones (rllewjones) Assigned to: Nobody/Anonymous (nobody) Summary: SWIG_AsVal_unsigned_SS_long does not work in python 3 Initial Comment: For values of 0x8000000 - 0xFFFFFFFF, SWIG_AsVal_unsigned_SS_long raises an overflow error in Python 3, when it should not. In python 3, ints and longs are the same, so PyInt_Check returns true for both. Therefore, the first code path in SWIG_AsVal_unsigned_SS_long is always taken, which calls PyInt_AsLong because it assumes that it is the old python 2 int type, which could never be greater than 0x7FFFFFFF. In python 2, we don't have to worry about values between 0x8000000 and 0xFFFFFFFF because these will always be of the PyLong type, so converting it to a long before converting it to an unsigned long is fine, but in python 3, this is not ok, as the PyInt functions are just redefined to be the PyLong functions. So we cannot assume that PyInt_Check returning true means that PyInt_AsLong will not overflow. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=3544716&group_id=1645 |