diff Python/marshal.c @ 57010:4cbc3fe93671 legacy-trunk

Set retval on PyOS_string_to_double failure.
author Mark Dickinson <dickinsm@gmail.com>
date Sat, 31 Oct 2009 12:47:47 +0000
parents 140d88d1b179
children 86f699766016
line wrap: on
line diff
--- a/Python/marshal.c	Sat Oct 31 10:36:06 2009 +0000
+++ b/Python/marshal.c	Sat Oct 31 12:47:47 2009 +0000
@@ -699,8 +699,10 @@
 			}
 			buf[n] = '\0';
 			dx = PyOS_string_to_double(buf, NULL, NULL);
-			if (dx == -1.0 && PyErr_Occurred())
+			if (dx == -1.0 && PyErr_Occurred()) {
+				retval = NULL;
 				break;
+			}
 			retval = PyFloat_FromDouble(dx);
 			break;
 		}
@@ -738,8 +740,10 @@
 			}
 			buf[n] = '\0';
 			c.real = PyOS_string_to_double(buf, NULL, NULL);
-			if (c.real == -1.0 && PyErr_Occurred())
+			if (c.real == -1.0 && PyErr_Occurred()) {
+				retval = NULL;
 				break;
+			}
 			n = r_byte(p);
 			if (n == EOF || r_string(buf, (int)n, p) != n) {
 				PyErr_SetString(PyExc_EOFError,
@@ -749,8 +753,10 @@
 			}
 			buf[n] = '\0';
 			c.imag = PyOS_string_to_double(buf, NULL, NULL);
-			if (c.imag == -1.0 && PyErr_Occurred())
+			if (c.imag == -1.0 && PyErr_Occurred()) {
+				retval = NULL;
 				break;
+			}
 			retval = PyComplex_FromCComplex(c);
 			break;
 		}