summaryrefslogtreecommitdiffstats
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-27 00:28:34 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-27 00:28:34 (GMT)
commit4b24a42f3c72b4f88da8989a77a175e654dbdcbb (patch)
treed243a11417cb65b9a93711c95b722f7e3b27ae4b /Objects/bytesobject.c
parentf4ff4702a87a0c1e6169d7c58612b3e6a04df8c3 (diff)
downloadcpython-4b24a42f3c72b4f88da8989a77a175e654dbdcbb.zip
cpython-4b24a42f3c72b4f88da8989a77a175e654dbdcbb.tar.gz
cpython-4b24a42f3c72b4f88da8989a77a175e654dbdcbb.tar.bz2
add NULL checking for PyBytes_FromObject; R=Neal
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r--Objects/bytesobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 3bda6d9..e924e8d 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -2932,6 +2932,11 @@ PyBytes_FromObject(PyObject *x)
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()) {