diff options
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r-- | Objects/bytesobject.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 1cfdbae..d786014 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -108,7 +108,11 @@ PyBytes_FromStringAndSize(const char *bytes, Py_ssize_t size) PyBytesObject *new; Py_ssize_t alloc; - assert(size >= 0); + if (size < 0) { + PyErr_SetString(PyExc_SystemError, + "Negative size passed to PyBytes_FromStringAndSize"); + return NULL; + } new = PyObject_New(PyBytesObject, &PyBytes_Type); if (new == NULL) |