Staging
v0.8.1
https://github.com/python/cpython
Revision 8d9eb10c299cfaf2f4f8c887ead55da0d24d5050 authored by Tim Peters on 31 July 2004, 02:24:20 UTC, committed by Tim Peters on 31 July 2004, 02:24:20 UTC
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).
1 parent bcc95cb
History
Tip revision: 8d9eb10c299cfaf2f4f8c887ead55da0d24d5050 authored by Tim Peters on 31 July 2004, 02:24:20 UTC
Armin asked for a list_ass_slice review in his checkin, so here's the
Tip revision: 8d9eb10
File Mode Size
Demo
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
RISCOS
Tools
.cvsignore -rw-r--r-- 109 bytes
.hgtags -rw-r--r-- 2.2 KB
LICENSE -rw-r--r-- 12.9 KB
Makefile.pre.in -rw-r--r-- 31.6 KB
README -rw-r--r-- 48.3 KB
aclocal.m4 -rw-r--r-- 2.1 KB
configure -rwxr-xr-x 509.4 KB
configure.in -rw-r--r-- 84.1 KB
install-sh -rwxr-xr-x 7.0 KB
pyconfig.h.in -rw-r--r-- 23.5 KB
setup.py -rw-r--r-- 51.9 KB

README

back to top