[pypy-svn] r75618 - pypy/branch/fast-forward/pypy/module/__builtin__

benjamin at codespeak.net benjamin at codespeak.net
Sat Jun 26 01:01:31 CEST 2010


Author: benjamin
Date: Sat Jun 26 01:01:28 2010
New Revision: 75618

Modified:
   pypy/branch/fast-forward/pypy/module/__builtin__/functional.py
Log:
ensure reversed argument is a sequence

Modified: pypy/branch/fast-forward/pypy/module/__builtin__/functional.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/__builtin__/functional.py	(original)
+++ pypy/branch/fast-forward/pypy/module/__builtin__/functional.py	Sat Jun 26 01:01:28 2010
@@ -433,6 +433,9 @@
 
     def __init__(self, space, w_sequence):
         self.remaining = space.int_w(space.len(w_sequence)) - 1
+        if space.lookup(w_sequence, "__getitem__") is None:
+            msg = "reversed() argument must be a sequence"
+            raise OperationError(space.w_TypeError, space.wrap(msg))
         self.w_sequence = w_sequence
 
     def descr___iter__(self, space):



More information about the Pypy-commit mailing list