From: Armin R. <ar...@us...> - 2004-06-22 18:47:09
|
Update of /cvsroot/psyco/psyco/c/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28277 Modified Files: pmath.c Log Message: Fix for psyco-devel bug report by Scott Snyder. Index: pmath.c =================================================================== RCS file: /cvsroot/psyco/psyco/c/Modules/pmath.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pmath.c 3 Sep 2003 19:57:56 -0000 1.7 --- pmath.c 22 Jun 2004 18:46:56 -0000 1.8 *************** *** 52,65 **** * on invalid args is different */ ! #define PMATH_CONVERT_TO_DOUBLE(vobj, v1, v2) \ switch (psyco_convert_to_double(po, vobj, &v1, &v2)) { \ case true: \ break; /* fine */ \ case false: \ ! return NULL; /* error or promotion */ \ default: \ PycException_SetString(po, PyExc_TypeError, \ "bad argument type for built-in operation"); \ ! return NULL; \ } --- 52,65 ---- * on invalid args is different */ ! #define PMATH_CONVERT_TO_DOUBLE(vobj, v1, v2, ERRORACTION) \ switch (psyco_convert_to_double(po, vobj, &v1, &v2)) { \ case true: \ break; /* fine */ \ case false: \ ! ERRORACTION; /* error or promotion */ \ default: \ PycException_SetString(po, PyExc_TypeError, \ "bad argument type for built-in operation"); \ ! ERRORACTION; \ } *************** *** 81,85 **** } \ v = PsycoTuple_GET_ITEM(varg, 0); \ ! PMATH_CONVERT_TO_DOUBLE(v,a1,a2); \ result = array_new(2); \ x = psyco_generic_call(po, cimpl_math_##func, CfPure|CfNoReturnValue|CfPyErrIfNonNull, \ --- 81,85 ---- } \ v = PsycoTuple_GET_ITEM(varg, 0); \ ! PMATH_CONVERT_TO_DOUBLE(v,a1,a2,return NULL); \ result = array_new(2); \ x = psyco_generic_call(po, cimpl_math_##func, CfPure|CfNoReturnValue|CfPyErrIfNonNull, \ *************** *** 107,112 **** v1 = PsycoTuple_GET_ITEM(varg, 0); \ v2 = PsycoTuple_GET_ITEM(varg, 1); \ ! PMATH_CONVERT_TO_DOUBLE(v1,a1,a2); \ ! PMATH_CONVERT_TO_DOUBLE(v2,b1,b2); \ result = array_new(2); \ x = psyco_generic_call(po, cimpl_math_##func, CfPure|CfNoReturnValue|CfPyErrIfNonNull, \ --- 107,112 ---- v1 = PsycoTuple_GET_ITEM(varg, 0); \ v2 = PsycoTuple_GET_ITEM(varg, 1); \ ! PMATH_CONVERT_TO_DOUBLE(v1,a1,a2,return NULL); \ ! PMATH_CONVERT_TO_DOUBLE(v2,b1,b2,goto cleanup); \ result = array_new(2); \ x = psyco_generic_call(po, cimpl_math_##func, CfPure|CfNoReturnValue|CfPyErrIfNonNull, \ *************** *** 118,121 **** --- 118,124 ---- array_release(result); \ return x; \ + cleanup:\ + PMATH_RELEASE_DOUBLE(a1,a2); \ + return NULL; \ } |