[pypy-svn] r18633 - pypy/dist/pypy/interpreter/astcompiler
ac at codespeak.net
ac at codespeak.net
Sat Oct 15 16:47:23 CEST 2005
Author: ac
Date: Sat Oct 15 16:47:23 2005
New Revision: 18633
Modified:
pypy/dist/pypy/interpreter/astcompiler/pyassem.py
Log:
When comparing constants compare elements in tuples recursivly.
Modified: pypy/dist/pypy/interpreter/astcompiler/pyassem.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/pyassem.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/pyassem.py Sat Oct 15 16:47:23 2005
@@ -688,12 +688,29 @@
list.append(name)
return end
+ def _cmpConsts(self, w_left, w_right):
+ space = self.space
+ t = space.type(w_left)
+ if space.is_w(t, space.type(w_right)):
+ if space.is_w(t, space.w_tuple):
+ left_len = space.int_w(space.len(w_left))
+ right_len = space.int_w(space.len(w_right))
+ if left_len == right_len:
+ for i in range(left_len):
+ w_lefti = space.getitem(w_left, space.wrap(i))
+ w_righti = space.getitem(w_right, space.wrap(i))
+ if not self._cmpConsts(w_lefti, w_righti):
+ return False
+ return True
+ elif space.eq_w(w_left, w_right):
+ return True
+ return False
+
def _lookupConst(self, w_obj, list_w):
space = self.space
w_obj_type = space.type(w_obj)
for i in range(len(list_w)):
- cand_w = list_w[i]
- if space.is_w(space.type(cand_w), w_obj_type) and space.eq_w(list_w[i], w_obj):
+ if self._cmpConsts(w_obj, list_w[i]):
return i
end = len(list_w)
list_w.append(w_obj)
More information about the Pypy-commit
mailing list