diff options
author | Armin Rigo <arigo@tunes.org> | 2004-07-30 11:20:18 (GMT) |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2004-07-30 11:20:18 (GMT) |
commit | a37bbf2e5bf9d0854a774cdd1a972d0b7cc9e733 (patch) | |
tree | 27cbe2d9013b1a704f5b21144ca3916db1bc9617 /Objects | |
parent | c0aaa2db4f7c33c490f91d00c894ffa6395c74fc (diff) | |
download | cpython-a37bbf2e5bf9d0854a774cdd1a972d0b7cc9e733.zip cpython-a37bbf2e5bf9d0854a774cdd1a972d0b7cc9e733.tar.gz cpython-a37bbf2e5bf9d0854a774cdd1a972d0b7cc9e733.tar.bz2 |
What if you call lst.__init__() while it is being sorted? :-)
The invariant checks would break.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 61edd45..bd5b95a 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -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) { |