<feed xmlns='http://www.w3.org/2005/Atom'>
<title>python.git/Objects/listobject.c, branch v2.4b2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects/listobject.c?h=v2.4b2</id>
<link rel='self' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/atom/Objects/listobject.c?h=v2.4b2'/>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/'/>
<updated>2004-10-07T03:58:07Z</updated>
<entry>
<title>Finalize the freelist of list objects.</title>
<updated>2004-10-07T03:58:07Z</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2004-10-07T03:58:07Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=fb09f0e85cd75ec46700562687a9da3063ff0b7c'/>
<id>urn:sha1:fb09f0e85cd75ec46700562687a9da3063ff0b7c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Checkin Tim's fix to an error discussed on python-dev.</title>
<updated>2004-09-26T19:24:20Z</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2004-09-26T19:24:20Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=aa241e014979612e2c8851bf9b12c16bcc07b161'/>
<id>urn:sha1:aa241e014979612e2c8851bf9b12c16bcc07b161</id>
<content type='text'>
Also, add a testcase.

Formerly, the list_extend() code used several local variables to remember
its state across iterations.  Since an iteration could call arbitrary
Python code, it was possible for the list state to be changed.  The new
code uses dynamic structure references instead of C locals.  So, they
are always up-to-date.

After list_resize() is called, its size has been updated but the new
cells are filled with NULLs.  These needed to be filled before arbitrary
iteration code was called; otherwise, that code could attempt to modify
a list that was in a semi-invalid state.  The solution was to change
the ob-&gt;size field back to a value reflecting the actual number of valid
cells.
</content>
</entry>
<entry>
<title>SF #1022910: Conserve memory with list.pop()</title>
<updated>2004-09-12T19:53:07Z</updated>
<author>
<name>Raymond Hettinger</name>
<email>python@rcn.com</email>
</author>
<published>2004-09-12T19:53:07Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=a84f3abb9ed70a0b13181698fd8c270dd4abbb88'/>
<id>urn:sha1:a84f3abb9ed70a0b13181698fd8c270dd4abbb88</id>
<content type='text'>
The list resizing scheme only downsized when more than 16 elements were
removed in a single step:  del a[100:120].   As a result, the list would
never shrink when popping elements off one at a time.

This patch makes it shrink whenever more than half of the space is unused.

Also, at Tim's suggestion, renamed _new_size to new_allocated.  This makes
the code easier to understand.
</content>
</entry>
<entry>
<title>Typo fix: 'comparisions' is not a word</title>
<updated>2004-09-10T12:59:54Z</updated>
<author>
<name>Andrew M. Kuchling</name>
<email>amk@amk.ca</email>
</author>
<published>2004-09-10T12:59:54Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=55be9eab3874aa93dccdfcf3df4838e25e598cc4'/>
<id>urn:sha1:55be9eab3874aa93dccdfcf3df4838e25e598cc4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>SF patch #1005778, Fix seg fault if list object is modified during list.index()</title>
<updated>2004-08-13T03:18:29Z</updated>
<author>
<name>Neal Norwitz</name>
<email>nnorwitz@gmail.com</email>
</author>
<published>2004-08-13T03:18:29Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=f076953eb13caf629c81c3656cc0f178c7a91b1d'/>
<id>urn:sha1:f076953eb13caf629c81c3656cc0f178c7a91b1d</id>
<content type='text'>
Backport candidate
</content>
</entry>
<entry>
<title>Previous commit was viewed as "perverse".  Changed to just cast the unused</title>
<updated>2004-08-08T21:21:18Z</updated>
<author>
<name>Brett Cannon</name>
<email>bcannon@gmail.com</email>
</author>
<published>2004-08-08T21:21:18Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=651dd52b3ac247fe4a4f18231593a2da96ce8a68'/>
<id>urn:sha1:651dd52b3ac247fe4a4f18231593a2da96ce8a68</id>
<content type='text'>
variable to void..

Thanks to Sjoerd Mullender for the suggested change.
</content>
</entry>
<entry>
<title>Tweak previous patch to silence a warning about the unused left value in the</title>
<updated>2004-08-03T04:53:29Z</updated>
<author>
<name>Brett Cannon</name>
<email>bcannon@gmail.com</email>
</author>
<published>2004-08-03T04:53:29Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=5ad28e14b60b32e19ecf54b87aae5f02bac6b361'/>
<id>urn:sha1:5ad28e14b60b32e19ecf54b87aae5f02bac6b361</id>
<content type='text'>
comma expression in listpop() that was being returned.  Still essentially
unused (as it is meant to be), but now the compiler thinks it is worth
*something* by having it incremented.
</content>
</entry>
<entry>
<title>list_ass_slice():  Document the obscure new intent that deleting a slice</title>
<updated>2004-07-31T21:53:19Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2004-07-31T21:53:19Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=8fc4a916658aa4a24f29a6e1b438f910465cc22b'/>
<id>urn:sha1:8fc4a916658aa4a24f29a6e1b438f910465cc22b</id>
<content type='text'>
of no more than 8 elements cannot fail.

listpop():  Take advantage of that its calls to list_resize() and
list_ass_slice() can't fail.  This is assert'ed in a debug build now, but
in an icky way.  That is, you can't say:

	assert(some_call() &gt;= 0);

because then some_call() won't occur at all in a release build.  So it
has to be a big pile of #ifdefs on Py_DEBUG (yuck), or the pleasant:

        status = some_call();
        assert(status &gt;= 0);

But in that case, compilers may whine in a release build, because status
appears unused then.  I'm not certain the ugly trick I used here will
convince all compilers to shut up about status (status is always "used" now,
as the first (ignored) clause in a comma expression).
</content>
</entry>
<entry>
<title>list_ass_slice():  The difference between "recycle" and "recycled" was</title>
<updated>2004-07-31T02:54:42Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2004-07-31T02:54:42Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=7357222d0e441725d6d8ccd7269a542ac340de89'/>
<id>urn:sha1:7357222d0e441725d6d8ccd7269a542ac340de89</id>
<content type='text'>
impossible to remember, so renamed one to something obvious.  Headed
off potential signed-vs-unsigned compiler complaints I introduced by
changing the type of a vrbl to unsigned.  Removed the need for the
tedious explanation about "backward pointer loops" by looping on an
int instead.
</content>
</entry>
<entry>
<title>Armin asked for a list_ass_slice review in his checkin, so here's the</title>
<updated>2004-07-31T02:24:20Z</updated>
<author>
<name>Tim Peters</name>
<email>tim.peters@gmail.com</email>
</author>
<published>2004-07-31T02:24:20Z</published>
<link rel='alternate' type='text/html' href='http://dangofactory.net/cgit/cgit.cgi/Server/python.git/commit/?id=8d9eb10c299cfaf2f4f8c887ead55da0d24d5050'/>
<id>urn:sha1:8d9eb10c299cfaf2f4f8c887ead55da0d24d5050</id>
<content type='text'>
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 &lt;wink&gt;.
So changed to use size_t where appropriate.

ihigh - ilow should always be &gt;= 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).
</content>
</entry>
</feed>
