summaryrefslogtreecommitdiffstats
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r--Objects/bytesobject.c6
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)