add NULL checking for PyBytes_FromObject; R=Neal

This commit is contained in:
Benjamin Peterson 2008-08-27 00:28:34 +00:00
parent f4ff4702a8
commit 4b24a42f3c
1 changed files with 5 additions and 0 deletions

View File

@ -2932,6 +2932,11 @@ PyBytes_FromObject(PyObject *x)
PyObject *new, *it; PyObject *new, *it;
Py_ssize_t i, size; Py_ssize_t i, size;
if (x == NULL) {
PyErr_BadInternalCall();
return NULL;
}
/* Is it an int? */ /* Is it an int? */
size = PyNumber_AsSsize_t(x, PyExc_ValueError); size = PyNumber_AsSsize_t(x, PyExc_ValueError);
if (size == -1 && PyErr_Occurred()) { if (size == -1 && PyErr_Occurred()) {