[Python-Dev] RE: test_sort.py failure (original) (raw)
Raymond Hettinger python at rcn.com
Thu Jul 29 12:06:19 CEST 2004
- Previous message: [Python-Dev] RE: test_sort.py failure
- Next message: [Python-Dev] RE: test_sort.py failure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I want to insist on documented invariants
Absolutely.
but I don't particularly care what they are.
Right. I just wanted to point out an alternative invariant that did not rely on knowledge of the ob_allocated field.
The idea that "list.obitem == NULL implies list.allocated may be lying" is at least as obscure as the invariant that broke, . . . There's no force working toward keeping knowledge of list.allocated confined to the two routines you originally taught about it, unless we believe listobject.c will never be changed again .
Okay. Those good reasons to prefer the invariants you just documented.
> * listassslice() should add a line to maintain them, > * listresize() can drop the test for obitem != NULL, and
Will put these in.
* tpnew needs a custom listnew() establishing the invariants.
> PyTypeGenericNew guarantees to zero-fill all the data space (there's nothing special about list.obitem in this respect -- the generic new has no idea there's a pointer in the struct, it simply zeroes out everything). That establishes the currently documented invariants.
Right. I remembered that after I sent the last note. Will add a comment in list_init so it doesn't get forgotten again.
Raymond
- Previous message: [Python-Dev] RE: test_sort.py failure
- Next message: [Python-Dev] RE: test_sort.py failure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]