• Tim Peters's avatar
    Armin asked for a list_ass_slice review in his checkin, so here's the · 8d9eb10c
    Tim Peters yazdı
    result.
    
    list_resize():  Document the intent.  Code is increasingly relying on
    subtle aspects of its behavior, and they deserve to be spelled out.
    
    list_ass_slice():  A bit more simplification, by giving it a common
    error exit and initializing more values.
    
    Be clearer in comments about what "size" means (# of elements?  # of
    bytes?).
    
    While the number of elements in a list slice must fit in an int, there's
    no guarantee that the number of bytes occupied by the slice will.  That
    malloc() and memmove() take size_t arguments is a hint about that <wink>.
    So changed to use size_t where appropriate.
    
    ihigh - ilow should always be >= 0, but we never asserted that.  We do
    now.
    
    The loop decref'ing the recycled slice had a subtle insecurity:  C doesn't
    guarantee that a pointer one slot *before* an array will compare "less
    than" to a pointer within the array (it does guarantee that a pointer
    one beyond the end of the array compares as expected).  This was actually
    an issue in KSR's C implementation, so isn't purely theoretical.  Python
    probably has other "go backwards" loops with a similar glitch.
    list_clear() is OK (it marches an integer backwards, not a pointer).
    8d9eb10c
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
aclocal.m4 Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...