Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b24a42

Browse files
committed
add NULL checking for PyBytes_FromObject; R=Neal
1 parent f4ff470 commit 4b24a42

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Objects/bytesobject.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,6 +2932,11 @@ PyBytes_FromObject(PyObject *x)
29322932
PyObject *new, *it;
29332933
Py_ssize_t i, size;
29342934

2935+
if (x == NULL) {
2936+
PyErr_BadInternalCall();
2937+
return NULL;
2938+
}
2939+
29352940
/* Is it an int? */
29362941
size = PyNumber_AsSsize_t(x, PyExc_ValueError);
29372942
if (size == -1 && PyErr_Occurred()) {

0 commit comments

Comments
 (0)