[pypy-svn] rev 1078 - pypy/trunk/src/pypy/objspace/ann
pedronis at codespeak.net
pedronis at codespeak.net
Wed Jul 2 00:52:41 CEST 2003
Author: pedronis
Date: Wed Jul 2 00:52:41 2003
New Revision: 1078
Modified:
pypy/trunk/src/pypy/objspace/ann/wrapper.py
Log:
proper behavior for W_ConstantIterator,changed flag and clone
Modified: pypy/trunk/src/pypy/objspace/ann/wrapper.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/ann/wrapper.py (original)
+++ pypy/trunk/src/pypy/objspace/ann/wrapper.py Wed Jul 2 00:52:41 2003
@@ -127,10 +127,10 @@
class W_ConstantIterator(W_Object):
- def __init__(self, seq, start=0):
+ def __init__(self, seq, start=0, changed=False):
self.seq = seq
self.start = start
- self.changed = False
+ self.changed = changed
def argsrepr(self):
return "%r, %r, chg=%r" % (self.seq, self.start,self.changed)
@@ -138,8 +138,10 @@
def __eq__(self,other):
return self is other
- def clone(self):
- return W_ConstantIterator(self.seq, self.start)
+ def clone(self, changed=None):
+ if changed is None:
+ changed = self.changed
+ return W_ConstantIterator(self.seq, self.start, changed)
def next(self):
try:
@@ -290,7 +292,7 @@
"""Return the union of two wrappers."""
if r1 is r2:
if isinstance(r1,W_ConstantIterator):
- if r1.changed: return r1.clone()
+ if r1.changed: return r1.clone(changed=False)
return r1
if r1 is None:
return r2
More information about the Pypy-commit
mailing list