[Python-Dev] Re: [Python-checkins] python/dist/src/Objectslistobject.c, 2.176, 2.177 (original) (raw)
Tim Peters tim.one at comcast.net
Sun Jan 18 16:51:24 EST 2004
- Previous message: [Python-Dev] Re: [Python-checkins] python/dist/src/Objects listobject.c, 2.176, 2.177
- Next message: [Python-Dev] Fwd: Want to have S E X, 20 times a day ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Hye-Shik Chang]
Thanks for the explanation. But listobject isn't using realloc
To the contrary, listobject uses realloc() a lot, but that doesn't matter here. empty_ob_item has to be a unique pointer value so that the later
if (self->ob_item != empty_ob_item || self->ob_size) {
/* The user mucked with the list during the sort. */
error check is robust. The C standard doesn't promise much about malloc(0), but it does promise that pointers returned by distinct malloc(0) calls are non-equal so long as none have been passed to free(). In contrast, all NULL pointers must compare equal. If empty_ob_item were NULL, and user code (e.g.) added something to the list during sorting, then managed to NULL it out again, the error check about couldn't catch that.
In any case, the patch you're talking about was simply reverting a change I made by mistake, and the restored code has been there forever. Ain't broke, don't fix .
- Previous message: [Python-Dev] Re: [Python-checkins] python/dist/src/Objects listobject.c, 2.176, 2.177
- Next message: [Python-Dev] Fwd: Want to have S E X, 20 times a day ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]