forked from pool/python
16 lines
494 B
Diff
16 lines
494 B
Diff
--- python/trunk/Objects/stringobject.c 2008/03/26 12:49:49 61936
|
|
+++ python/trunk/Objects/stringobject.c 2008/04/10 19:50:36 62271
|
|
@@ -55,7 +55,11 @@
|
|
PyString_FromStringAndSize(const char *str, Py_ssize_t size)
|
|
{
|
|
register PyStringObject *op;
|
|
- assert(size >= 0);
|
|
+ if (size < 0) {
|
|
+ PyErr_SetString(PyExc_SystemError,
|
|
+ "Negative size passed to PyString_FromStringAndSize");
|
|
+ return NULL;
|
|
+ }
|
|
if (size == 0 && (op = nullstring) != NULL) {
|
|
#ifdef COUNT_ALLOCS
|
|
null_strings++;
|