summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Make reversed() transparent with respect to length.Raymond Hettinger2004-02-101-1/+13
|
* SF patch #875689: >100k alloc wasted on startupRaymond Hettinger2004-02-081-1/+1
| | | | | | | (Contributed by Mike Pall.) Make sure fill_free_list() is called only once rather than 106 times when pre-allocating small ints.
* Let reversed() work with itself.Raymond Hettinger2004-02-081-1/+12
|
* Fixed a bug in object.__reduce_ex__ (reduce_2) when using protocolJim Fulton2004-02-081-0/+1
| | | | | 2. Failure to clear the error when attempts to get the __getstate__ attribute fail caused intermittent errors and odd behavior.
* Remove support for --without-universal-newlines (see PEP 11).Skip Montanaro2004-02-071-35/+0
|
* * Fix ref counting in extend() and extendleft().Raymond Hettinger2004-02-071-2/+1
| | | | * Let deques support reversed().
* Fix reallocation bug in unicode.translate(): The code was comparingWalter Dörwald2004-02-051-1/+1
| | | | characters instead of character pointers to determine space requirements.
* Allocating a new weakref object can cause existing weakref objects forFred Drake2004-02-041-3/+16
| | | | | | | | | the same object to be collected by the cyclic GC support if they are only referenced by a cycle. If the weakref being collected was one of the weakrefs without callbacks, some local variables for the constructor became invalid and have to be re-computed. The test caused a segfault under a debug build without the fix applied.
* Fix bug in interpretation of the "callback" argument in the constructors forFred Drake2004-02-031-1/+5
| | | | | weakref ref and proxy objects; None was not being treated as identical to NULL, though it was documented as equivalent.
* Removed two unneeded lines from PyObject_Compare().Brett Cannon2004-01-271-2/+0
| | | | Closes bug #885293 (thanks, Josiah Carlson).
* Two forgotten Py_DECREF() for two out-of-memory conditions.Armin Rigo2004-01-271-2/+6
|
* Revert change accidentally checked in as part of a whitespace normalizationTim Peters2004-01-181-9/+5
| | | | patch.
* Whitespace normalization.Tim Peters2004-01-181-5/+9
|
* Remove support for SunOS 4.Skip Montanaro2004-01-171-10/+0
| | | | Remove BAD_EXEC_PROTOYPE (leftover from IRIX 4 demolition).
* SF Patch #871704: Py_SequenceFast can mask errorsRaymond Hettinger2004-01-111-3/+11
| | | | | | | (Contributed by Greg Chapman.) Since this only changes the error message, I doubt that it should be backported.
* [SF #866875] Add a specialized routine for one characterHye-Shik Chang2004-01-051-45/+95
| | | | separaters on str.split() and str.rsplit().
* Apply pre-sizing optimization to a broader class of objects.Raymond Hettinger2004-01-041-8/+4
| | | | | Formerly, the length was only fetched from sequence objects. Now, any object that reports its length can benefit from pre-sizing.
* Apply tuple/list pre-sizing optimization to a broader class of objects.Raymond Hettinger2004-01-042-9/+5
| | | | | | | | Formerly, length data fetched from sequence objects. Now, any object that reports its length can benefit from pre-sizing. On one sample timing, it gave a threefold speedup for list(s) where s was a set object.
* Cosmetic fix for wrongly indented tabs with ts=4.Hye-Shik Chang2004-01-031-8/+8
|
* * Simplify and speedup logic for tp_print.Raymond Hettinger2003-12-311-15/+29
| | | | * Speed-up intersection whenever PyDict_Next can be used.
* Fix gcc 3.3 warnings related to Py_UNICODE_WIDE.Hye-Shik Chang2003-12-291-1/+4
|
* complete backout of listobject.c v2.171Andrew MacIntyre2003-12-281-4/+0
|
* Revert previous two checkins to repair test failure.Jeremy Hylton2003-12-261-24/+6
| | | | | | The special-case code that was removed could return a value indicating success but leave an exception set. test_fileinput failed in a debug build as a result.
* use the correct macro to access list sizeAndrew MacIntyre2003-12-261-1/+1
|
* Performance of list([]) in 2.3 came up in a thread on comp.lang.python,Andrew MacIntyre2003-12-251-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which can be reviewed via http://coding.derkeiler.com/Archive/Python/comp.lang.python/2003-12/1011.html Duncan Booth investigated, and discovered that an "optimisation" was in fact a pessimisation for small numbers of elements in a source list, compared to not having the optimisation, although with large numbers of elements in the source list the optimisation was quite beneficial. He posted his change to comp.lang.python (but not to SF). Further research has confirmed his assessment that the optimisation only becomes a net win when the source list has more than 100 elements. I also found that the optimisation could apply to tuples as well, but the gains only arrive with source tuples larger than about 320 elements and are nowhere near as significant as the gains with lists, (~95% gain @ 10000 elements for lists, ~20% gain @ 10000 elements for tuples) so I haven't proceeded with this. The code as it was applied the optimisation to list subclasses as well, and this also appears to be a net loss for all reasonable sized sources (~80-100% for up to 100 elements, ~20% for more than 500 elements; I tested up to 10000 elements). Duncan also suggested special casing empty lists, which I've extended to all empty sequences. On the basis that list_fill() is only ever called with a list for the result argument, testing for the source being the destination has now happens before testing source types.
* Fix unicode.rsplit()'s bug that ignores separater on the end of string whenHye-Shik Chang2003-12-231-1/+1
| | | | using specialized splitter for 1 char sep.
* There are places in Python which assume bytes have 8-bits. Formalize that aSkip Montanaro2003-12-221-4/+0
| | | | | | bit by checking the value of UCHAR_MAX in Include/Python.h. There was a check in Objects/stringobject.c. Remove that. (Note that we don't define UCHAR_MAX if it's not defined as the old test did.)
* Fix broken xmlcharrefreplace by rev 2.204.Hye-Shik Chang2003-12-221-3/+3
| | | | (Pointy hat goes to perky)
* SF #859573: Reduce compiler warnings on gcc 3.2 and above.Hye-Shik Chang2003-12-191-1/+14
|
* Guido grants a Christmas wish:Raymond Hettinger2003-12-171-37/+0
| | | | sorted() becomes a regular function instead of a classmethod.
* Speedup set.update by using the override mode for PyDict_Merge().Raymond Hettinger2003-12-151-1/+1
|
* Add rsplit method for str and unicode builtin types.Hye-Shik Chang2003-12-152-1/+315
| | | | | SF feature request #801847. Original patch is written by Sean Reifschneider.
* Improve algorithm for set.difference when the input is not a set.Raymond Hettinger2003-12-151-43/+43
|
* * Refactor set.__contains__()Raymond Hettinger2003-12-131-21/+10
| | | | | * Use Py_RETURN_NONE everywhere. * Fix-up the firstpass check for the tp_print slot.
* Refactor set.discard() and set.remove().Raymond Hettinger2003-12-131-31/+22
|
* Improve argument checking speed.Raymond Hettinger2003-12-131-17/+44
|
* Use dictionary specific looping idiom where possible.Raymond Hettinger2003-12-131-114/+40
| | | | Simplifies and speeds-up the code.
* Simplify previous checkin -- a new function was not needed.Raymond Hettinger2003-12-131-26/+1
|
* Use PyDict_Contains() instead of PySequence_Contains().Raymond Hettinger2003-12-131-2/+2
|
* * Added a new method flag, METH_COEXIST.Raymond Hettinger2003-12-135-3/+69
| | | | | * Used the flag to optimize set.__contains__(), dict.__contains__(), dict.__getitem__(), and list.__getitem__().
* Fix memory error treatment correctly. Going to dsu_fail causesHye-Shik Chang2003-12-101-1/+1
| | | | | deallocating garbage pointers; saved_ob_item and empty_ob_item. (Reviewed by Raymond Hettinger)
* Fixes and tests for various "holding pointers when arbitrary Python codeMichael W. Hudson2003-12-041-35/+46
| | | | | | can run" bugs as discussed in [ 848856 ] couple of new list.sort bugs
* - Removed FutureWarnings related to hex/oct literals and conversionsGuido van Rossum2003-11-293-64/+50
| | | | | | | | | | and left shifts. (Thanks to Kalle Svensson for SF patch 849227.) This addresses most of the remaining semantic changes promised by PEP 237, except for repr() of a long, which still shows the trailing 'L'. The PEP appears to promise warnings for operations that changed semantics compared to Python 2.3, but this is not implemented; we've suffered through enough warnings related to hex/oct literals and I think it's best to be silent now.
* Make sure the list.sort's decorate step unwinds itself before returningRaymond Hettinger2003-11-281-2/+9
| | | | | an exception raised by the key function. (Suggested by Michael Hudson.)
* Add optional fillchar argument to ljust(), rjust(), and center() string methods.Raymond Hettinger2003-11-262-26/+63
|
* Expose dict_contains() and PyDict_Contains() with is about 10% fasterRaymond Hettinger2003-11-252-12/+13
| | | | | | | than PySequence_Contains() and more clearly applicable to dicts. Apply the new function in setobject.c where __contains__ checking is ubiquitous.
* Factor out more duplicate code.Raymond Hettinger2003-11-241-77/+51
|
* Stop GCC warning about int literal that's so long that it becomes anGuido van Rossum2003-11-241-1/+1
| | | | | unsigned int (on a 32-bit machine), by adding an explicit 'u' to the literal (a prime used to improve the hash function for frozenset).
* * Checkin remaining documentationRaymond Hettinger2003-11-241-137/+148
| | | | | | | * Add more tests * Refactor and neaten the code a bit. * Rename union_update() to update(). * Improve the algorithms (making them a closer to sets.py).
* * Simplify hash function and add test to show effectiveness of the hashRaymond Hettinger2003-11-231-14/+26
| | | | | | | | | | | | | | | function. * Add a better test for deepcopying. * Add tests to show the __init__() function works like it does for list and tuple. Add related test. * Have shallow copies of frozensets return self. Add related test. * Have frozenset(f) return f if f is already a frozenset. Add related test. * Beefed-up some existing tests.