mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
add NULL checking for PyBytes_FromObject; R=Neal
This commit is contained in:
parent
f4ff4702a8
commit
4b24a42f3c
1 changed files with 5 additions and 0 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue