[Python-Dev] RE: test_sort.py failure (original) (raw)
Armin Rigo arigo at tunes.org
Thu Jul 29 11:33:55 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 ]
Hello Tim,
On Thu, Jul 29, 2004 at 12:11:31AM -0400, Tim Peters wrote:
It's checked in now.
Unfortunately it is not true that ob_item can never be set to NULL with normal
list operations. list_ass_slice() and list_inplace_repeat() can both do that.
The former is not so rare as it is used e.g. for 'del lst[:]'.
The invariants of the ob_xxx list members should be clearly specified somewhere and we should stick to them. E.g. it is unclear to me why we allow list_ass_slice() to reset ob_item to NULL and ob_size to 0 without resetting ob_allocated to 0 -- I see why it doesn't crash in a subsequent list_resize(), but it looks messy.
Alternatively, the quickest fix for the broken listsort() would have been to keep the empty_ob_item hack but just check that ob_allocated is still zero in addition to ob_size. However the current version is quite clean and can be made bulletproof by ensuring that ob_item is never reset to NULL.
A bientot,
Armin.
- 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 ]