[Python-checkins] r77713 - python/trunk/Python/dtoa.c

mark.dickinson python-checkins at python.org
Sat Jan 23 21:48:56 CET 2010


Author: mark.dickinson
Date: Sat Jan 23 21:48:56 2010
New Revision: 77713

Log:
Issue #7743:  Add checks for zero inputs to the lshift and mult functions;
this fixes the first bug described in issue #7743.


Modified:
   python/trunk/Python/dtoa.c

Modified: python/trunk/Python/dtoa.c
==============================================================================
--- python/trunk/Python/dtoa.c	(original)
+++ python/trunk/Python/dtoa.c	Sat Jan 23 21:48:56 2010
@@ -622,6 +622,15 @@
     ULong z2;
 #endif
 
+    if ((!a->x[0] && a->wds == 1) || (!b->x[0] && b->wds == 1)) {
+        c = Balloc(0);
+        if (c == NULL)
+            return NULL;
+        c->wds = 1;
+        c->x[0] = 0;
+        return c;
+    }
+
     if (a->wds < b->wds) {
         c = a;
         a = b;
@@ -820,6 +829,9 @@
     Bigint *b1;
     ULong *x, *x1, *xe, z;
 
+    if (!k || (!b->x[0] && b->wds == 1))
+        return b;
+
     n = k >> 5;
     k1 = b->k;
     n1 = n + b->wds + 1;


More information about the Python-checkins mailing list