[Python-checkins] r87622 - python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal.c

stefan.krah python-checkins at python.org
Sun Jan 2 14:09:57 CET 2011


Author: stefan.krah
Date: Sun Jan  2 14:09:57 2011
New Revision: 87622

Log:
Do not continue after MPD_Malloc_error.

Modified:
   python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal.c

Modified: python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal.c
==============================================================================
--- python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal.c	(original)
+++ python/branches/py3k-cdecimal/Modules/cdecimal/mpdecimal.c	Sun Jan  2 14:09:57 2011
@@ -1615,11 +1615,12 @@
 	} /* fold down */
 	else if (ctx->clamp && dec->exp > mpd_etop(ctx)) {
 		shift = dec->exp - mpd_etop(ctx);
-		/* if shiftl fails, dec is NaN */
-		(void)mpd_qshiftl(dec, dec, shift, status);
+		if (!mpd_qshiftl(dec, dec, shift, status)) {
+			return;
+		}
 		dec->exp -= shift;
 		*status |= MPD_Clamped;
-		if (adjexp < ctx->emin) {
+		if (!mpd_iszerocoeff(dec) && adjexp < ctx->emin) {
 			*status |= MPD_Subnormal;
 		}
 	}
@@ -6932,7 +6933,7 @@
 		return;
 	}
 
-        _mpd_qinvroot(result, a, ctx, status);
+	_mpd_qinvroot(result, a, ctx, status);
 }
 
 /*


More information about the Python-checkins mailing list