summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-08-24 02:35:48 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-08-24 02:35:48 (GMT)
commitfa1480f6863729102ccf276e0fa8b9ea585b37c5 (patch)
tree805953e2b775945629b03d28efac85d3f570403a /Include
parent055be47b43b92bcd69cd1c536fba5e6b703d9390 (diff)
downloadcpython-fa1480f6863729102ccf276e0fa8b9ea585b37c5.zip
cpython-fa1480f6863729102ccf276e0fa8b9ea585b37c5.tar.gz
cpython-fa1480f6863729102ccf276e0fa8b9ea585b37c5.tar.bz2
1. Removed module self test in favor of unittests -- Timbot's suggestion.
2. Replaced calls to Set([]) with Set() -- Timbot's suggestion 3. Fixed subtle bug in sets of sets: The following code did not work (will add to test suite): d = Set('d') s = Set([d]) # Stores inner set as an ImmutableSet s.remove(d) # For comparison, wraps d in _TemporarilyImmutableSet The comparison proceeds by computing the hash of the _TemporarilyImmutableSet and finding it in the dictionary. It then verifies equality by calling ImmutableSet.__eq__() and crashes from the binary sanity check. The problem is that the code assumed equality would be checked with _TemporarilyImmutableSet.__eq__(). The solution is to let _TemporarilyImmutableSet derive from BaseSet so it will pass the sanity check and then to provide it with the ._data element from the wrapped set so that ImmutableSet.__eq__() will find ._data where it expects. Since ._data is now provided and because BaseSet is the base class, _TemporarilyImmutableSet no longer needs .__eq__() or .__ne__(). Note that inheriting all of BaseSet's methods is harmless because none of those methods (except ones starting with an underscore) can mutate the .data element. Also _TemporarilyImmutableSet is only used internally as is not otherwise visible.
Diffstat (limited to 'Include')
0 files changed, 0 insertions, 0 deletions