diff Objects/bytesobject.c @ 48879:d9fe29e95d60

add NULL checking for PyBytes_FromObject; R=Neal
author Benjamin Peterson <benjamin@python.org>
date Wed, 27 Aug 2008 00:28:34 +0000
parents 548dccc4008e
children 86893a397dd0
line wrap: on
line diff
--- a/Objects/bytesobject.c	Tue Aug 26 22:44:20 2008 +0000
+++ b/Objects/bytesobject.c	Wed Aug 27 00:28:34 2008 +0000
@@ -2932,6 +2932,11 @@
 	PyObject *new, *it;
 	Py_ssize_t i, size;
 
+	if (x == NULL) {
+		PyErr_BadInternalCall();
+		return NULL;
+	}
+
 	/* Is it an int? */
 	size = PyNumber_AsSsize_t(x, PyExc_ValueError);
 	if (size == -1 && PyErr_Occurred()) {