summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* - When method objects have an attribute that can be satisfied eitherGuido van Rossum2003-11-221-28/+30
| | | | | | | | | | by the function object or by the method object, the function object's attribute usually wins. Christian Tismer pointed out that that this is really a mistake, because this only happens for special methods (like __reduce__) where the method object's version is really more appropriate than the function's attribute. So from now on, all method attributes will have precedence over function attributes with the same name.
* Extend temporary hashability to remove() and discard().Raymond Hettinger2003-11-221-11/+52
| | | | Brings the functionality back in line with sets.py.
* Allow temporary hashability for the __contains__ test.Raymond Hettinger2003-11-211-1/+17
| | | | (Requested by Alex Martelli.)
* issubset() and issuperset() to work with general iterablesRaymond Hettinger2003-11-211-5/+15
|
* Three minor performance improvements:Raymond Hettinger2003-11-201-12/+41
| | | | | | | | | | * Improve the hash function to increase the chance that distinct sets will have distinct xor'd hash totals. * Use PyDict_Merge where possible (it is faster than an equivalent iter/set pair). * Don't rebuild dictionaries where the input already has one.
* SF bug 839548: Bug in type's GC handling causes segfaults.Tim Peters2003-11-201-4/+30
| | | | | | | | Also SF patch 843455. This is a critical bugfix. I'll backport to 2.3 maint, but not beyond that. The bugs this fixes have been there since weakrefs were introduced.
* Getting rid of all the code inside #ifdef macintosh too.Jack Jansen2003-11-202-5/+1
|
* Getting rid of code dependent on GUSI or the MetroWerks compiler.Jack Jansen2003-11-191-28/+0
|
* Getting rid of support for the ancient Apple MPW compiler.Jack Jansen2003-11-191-8/+0
|
* Implement straightforward suggestions from gcc warnings (remove unusedGuido van Rossum2003-11-181-3/+2
| | | | variable, add extra braces).
* Use PySequence_Contains() instead of direct access macro.Raymond Hettinger2003-11-181-11/+5
|
* Various fixups (most suggested by Armin Rigo).Raymond Hettinger2003-11-171-40/+66
|
* Fix output spacing typoRaymond Hettinger2003-11-161-1/+1
|
* * Migrate set() and frozenset() from the sandbox.Raymond Hettinger2003-11-161-0/+1073
| | | | | | | | * Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.