summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* - 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.
* subtype_dealloc(): Simplified overly contorted retracking logic. WithTim Peters2003-11-131-6/+5
| | | | | this change, I think subtype_dealloc is actually a smidgen less obscure than it was in 2.3 -- we got rid of a negation in an "if" <wink>.
* subtype_dealloc(): A more complete fix for critical bug 840829 +Tim Peters2003-11-131-6/+19
| | | | | | expanded the test case with a piece that needs the more-complete fix. I'll backport this to 2.3 maint.
* SF bug 840829: weakref callbacks and gc corrupt memory.Tim Peters2003-11-121-1/+6
| | | | | | | | | | | | | | | | | subtype_dealloc(): This left the dying object exposed to gc, so that if cyclic gc triggered during the weakref callback, gc tried to delete the dying object a second time. That's a disaster. subtype_dealloc() had a (I hope!) unique problem here, as every normal dealloc routine untracks the object (from gc) before fiddling with weakrefs etc. But subtype_dealloc has obscure technical reasons for re-registering the dying object with gc (already explained in a large comment block at the bottom of the function). The fix amounts to simply refraining from reregistering the dying object with gc until after the weakref callback (if any) has been called. This is a critical bug (hard to predict, and causes seemingly random memory corruption when it occurs). I'll backport it to 2.3 later.
* Improve the reverse list iterator to free memory as soon as the iteratorRaymond Hettinger2003-11-081-1/+4
| | | | is exhausted.
* Minor code fixup. Make sure that len reflects the current list size.Raymond Hettinger2003-11-081-0/+1
|
* Optimize reversed(list) using a custom iterator.Raymond Hettinger2003-11-072-4/+98
|
* Implement and apply PEP 322, reverse iterationRaymond Hettinger2003-11-062-1/+161
|
* Fix compiler warning about possible use of n without assignment.Jeremy Hylton2003-11-031-5/+6
| | | | Also fix use of n for two different variables in two different blocks.
* Use PyTuple_Pack() to simplify enumerate().Raymond Hettinger2003-11-021-5/+1
|
* Add list.sorted() classmethod.Raymond Hettinger2003-10-291-0/+37
|
* Deleting cyclic object comparison.Armin Rigo2003-10-282-186/+12
| | | | | SF patch 825639 http://mail.python.org/pipermail/python-dev/2003-October/039445.html
* Fix Greg Ward's error message nit: PyObject_SetItem and PySequenceSetItemRaymond Hettinger2003-10-271-1/+1
| | | | had slightly different error messages.
* Fix a bug in the memory reallocation code of PyUnicode_TranslateCharmap().Walter Dörwald2003-10-241-19/+20
| | | | | | | charmaptranslate_makespace() allocated more memory than required for the next replacement but didn't remember that fact, so memory size was growing exponentially every time a replacement string is longer that one character. This fixes SF bug #828737.
* Avoid confusing name for the 3rd argument to str.replace().Fred Drake2003-10-221-3/+3
| | | | This closes SF bug #827260.
* Removing bogus Py_DECREF() reported by Armin Rigo (SF bug 812353).Jeremy Hylton2003-10-211-1/+0
| | | | | Even if a new dict is generated for locals, it is stored in f->f_locals.
* Fix indentation.Jeremy Hylton2003-10-211-1/+1
|
* Fix a bunch of typos in documentation, docstrings and comments.Walter Dörwald2003-10-201-1/+1
| | | | (From SF patch #810751)
* Make CObjects mutable. Fixes #477441.Martin v. Löwis2003-10-191-0/+14
|
* Patch #825679: Clarify semantics of .isfoo on empty strings.Martin v. Löwis2003-10-182-22/+24
| | | | Backported to 2.3.
* Patch #809535: Mention behaviour of seek on text files. Backported to 2.3.Martin v. Löwis2003-10-181-1/+3
|
* Fix typo found by Neal Norwitz.Raymond Hettinger2003-10-161-1/+1
|
* * list.sort() now supports three keyword arguments: cmp, key, and reverse.Raymond Hettinger2003-10-161-5/+228
| | | | | | | key provides C support for the decorate-sort-undecorate pattern. reverse provide a stable sort of the list with the comparisions reversed. * Amended the docs to guarantee sort stability.
* Simplify and speedup uses of Py_BuildValue():Raymond Hettinger2003-10-124-29/+28
| | | | | | * Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
* Extended tuple's C API to include a new function, PyTuple_Pack() that isRaymond Hettinger2003-10-121-0/+22
| | | | | useful for rapidly building argument tuples without having to invoke the more sophisticated machinery of Py_BuildValue().
* Use the simpler and faster PyArg_UnpackTuple() instead ofRaymond Hettinger2003-10-111-24/+24
| | | | PyArg_ParseTuple() where possible.
* SF bug #820397: __nonzero__() returns 1/0Raymond Hettinger2003-10-111-1/+15
| | | | | | Altered to return a PyBool instead of a PyInt. Backport candidate.
* Return a bool rather than an int from proxy_has_key().Guido van Rossum2003-10-091-1/+4
|
* Fix leak introduced by previous typeobject.c checkin.Guido van Rossum2003-10-091-4/+3
|