[pypy-svn] rev 2163 - in pypy/trunk/src/pypy: interpreter objspace/flow
arigo at codespeak.net
arigo at codespeak.net
Tue Nov 4 19:35:36 CET 2003
Author: arigo
Date: Tue Nov 4 19:35:25 2003
New Revision: 2163
Modified:
pypy/trunk/src/pypy/interpreter/pyframe.py
pypy/trunk/src/pypy/objspace/flow/framestate.py
Log:
Added __eq__ on FrameBlock class.
Modified: pypy/trunk/src/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/pyframe.py (original)
+++ pypy/trunk/src/pypy/interpreter/pyframe.py Tue Nov 4 19:35:25 2003
@@ -105,6 +105,17 @@
self.handlerposition = handlerposition
self.valuestackdepth = frame.valuestack.depth()
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self.handlerposition == other.handlerposition and
+ self.valuestackdepth == other.valuestackdepth)
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ def __hash__(self):
+ return hash((self.handlerposition, self.valuestackdepth))
+
def cleanupstack(self, frame):
for i in range(self.valuestackdepth, frame.valuestack.depth()):
frame.valuestack.pop()
Modified: pypy/trunk/src/pypy/objspace/flow/framestate.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/framestate.py (original)
+++ pypy/trunk/src/pypy/objspace/flow/framestate.py Tue Nov 4 19:35:25 2003
@@ -51,8 +51,7 @@
# nonmergeable states
assert isinstance(other, FrameState)
assert len(self.mergeable) == len(other.mergeable)
- # XXX assert self.nonmergeable == other.nonmergeable
- # XXX this requires a proper __eq__ on the blockstack items
+ assert self.nonmergeable == other.nonmergeable
for w1, w2 in zip(self.mergeable, other.mergeable):
if not (w1 == w2 or (isinstance(w1, Variable) and
isinstance(w2, Variable))):
More information about the Pypy-commit
mailing list