[Python-checkins] r75991 - python/trunk/Python/marshal.c

mark.dickinson python-checkins at python.org
Sat Oct 31 13:47:47 CET 2009


Author: mark.dickinson
Date: Sat Oct 31 13:47:47 2009
New Revision: 75991

Log:
Set retval on PyOS_string_to_double failure.

Modified:
   python/trunk/Python/marshal.c

Modified: python/trunk/Python/marshal.c
==============================================================================
--- python/trunk/Python/marshal.c	(original)
+++ python/trunk/Python/marshal.c	Sat Oct 31 13:47:47 2009
@@ -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;
 		}


More information about the Python-checkins mailing list