]> granicus.if.org Git - python/commitdiff
What if you call lst.__init__() while it is being sorted? :-)
authorArmin Rigo <arigo@tunes.org>
Fri, 30 Jul 2004 11:20:18 +0000 (11:20 +0000)
committerArmin Rigo <arigo@tunes.org>
Fri, 30 Jul 2004 11:20:18 +0000 (11:20 +0000)
The invariant checks would break.

Objects/listobject.c

index 61edd45f3b0b1012d877c7cd2a6fdffb2abc306e..bd5b95a33c29fcbb4d3b746f1727c7fdefd8ff48 100644 (file)
@@ -2315,8 +2315,10 @@ list_init(PyListObject *self, PyObject *args, PyObject *kw)
                return -1;
 
        /* Verify list invariants established by PyType_GenericAlloc() */
-       assert(0 <= self->ob_size  &&  self->ob_size <= self->allocated);
-       assert(self->ob_item != NULL  ||  self->allocated == 0);
+       assert(0 <= self->ob_size);
+       assert(self->ob_size <= self->allocated || self->allocated == -1);
+       assert(self->ob_item != NULL ||
+              self->allocated == 0 || self->allocated == -1);
 
        /* Empty previous contents */
        if (self->ob_item != NULL) {