From: <ol...@us...> - 2007-09-17 23:52:17
|
Revision: 9938 http://swig.svn.sourceforge.net/swig/?rev=9938&view=rev Author: olly Date: 2007-09-17 16:52:16 -0700 (Mon, 17 Sep 2007) Log Message: ----------- [python] Simpler code for SWIG_AsVal_bool() which fixes a "strict aliasing" warning from GCC - patch from SF#1724581 by Andrew Baumann. Modified Paths: -------------- trunk/CHANGES.current trunk/Lib/python/pyprimtypes.swg Modified: trunk/CHANGES.current =================================================================== --- trunk/CHANGES.current 2007-09-17 23:24:11 UTC (rev 9937) +++ trunk/CHANGES.current 2007-09-17 23:52:16 UTC (rev 9938) @@ -2,6 +2,11 @@ ============================ 09/17/2007: olly + [python] Simpler code for SWIG_AsVal_bool() which fixes a "strict + aliasing" warning from GCC - patch from SF#1724581 by Andrew + Baumann. + +09/17/2007: olly [perl5] Use sv_setpvn() to set a scalar from a pointer and length - patch from SF#174460 by "matsubaray". Modified: trunk/Lib/python/pyprimtypes.swg =================================================================== --- trunk/Lib/python/pyprimtypes.swg 2007-09-17 23:24:11 UTC (rev 9937) +++ trunk/Lib/python/pyprimtypes.swg 2007-09-17 23:52:16 UTC (rev 9938) @@ -17,18 +17,11 @@ SWIGINTERN int SWIG_AsVal_dec(bool)(PyObject *obj, bool *val) { - if (obj == Py_True) { - if (val) *val = true; - return SWIG_OK; - } else if (obj == Py_False) { - if (val) *val = false; - return SWIG_OK; - } else { - long v = 0; - int res = SWIG_AddCast(SWIG_AsVal(long)(obj, val ? &v : 0)); - if (SWIG_IsOK(res) && val) *val = v ? true : false; - return res; - } + int r = PyObject_IsTrue(obj); + if (r == -1) + return SWIG_ERROR; + if (val) *val = r ? true : false; + return SWIG_OK; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |