summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
Commit message (Collapse)AuthorAgeFilesLines
...
* SF bug #439104: Tuple richcompares has code-typo.Tim Peters2001-07-061-1/+1
| | | | | | Symptom: (1, 2, 3) <= (1, 2) returned 1. This was already fixed in CVS for tuples, but an isomorphic error was in the list richcompare code.
* SF bug 433228: repr(list) woes when len(list) big.Tim Peters2001-06-161-13/+55
| | | | | | | | | | | | Gave Python linear-time repr() implementations for dicts, lists, strings. This means, e.g., that repr(range(50000)) is no longer 50x slower than pprint.pprint() in 2.2 <wink>. I don't consider this a bugfix candidate, as it's a performance boost. Added _PyString_Join() to the internal string API. If we want that in the public API, fine, but then it requires runtime error checks instead of asserts.
* Change list.extend() error msgs and NEWS to reflect that list.extend()Tim Peters2001-05-261-2/+2
| | | | | | | now takes any iterable argument, not only sequences. NEEDS DOC CHANGES -- but I don't think we settled on a concise way to say this stuff.
* Cruft cleanup: removed the #ifdef'ery in support of compiling to allowTim Peters2001-05-261-18/+4
| | | | multi-argument list.append(1, 2, 3) (as opposed to .append((1,2,3))).
* roundupsize() and friends: fiddle over-allocation strategy for listTim Peters2001-05-261-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | resizing. Accurate timings are impossible on my Win98SE box, but this is obviously faster even on this box for reasonable list.append() cases. I give credit for this not to the resizing strategy but to getting rid of integer multiplication and divsion (in favor of shifting) when computing the rounded-up size. For unreasonable list.append() cases, Win98SE now displays linear behavior for one-at-time appends up to a list with about 35 million elements. Then it dies with a MemoryError, due to fatally fragmented *address space* (there's plenty of VM available, but by this point Win9X has broken user space into many distinct heaps none of which has enough contiguous space left to resize the list, and for whatever reason Win9x isn't coalescing the dead heaps). Before the patch it got a MemoryError for the same reason, but once the list reached about 2 million elements. Haven't yet tried on Win2K but have high hopes extreme list.append() will be much better behaved now (NT & Win2K didn't fragment address space, but suffered obvious quadratic-time behavior before as lists got large). For other systems I'm relying on common sense: replacing integer * and / by << and >> can't plausibly hurt, the number of function calls hasn't changed, and the total operation count for reasonably small lists is about the same (while the operations are cheaper now).
* Fix core dump whenever PyList_Reverse() was called.Guido van Rossum2001-02-121-11/+14
| | | | | | | | | | | This fixes SF bug #132008, reported by Warren J. Hack. The copyright for this patch (and this patch only) belongs to CNRI, as part of the (yet to be issued) 1.6.1 release. This is now checked into the HEAD branch. Tim will check in a test case to check for this specific bug, and an assertion in PyArgs_ParseTuple() to catch similar bugs in the future.
* Convert to rich comparisons:Guido van Rossum2001-01-171-90/+163
| | | | | | | | | | | | | | | | - sort's docompare() calls RichCompare(Py_LT). - list_contains(), list_index(), listcount(), listremove() call RichCompare(Py_EQ). - Get rid of list_compare(), in favor of new list_richcompare(). The latter does some nice shortcuts, like when == or != is requested, it first compares the lengths for trivial accept/reject. Then it goes over the items until it finds an index where the items differe; then it does more shortcut magic to minimize the number of additional comparisons. - Aligned the comments for large struct initializers.
* fix leakJeremy Hylton2001-01-031-1/+3
|
* Use METH_VARARGS instead of "1" in list method table.Tim Peters2000-12-131-9/+9
|
* Rationalize use of limits.h, moving the inclusion to Python.h.Fred Drake2000-09-261-3/+0
| | | | | | | | Add definitions of INT_MAX and LONG_MAX to pyport.h. Remove includes of limits.h and conditional definitions of INT_MAX and LONG_MAX elsewhere. This closes SourceForge patch #101659 and bug #115323.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* Support for the in-place operations introduced by augmented assignment. OnlyThomas Wouters2000-08-241-18/+88
| | | | | the list object supports this currently, but other candidates are gladly accepted (like arraymodule and such.)
* Added include for limits.hJack Jansen2000-08-221-0/+4
|
* Check for overflow in list object insertion and raise OverflowError.Trent Mick2000-08-131-0/+5
| | | | see: http://www.python.org/pipermail/python-dev/2000-August/014971.html
* Use 'void' directly instead of the ANY #define, now that all code is ANSI C.Thomas Wouters2000-07-251-2/+2
| | | | Leave the actual #define in for API compatibility.
* Fix in PyList_New(). With GC enabled and when out of memory,Vladimir Marangozov2000-07-151-1/+1
| | | | free() the GC pointer, not the object pointer.
* replace PyXXX_Length calls with PyXXX_Size callsJeremy Hylton2000-07-121-2/+2
|
* ANSI-fication of the sources.Fred Drake2000-07-091-125/+45
|
* Neil Schemenauer: small fixes for GCGuido van Rossum2000-07-011-0/+1
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* final patches from Neil Schemenauer for garbage collectionJeremy Hylton2000-06-301-3/+6
|
* part 2 of Neil Schemenauer's GC patches:Jeremy Hylton2000-06-231-5/+6
| | | | | | | | This patch modifies the type structures of objects that participate in GC. The object's tp_basicsize is increased when GC is enabled. GC information is prefixed to the object to maintain binary compatibility. GC objects also define the tp_flag Py_TPFLAGS_GC.
* Round 1 of Neil Schemenauer's GC patches:Jeremy Hylton2000-06-231-0/+29
| | | | | This patch adds the type methods traverse and clear necessary for GC implementation.
* Patch from /F:Andrew M. Kuchling2000-06-181-21/+16
| | | | | this patch introduces PySequence_Fast and PySequence_Fast_GET_ITEM, and modifies the list.extend method to accept any kind of sequence.
* Thomas Wouters <thomas@xs4all.net>:Fred Drake2000-06-151-0/+15
| | | | | | | | | | | | | | | The following patch adds "sq_contains" support to rangeobject, and enables the already-written support for sq_contains in listobject and tupleobject. The rangeobject "contains" code should be a bit more efficient than the current default "in" implementation ;-) It might not get used much, but it's not that much to add. listobject.c and tupleobject.c already had code for sq_contains, and the proper struct member was set, but the PyType structure was not extended to include tp_flags, so the object-specific code was not getting called (Go ahead, test it ;-). I also did this for the immutable_list_type in listobject.c, eventhough it is probably never used. Symmetry and all that.
* Improve TypeError exception message for list catenation.Fred Drake2000-06-011-2/+2
|
* Michael Hudson <mwh21@cam.ac.uk>:Fred Drake2000-06-011-2/+6
| | | | | Removed PyErr_BadArgument() calls and replaced them with more useful error messages.
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-9/+9
| | | | | | | | | | For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
* add list_contains and tuplecontains: efficient implementations of tp_containsJeremy Hylton2000-04-271-0/+21
|
* Christian Tismer's "trashcan" patch:Guido van Rossum2000-03-131-0/+2
| | | | | | | | Added wrapping macros to dictobject.c, listobject.c, tupleobject.c, frameobject.c, traceback.c that safely prevends core dumps on stack overflow. Macros and functions in object.c, object.h. The method is an "elevator destructor" that turns cascading deletes into tail recursive behavior when some limit is hit.
* Added Christian Tismer's patch to allow list.append(a,b,c) back --Guido van Rossum2000-03-131-4/+18
| | | | | with a twist: you have to define NO_STRICT_LIST_APPEND manually to enable multi-arg append().
* OKOK, Greg's right, I should've used the :name option in the argumentGuido van Rossum2000-02-241-9/+9
| | | | format strings.
* Made all list methods use PyArg_ParseTuple(), for more accurateGuido van Rossum2000-02-241-30/+29
| | | | | | | | diagnostics. *** INCOMPATIBLE CHANGE: This changes append(), remove(), index(), and *** count() to require exactly one argument -- previously, multiple *** arguments were silently assumed to be a tuple.
* The rest of the changes by Trent Mick and Dale Nagata for warning-freeGuido van Rossum2000-01-201-1/+1
| | | | compilation on NT Alpha. Mostly added casts etc.
* When deallocating a list, DECREF the items from the end back to the start.Guido van Rossum1999-06-091-1/+6
|
* Improve text of some error messages, as suggested by Sean Reifschneider.Guido van Rossum1999-04-191-2/+3
|
* Jim Ahlstrom patch: cutoff should be a long for machines with 16-bitGuido van Rossum1999-01-141-1/+1
| | | | | | ints. (In theory, other variables should be widened to long as well, but this won't ever be needed, since the len of a list is still an int.)
* listextend(): New method which implements L.extend(L2).Barry Warsaw1998-10-091-0/+74
|
* Remove a redundant check from list_slice() and list_ass_slice().Guido van Rossum1998-10-071-4/+0
| | | | Noted by Greg Stein.
* Added doc strings for methods and a new pop() method.Guido van Rossum1998-06-301-7/+54
|
* Minor cleanup by Tim after my changes:Guido van Rossum1998-06-171-25/+19
| | | | | | | | | | | | + Took the "list" argument out of the other functions that no longer need it. This speeds things up a little more. + Small comment changes in accord with that. + Exploited the now-safe ability to cache values in the partitioning loop. Makes no timing difference on my flavor of Pentium, but this machine ran out of registers 12 iterations ago. It should yield a small speedup on a RISC machine, and not hurt in any case.
* Tim's latest, with some of my changes (also a TP suggestion) added:Guido van Rossum1998-06-161-218/+551
| | | | | | | | | | instead of testing whether the list changed size after each comparison, temporarily set the type of the list to an immutable list type. This should allow continued use of the list for legitimate purposes but disallows all operations that can change it in any way. (Changes to the internals of list items are not caught, of cause; that's not possible to detect, and it's not necessary to protect the sort code, either.)
* Tim's revision of the previous patch. He also added some sparts toGuido van Rossum1998-05-291-43/+35
| | | | the median-of-three code to get a few percent back.
* Guard against changes in the list size during a compare or sort.Guido van Rossum1998-05-281-22/+31
|
* Tim's quicksort on May 25.Guido van Rossum1998-05-261-123/+141
|
* Tim's quicksort on May 13.Guido van Rossum1998-05-131-1/+1
|
* Tim's quicksort on May 10.Guido van Rossum1998-05-131-68/+99
|
* Get rid of the unused ifdefed-out old sort code.Guido van Rossum1998-04-281-76/+0
|
* Quicksort retuned by Tim Peters.Guido van Rossum1998-04-281-33/+26
|