Commit 92ca5455 authored by Armin Rigo's avatar Armin Rigo

What if you call lst.__init__() while it is being sorted? :-)

The invariant checks would break.
parent 258fa1b5
...@@ -2315,8 +2315,10 @@ list_init(PyListObject *self, PyObject *args, PyObject *kw) ...@@ -2315,8 +2315,10 @@ list_init(PyListObject *self, PyObject *args, PyObject *kw)
return -1; return -1;
/* Verify list invariants established by PyType_GenericAlloc() */ /* Verify list invariants established by PyType_GenericAlloc() */
assert(0 <= self->ob_size && self->ob_size <= self->allocated); assert(0 <= self->ob_size);
assert(self->ob_item != NULL || self->allocated == 0); assert(self->ob_size <= self->allocated || self->allocated == -1);
assert(self->ob_item != NULL ||
self->allocated == 0 || self->allocated == -1);
/* Empty previous contents */ /* Empty previous contents */
if (self->ob_item != NULL) { if (self->ob_item != NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment