The Wayback Machine - https://web.archive.org/web/20170224204758/http://svn.python.org/view/python/trunk/Objects/setobject.c
/[projects]/python/trunk/Objects/setobject.c
ViewVC logotype

Log of /python/trunk/Objects/setobject.c

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (as text) (annotate)
Sticky Revision:

Revision 81029 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun May 9 14:46:46 2010 UTC (6 years, 9 months ago) by antoine.pitrou
File length: 72434 byte(s)
Diff to previous 80202
Untabify C files. Will watch buildbots.


Revision 80202 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Apr 18 22:57:57 2010 UTC (6 years, 10 months ago) by raymond.hettinger
File length: 59751 byte(s)
Diff to previous 78886
Issue 8436: set.__init__ accepts keyword args

Revision 78886 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Mar 13 00:13:22 2010 UTC (6 years, 11 months ago) by victor.stinner
File length: 59677 byte(s)
Diff to previous 78516
Issue #7818: set().test_c_api() doesn't expect a set('abc'), modify the set.

Revision 78516 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Feb 28 18:26:37 2010 UTC (6 years, 11 months ago) by georg.brandl
File length: 59430 byte(s)
Diff to previous 78515
The set types can also be called without arguments.

Revision 78515 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Feb 28 18:19:17 2010 UTC (6 years, 11 months ago) by georg.brandl
File length: 59356 byte(s)
Diff to previous 76382
#8030: make builtin type docstrings more consistent: use "iterable" instead of "seq(uence)", use "new" to show that set() always returns a new object.

Revision 76382 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Nov 18 20:28:22 2009 UTC (7 years, 3 months ago) by raymond.hettinger
File length: 59354 byte(s)
Diff to previous 74228
Issue 7263: Fix set.intersection() docstring.

Revision 74228 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jul 27 20:32:04 2009 UTC (7 years, 7 months ago) by raymond.hettinger
File length: 59337 byte(s)
Diff to previous 68128
Issue 6573: Fix set.union() for cases where self is in the argument chain.

Revision 68128 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jan 1 14:11:22 2009 UTC (8 years, 1 month ago) by antoine.pitrou
File length: 59354 byte(s)
Diff to previous 66836
Issue #3680: Reference cycles created through a dict, set or deque iterator did not get collected.


Revision 66836 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Oct 7 20:32:10 2008 UTC (8 years, 4 months ago) by amaury.forgeotdarc
File length: 59165 byte(s)
Diff to previous 66772
#4069: aSet.remove(otherSet) would always report the empty frozenset([]) as the missing key.
Now it correctly refers to the initial otherset.

Reviewed by Raymond. Will backport to 2.6.

Revision 66772 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Oct 3 16:29:19 2008 UTC (8 years, 4 months ago) by andrew.kuchling
File length: 59160 byte(s)
Diff to previous 64962
Mention exception in docstring

Revision 64962 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 15 14:27:37 2008 UTC (8 years, 7 months ago) by nick.coghlan
File length: 59120 byte(s)
Diff to previous 64853
Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful

Revision 64853 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jul 10 15:24:04 2008 UTC (8 years, 7 months ago) by robert.schuppenies
File length: 59087 byte(s)
Diff to previous 64115
Added additional __sizeof__ implementations and addressed comments made in
Issue3122.

Revision 64115 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jun 11 10:30:54 2008 UTC (8 years, 8 months ago) by raymond.hettinger
File length: 58660 byte(s)
Diff to previous 64101
Multi-arg form for set.difference() and set.difference_update().

Revision 64101 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jun 11 00:44:47 2008 UTC (8 years, 8 months ago) by raymond.hettinger
File length: 58051 byte(s)
Diff to previous 64055
Handle the case with zero arguments.


Revision 64055 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jun 9 13:07:27 2008 UTC (8 years, 8 months ago) by raymond.hettinger
File length: 57993 byte(s)
Diff to previous 64051
Let set.intersection() and set.intersection_update() take multiple input arguments.

Revision 64051 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jun 9 08:33:37 2008 UTC (8 years, 8 months ago) by raymond.hettinger
File length: 57261 byte(s)
Diff to previous 64048
Let set.union() and set.update() accept multiple inputs.

Revision 64048 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jun 9 04:58:54 2008 UTC (8 years, 8 months ago) by gregory.p.smith
File length: 56766 byte(s)
Diff to previous 63806
This reverts r63675 based on the discussion in this thread:

 http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.


Revision 63806 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri May 30 06:49:47 2008 UTC (8 years, 8 months ago) by raymond.hettinger
File length: 56751 byte(s)
Diff to previous 63675
Issue 2855: Fix obscure crasher by slowing down the entire module.  Mimics what was done to dictionaries in r59223.

Revision 63675 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon May 26 12:51:38 2008 UTC (8 years, 9 months ago) by christian.heimes
File length: 56655 byte(s)
Diff to previous 62848
Renamed PyString to PyBytes

Revision 62848 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu May 8 04:35:20 2008 UTC (8 years, 9 months ago) by raymond.hettinger
File length: 56670 byte(s)
Diff to previous 60749
Frozensets do not benefit from autoconversion.

Revision 60749 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Feb 12 19:05:36 2008 UTC (9 years ago) by raymond.hettinger
File length: 56679 byte(s)
Diff to previous 60687
dict.copy() rises from the ashes.  Revert r60687.

Revision 60687 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Feb 9 04:37:49 2008 UTC (9 years ago) by raymond.hettinger
File length: 57066 byte(s)
Diff to previous 60616
Add -3 warnings that set.copy(), dict.copy(), and defaultdict.copy() will go away in Py3.x

Revision 60616 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Feb 6 13:33:44 2008 UTC (9 years ago) by christian.heimes
File length: 56679 byte(s)
Diff to previous 60560
Unified naming convention for free lists and their limits. All free lists
in Object/ are named ``free_list``, the counter ``numfree`` and the upper
limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block.

The chances should make it easier to adjust Python for platforms with
less memory, e.g. mobile phones.

Revision 60560 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Feb 3 22:51:43 2008 UTC (9 years ago) by amaury.forgeotdarc
File length: 56677 byte(s)
Diff to previous 60399
Ensure that PySet_Add() operates on a newly created frozenset, like PyTuple_SetItem does.

Add PyFrozenSet_Check(), which was not needed before; The list of Py*Set_Check* macros seems to be complete now.

Add missing NEWS entries about all this.

Revision 60399 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jan 28 21:47:42 2008 UTC (9 years ago) by raymond.hettinger
File length: 56492 byte(s)
Diff to previous 60397
Factor-out common code with a new macro

Revision 60397 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jan 28 20:34:33 2008 UTC (9 years ago) by raymond.hettinger
File length: 56600 byte(s)
Diff to previous 60312
Make PySet_Add() work with frozensets.
Works like PyTuple_SetItem() to build-up values in a brand new frozenset.
Also, PyFrozenSet_New() is now guaranteed to produce a distinct new frozenset.


Revision 60312 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jan 26 09:31:11 2008 UTC (9 years, 1 month ago) by raymond.hettinger
File length: 56865 byte(s)
Diff to previous 60311
Revert PySet_Add() changes.

Revision 60311 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jan 26 08:41:13 2008 UTC (9 years, 1 month ago) by raymond.hettinger
File length: 56709 byte(s)
Diff to previous 60308
Update test code for change to PySet_Add().

Revision 60308 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jan 26 08:19:06 2008 UTC (9 years, 1 month ago) by raymond.hettinger
File length: 56769 byte(s)
Diff to previous 60291
Make PySet_Add() work with frozensets.  Works like PyTuple_SetItem() to build-up values in a brand new frozenset.


Revision 60291 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jan 25 19:24:46 2008 UTC (9 years, 1 month ago) by raymond.hettinger
File length: 56865 byte(s)
Diff to previous 59564
Changes 54857 and 54840 broke code and were reverted in Py2.5 just before
it was released, but that reversion never made it to the Py2.6 head.


Revision 59564 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Dec 19 02:37:44 2007 UTC (9 years, 2 months ago) by christian.heimes
File length: 56900 byte(s)
Diff to previous 59106
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available.

Revision 59106 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Nov 22 00:55:51 2007 UTC (9 years, 3 months ago) by guido.van.rossum
File length: 56900 byte(s)
Diff to previous 58915
Backport of _abccoll.py by Benjamin Arangueren, issue 1383.
With some changes of my own thrown in (e.g. backport of r58107).

Revision 58915 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Nov 8 18:47:51 2007 UTC (9 years, 3 months ago) by raymond.hettinger
File length: 57029 byte(s)
Diff to previous 58908
Reposition the decref (spotted by eagle-eye norwitz).

Revision 58908 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Nov 8 02:52:43 2007 UTC (9 years, 3 months ago) by raymond.hettinger
File length: 57010 byte(s)
Diff to previous 58176
Add set.isdisjoint()

Revision 58176 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Sep 17 03:28:34 2007 UTC (9 years, 5 months ago) by brett.cannon
File length: 55662 byte(s)
Diff to previous 56476
Add a bunch of GIL release/acquire points in tp_print implementations and for
PyObject_Print().

Closes issue #1164.

Revision 56476 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jul 21 06:55:02 2007 UTC (9 years, 7 months ago) by martin.v.loewis
File length: 55474 byte(s)
Diff to previous 55227
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.

Revision 55227 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu May 10 17:20:15 2007 UTC (9 years, 9 months ago) by guido.van.rossum
File length: 55517 byte(s)
Diff to previous 54465
Fix a bug in test_c_api() that caused a negative refcount.

Revision 54465 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Mar 20 21:27:24 2007 UTC (9 years, 11 months ago) by raymond.hettinger
File length: 55509 byte(s)
Diff to previous 53829
Extend work on rev 52962 and 53829 eliminating redundant PyObject_Hash() calls and fixing set/dict interoperability.

Revision 53829 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Feb 19 20:44:04 2007 UTC (10 years ago) by raymond.hettinger
File length: 55218 byte(s)
Diff to previous 53818
Fixup set/dict interoperability.

Revision 53818 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Feb 19 02:03:19 2007 UTC (10 years ago) by raymond.hettinger
File length: 54844 byte(s)
Diff to previous 53668
Extend work on revision 52962:  Eliminate redundant calls to PyObject_Hash().


Revision 53668 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Feb 8 00:50:39 2007 UTC (10 years ago) by raymond.hettinger
File length: 54779 byte(s)
Diff to previous 53618
Bypass set specific optimizations for set and frozenset subclasses.

Revision 53618 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Feb 1 21:02:59 2007 UTC (10 years ago) by raymond.hettinger
File length: 54744 byte(s)
Diff to previous 53381
Bug #1648179:  set.update() not recognizing __iter__ overrides in dict subclasses.

Revision 53381 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jan 11 18:22:55 2007 UTC (10 years, 1 month ago) by raymond.hettinger
File length: 54724 byte(s)
Diff to previous 53200
SF #1486663 -- Allow keyword args in subclasses of set() and frozenset().

Revision 53200 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Dec 30 04:01:17 2006 UTC (10 years, 1 month ago) by raymond.hettinger
File length: 54672 byte(s)
Diff to previous 52964
For sets with cyclical reprs, emit an ellipsis instead of infinitely recursing.

Revision 52964 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Dec 8 04:57:50 2006 UTC (10 years, 2 months ago) by raymond.hettinger
File length: 54224 byte(s)
Diff to previous 52963
Port Georg's dictobject.c fix keys that were tuples got unpacked on the way to setting a KeyError (svn revision 52535, sf bug 
1576657).


Revision 52963 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Dec 8 04:24:33 2006 UTC (10 years, 2 months ago) by raymond.hettinger
File length: 53868 byte(s)
Diff to previous 52962
Port Armin's fix for a dict resize vulnerability (svn revision 46589, sf bug 1456209).


Revision 52962 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Dec 8 03:17:18 2006 UTC (10 years, 2 months ago) by raymond.hettinger
File length: 53118 byte(s)
Diff to previous 52502
Eliminate two redundant calls to PyObject_Hash().

Revision 52502 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Oct 28 21:16:54 2006 UTC (10 years, 4 months ago) by neal.norwitz
File length: 52752 byte(s)
Diff to previous 51798
Fix warnings with HP's C compiler.  It doesn't recognize that infinite
loops are, um, infinite.  These conditions should not be able to happen.

Will backport.

Revision 51798 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Sep 7 02:42:48 2006 UTC (10 years, 5 months ago) by raymond.hettinger
File length: 52711 byte(s)
Diff to previous 50934
Fix refcounts and add error checks.

Revision 50934 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jul 29 15:10:32 2006 UTC (10 years, 7 months ago) by andrew.kuchling
File length: 52280 byte(s)
Diff to previous 50684
[Bug #1414697] Change docstring of set/frozenset types to specify that the contents are unique.  Raymond, please feel free to edit or revert.

Revision 50684 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jul 17 00:57:15 2006 UTC (10 years, 7 months ago) by neal.norwitz
File length: 52242 byte(s)
Diff to previous 47018
otherset is known to be non-NULL based on checks before and DECREF after.
DECREF otherset rather than XDECREF in error conditions too.

Reported by Klockwork #154.

Revision 47018 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jun 19 05:40:44 2006 UTC (10 years, 8 months ago) by neal.norwitz
File length: 52244 byte(s)
Diff to previous 45434
Use Py_ssize_t

Revision 45434 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Apr 15 12:47:23 2006 UTC (10 years, 10 months ago) by martin.v.loewis
File length: 52130 byte(s)
Diff to previous 45312
Clear dummy and emptyfrozenset, so that we don't have
dangling references in case of a Py_Initialize/Py_Finalize
cycle.

Revision 45312 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Apr 12 17:06:05 2006 UTC (10 years, 10 months ago) by armin.rigo
File length: 52134 byte(s)
Diff to previous 45275
Ignore the references to the dummy objects used as deleted keys
in dicts and sets when computing the total number of references.

Revision 45275 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Apr 11 09:04:12 2006 UTC (10 years, 10 months ago) by martin.v.loewis
File length: 52057 byte(s)
Diff to previous 43465
Remove "static forward" declaration. Move constructors
after the type objects.

Revision 43465 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Mar 30 22:45:35 2006 UTC (10 years, 10 months ago) by barry.warsaw
File length: 52108 byte(s)
Diff to previous 43453
SF patch #1458476 with modifications based on discussions in python-dev.  This
adds the following API calls: PySet_Clear(), _PySet_Next(), and
_PySet_Update().  The latter two are considered non-public.  Tests and
documentation (for the public API) are included.

Revision 43453 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Mar 30 11:57:00 2006 UTC (10 years, 10 months ago) by georg.brandl
File length: 50598 byte(s)
Diff to previous 43321
Remove unnecessary casts in type object initializers.


Revision 43321 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Mar 26 03:11:29 2006 UTC (10 years, 11 months ago) by raymond.hettinger
File length: 50605 byte(s)
Diff to previous 42834
Tighten an overbroad and misleading assertion.
(Reported by Jim Jewett.)


Revision 42834 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Mar 4 18:41:19 2006 UTC (10 years, 11 months ago) by neal.norwitz
File length: 50628 byte(s)
Diff to previous 42382
Use Py_ssize_t for PySet_Size() like all the other Py*_Size() functions.

Revision 42382 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Feb 15 17:27:45 2006 UTC (11 years ago) by martin.v.loewis
File length: 50621 byte(s)
Diff to previous 42326
Merge ssize_t branch.

Revision 42326 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Feb 11 21:32:43 2006 UTC (11 years ago) by armin.rigo
File length: 50538 byte(s)
Diff to previous 41974
Renamed _length_cue() to __length_hint__().  See:
http://mail.python.org/pipermail/python-dev/2006-February/060524.html

Revision 41974 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jan 8 06:13:44 2006 UTC (11 years, 1 month ago) by neal.norwitz
File length: 50532 byte(s)
Diff to previous 41434
Remove some shadowed variables

Revision 41434 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Nov 13 18:41:28 2005 UTC (11 years, 3 months ago) by neal.norwitz
File length: 50538 byte(s)
Diff to previous 39608
Prevent name pollution by making lots of internal functions static.

Revision 39608 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Sep 24 21:23:05 2005 UTC (11 years, 5 months ago) by rhettinger
File length: 50531 byte(s)
Diff to previous 39553
Convert iterator __len__() methods to a private API.

Revision 39553 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Sep 16 07:14:21 2005 UTC (11 years, 5 months ago) by rhettinger
File length: 50346 byte(s)
Diff to previous 39400
No longer ignore exceptions raised by comparisons during key lookup.
Inspired by Armin Rigo's suggestion to do the same with dictionaries.

Revision 39400 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 26 06:42:30 2005 UTC (11 years, 6 months ago) by birkenfeld
File length: 50922 byte(s)
Diff to previous 39349
Disallow keyword arguments for type constructors that don't use them.
(fixes bug #1119418)

Revision 39349 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Aug 24 00:24:40 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 50803 byte(s)
Diff to previous 39294
* Add a fast equality check path for frozensets where the hash value has
  already been computed.
* Apply a GET_SIZE macro().

Revision 39294 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Aug 17 12:27:17 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 50727 byte(s)
Diff to previous 39290
Add shortcuts for a|a and a&a.

Revision 39290 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Aug 17 00:27:42 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 50674 byte(s)
Diff to previous 39289
Results of a line-by-line comparison back to dictobject.c.

* set_merge() cannot assume that the table doesn't resize during iteration.

* convert some unnecessary tests to asserts -- they were necessary in
  dictobject.c because PyDict_Next() is a public function.  The same is
  not true for set_next().

* re-arrange the order of functions to more closely match the order
  in dictobject.c.  This makes it must easier to compare the two
  and ought to simplify any issues of maintaining both.

Revision 39289 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 16 10:44:15 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 50747 byte(s)
Diff to previous 39288
Numerous fix-ups to C API and docs.  Added tests for C API.

Revision 39288 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 16 03:54:11 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 47584 byte(s)
Diff to previous 39287
DECREF --> XDECREF

Revision 39287 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 16 03:47:52 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 47583 byte(s)
Diff to previous 39282
Add a C API for sets and frozensets.

Revision 39282 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 13 09:28:48 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 46377 byte(s)
Diff to previous 39280
More function re-ordering (placing like functions together).

Revision 39280 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 13 08:28:03 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 46377 byte(s)
Diff to previous 39273
* Bring lookkey() and lookkey_string() closer to dict version.
* Use set_next() for looping in issubset() and frozenset_hash().
* Re-order the presentation of cmp and hash functions.

Revision 39273 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 12 20:48:39 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 46866 byte(s)
Diff to previous 39269
* Fix SF #1257731.  Make __contains__(), remove(), and discard() only do
  a frozenset conversion when the initial search attempt fails with a
  TypeError and the key is some type of set.  Add a testcase.

* Eliminate a duplicate if-stmt.

Revision 39269 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 11 07:58:45 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 46751 byte(s)
Diff to previous 39262
* Add short-circuit code for in-place operations with self (such as
  s|=s, s&=s, s-=s, or s^=s).  Add related tests.

* Improve names for several variables and functions.

* Provide alternate table access functions (next, contains, add, and discard)
  that work with an entry argument instead of just a key.  This improves
  set-vs-set operations because we already have a hash value for each key
  and can avoid unnecessary calls to PyObject_Hash().  Provides a 5% to 20%
  speed-up for quick hashing elements like strings and integers.  Provides
  much more substantial improvements for slow hashing elements like tuples
  or objects defining a custom __hash__() function.

* Have difference operations resize() when 1/5 of the elements are dummies.
  Formerly, it was 1/6.  The new ratio triggers less frequently and only
  in cases that it can resize quicker and with greater benefit.  The right
  answer is probably either 1/4, 1/5, or 1/6.  Picked the middle value for
  an even trade-off between resize time and the space/time costs of dummy
  entries.

Revision 39262 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Aug 7 13:02:53 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 45377 byte(s)
Diff to previous 39258
* Bring in INIT_NONZERO_SET_SLOTS macro from dictionary code.
* Bring in free list from dictionary code.
* Improve several comments.
* Differencing can leave many dummy entries.  If more than
  1/6 are dummies, then resize them away.
* Factor-out common code with new macro, PyAnySet_CheckExact.

Revision 39258 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 6 18:57:13 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 44300 byte(s)
Diff to previous 39257
* Removed checked_error flag which no longer provides any benefit.
* Have issubset() control its own loop instead of using set_next_internal().

Revision 39257 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 6 18:31:24 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 44367 byte(s)
Diff to previous 39256
* set_new() doesn't need to zero the structure a second time after tp_alloc
  has already done the job.
* Use a macro form of PyErr_Occurred() inside the set_lookkey() function.

Revision 39256 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Aug 6 05:43:39 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 44217 byte(s)
Diff to previous 39253
Factor away a redundant clear() function.

Revision 39253 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 5 17:19:54 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 44277 byte(s)
Diff to previous 39252
* Improve a variable name:  entry0 --> table.
* Give set_lookkey_string() a fast alternate path when no dummy entries
  are present.
* Have set_swap_bodies() reset the hash field to -1 whenever either of
  bodies is not a frozenset.  Maintains the invariant of regular sets
  always having -1 in the hash field; otherwise, any mutation would make
  the hash value invalid.
* Use an entry pointer to simplify the code in frozenset_hash().

Revision 39252 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 5 00:01:15 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 43689 byte(s)
Diff to previous 39242
* Move copyright notice to top and indicate derivation from sets.py and
  dictobject.c.
* Have frozenset_hash() use entry->hash instead of re-computing each
  individual hash with PyObject_Hash(o);
* Finalize the dummy entry before a system exit.

Revision 39242 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 2 03:45:16 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 43859 byte(s)
Diff to previous 39238
Model set.pop() after dict.popitem().

Revision 39238 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 1 21:39:29 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 43113 byte(s)
Diff to previous 39237
* Improve code for the empty frozenset singleton:
  - Handle both frozenset() and frozenset([]).
  - Do not use singleton for frozenset subclasses.
  - Finalize the singleton.
  - Add test cases.
* Factor-out set_update_internal() from set_update().  Simplifies the
  code for several internal callers.
* Factor constant expressions out of loop in set_merge_internal().
* Minor comment touch-ups.

Revision 39237 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 1 05:26:41 2005 UTC (11 years, 6 months ago) by perky
File length: 42896 byte(s)
Diff to previous 39236
Fix build on gcc: PySetIter_Type should be static in definition
part also.

Revision 39236 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jul 31 15:36:06 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 42889 byte(s)
Diff to previous 39235
Improve variable names.

Revision 39235 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jul 31 13:09:28 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 42564 byte(s)
Diff to previous 39234
Fix frozenset() ref count and a comment typo.

Revision 39234 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jul 31 01:33:10 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 42573 byte(s)
Diff to previous 39233
Comment on the set_swap_bodies() helper function.

Revision 39233 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jul 31 01:16:36 2005 UTC (11 years, 6 months ago) by rhettinger
File length: 41973 byte(s)
Diff to previous 39036
Revised the set() and frozenset() implementaion to use its own internal
data structure instead of using dictionaries.  Reduces memory consumption
by 1/3 and provides modest speed-ups for most set operations.

Revision 39036 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jun 18 21:00:26 2005 UTC (11 years, 8 months ago) by rhettinger
File length: 26253 byte(s)
Diff to previous 37811
SF patch #1200018:  Restore GC support to set objects

Reverts 1.26 and 1.27.
And adds cycle testing.

Revision 37811 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Nov 9 07:25:31 2004 UTC (12 years, 3 months ago) by rhettinger
File length: 25890 byte(s)
Diff to previous 37469
SF 1062353:  set pickling problems

Support automatic pickling of dictionaries in instance of set subclasses.

Revision 37469 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Sep 28 01:51:35 2004 UTC (12 years, 5 months ago) by rhettinger
File length: 25715 byte(s)
Diff to previous 36519
Use Py_CLEAR().  Add unrelated test.

Revision 36519 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jul 15 15:54:05 2004 UTC (12 years, 7 months ago) by mondragon
File length: 25716 byte(s)
Diff to previous 36184
Moved SunPro warning suppression into pyport.h and out of individual
modules and objects.

Revision 36184 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 17 18:27:18 2004 UTC (12 years, 8 months ago) by mondragon
File length: 25802 byte(s)
Diff to previous 36169
Fixed end-of-loop code not reached warning when using SunPro C

Revision 36169 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jun 14 04:24:41 2004 UTC (12 years, 8 months ago) by rhettinger
File length: 25716 byte(s)
Diff to previous 36159
Remove a function no longer in use.

Revision 36159 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jun 13 08:20:46 2004 UTC (12 years, 8 months ago) by rhettinger
File length: 25814 byte(s)
Diff to previous 36141
Remove unnecessary GC support.  Sets cannot have cycles.

Revision 36141 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 10 22:41:48 2004 UTC (12 years, 8 months ago) by rhettinger
File length: 26079 byte(s)
Diff to previous 36140
Futher improvements to frozenset hashing (based on Yitz Gale's battery of
tests which nicely highly highlight weaknesses).

* Initial value is now a large prime.
* Pre-multiply by the set length to add one more basis of differentiation.
* Work a bit harder inside the loop to scatter bits from sources that
  may have closely spaced hash values.

All of this is necessary to make up for keep the hash function commutative.
Fortunately, the hash value is cached so the call to frozenset_hash() will
only occur once per set.

Revision 36140 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 10 21:38:41 2004 UTC (12 years, 8 months ago) by rhettinger
File length: 26001 byte(s)
Diff to previous 35979
Fixups to the hash function for frozensets.

* Non-zero initial value so that hash(frozenset()) != hash(0).
* Final permutation to differentiate nested sets.
* Add logic to make sure that -1 is not a possible hash value.

Revision 35979 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun May 30 07:26:47 2004 UTC (12 years, 8 months ago) by rhettinger
File length: 25936 byte(s)
Diff to previous 35388
Make sets and deques weak referencable.

Revision 35388 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Mar 8 18:31:10 2004 UTC (12 years, 11 months ago) by rhettinger
File length: 25698 byte(s)
Diff to previous 35031
The copy module now handles sets directly.  The __copy__ methods are no
longer needed.

Revision 35031 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Dec 31 14:08:58 2003 UTC (13 years, 1 month ago) by rhettinger
File length: 25831 byte(s)
Diff to previous 34927
* Simplify and speedup logic for tp_print.
* Speed-up intersection whenever PyDict_Next can be used.

Revision 34927 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Dec 15 21:16:06 2003 UTC (13 years, 2 months ago) by rhettinger
File length: 25571 byte(s)
Diff to previous 34915
Speedup set.update by using the override mode for PyDict_Merge().

Revision 34915 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Dec 15 13:23:55 2003 UTC (13 years, 2 months ago) by rhettinger
File length: 25571 byte(s)
Diff to previous 34902
Improve algorithm for set.difference when the input is not a set.

Revision 34902 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Dec 13 19:38:47 2003 UTC (13 years, 2 months ago) by rhettinger
File length: 25587 byte(s)
Diff to previous 34901
* Refactor set.__contains__()
* Use Py_RETURN_NONE everywhere.
* Fix-up the firstpass check for the tp_print slot.

Revision 34901 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Dec 13 18:53:18 2003 UTC (13 years, 2 months ago) by rhettinger
File length: 25876 byte(s)
Diff to previous 34899
Refactor set.discard() and set.remove().

Revision 34899 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Dec 13 14:46:46 2003 UTC (13 years, 2 months ago) by rhettinger
File length: 26075 byte(s)
Diff to previous 34896
Use dictionary specific looping idiom where possible.
Simplifies and speeds-up the code.

Revision 34896 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Dec 13 11:26:12 2003 UTC (13 years, 2 months ago) by rhettinger
File length: 27332 byte(s)
Diff to previous 34738
* Added a new method flag, METH_COEXIST.

* Used the flag to optimize set.__contains__(), dict.__contains__(),
  dict.__getitem__(), and list.__getitem__().

Revision 34738 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Nov 25 21:12:14 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 26648 byte(s)
Diff to previous 34734
Expose dict_contains() and PyDict_Contains() with is about 10% faster
than PySequence_Contains() and more clearly applicable to dicts.

Apply the new function in setobject.c where __contains__ checking is
ubiquitous.

Revision 34734 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Nov 24 22:18:49 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 26684 byte(s)
Diff to previous 34730
Factor out more duplicate code.

Revision 34730 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Nov 24 04:13:13 2003 UTC (13 years, 3 months ago) by gvanrossum
File length: 27270 byte(s)
Diff to previous 34726
Stop GCC warning about int literal that's so long that it becomes an
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).

Revision 34726 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Nov 24 02:57:33 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 27269 byte(s)
Diff to previous 34722
* Checkin remaining documentation
* 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).

Revision 34722 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Nov 23 02:49:05 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 26805 byte(s)
Diff to previous 34720
* Simplify hash function and add test to show effectiveness of the hash
  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.

Revision 34720 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Nov 22 03:55:23 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 26580 byte(s)
Diff to previous 34713
Extend temporary hashability to remove() and discard().
Brings the functionality back in line with sets.py.

Revision 34713 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Nov 21 18:36:54 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 25752 byte(s)
Diff to previous 34712
Allow temporary hashability for the __contains__ test.
(Requested by Alex Martelli.)

Revision 34712 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Nov 21 07:56:36 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 25331 byte(s)
Diff to previous 34711
issubset() and issuperset() to work with general iterables

Revision 34711 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Nov 20 22:54:33 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 25156 byte(s)
Diff to previous 34652
Three minor performance improvements:

* 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.

Revision 34652 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Nov 18 19:27:19 2003 UTC (13 years, 3 months ago) by gvanrossum
File length: 24270 byte(s)
Diff to previous 34650
Implement straightforward suggestions from gcc warnings (remove unused
variable, add extra braces).

Revision 34650 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Nov 18 14:15:31 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 24294 byte(s)
Diff to previous 34649
Use PySequence_Contains() instead of direct access macro.

Revision 34649 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Nov 17 16:42:33 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 24444 byte(s)
Diff to previous 34648
Various fixups (most suggested by Armin Rigo).

Revision 34648 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Nov 16 16:36:58 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 24246 byte(s)
Diff to previous 34647
Fix output spacing typo

Revision 34647 - (view) (download) (as text) (annotate) - [select for diffs]
Added Sun Nov 16 16:17:49 2003 UTC (13 years, 3 months ago) by rhettinger
File length: 24245 byte(s)
* Migrate set() and frozenset() from the sandbox.
* 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.

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.


webmaster@python.org
ViewVC Help
Powered by ViewVC 1.1.5