[pypy-svn] r8518 - pypy/dist/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Mon Jan 24 12:22:20 CET 2005


Author: arigo
Date: Mon Jan 24 12:22:20 2005
New Revision: 8518

Modified:
   pypy/dist/pypy/interpreter/miscutils.py
Log:
Explicitely raise ValueError on a call to Stack.top(<negative>).


Modified: pypy/dist/pypy/interpreter/miscutils.py
==============================================================================
--- pypy/dist/pypy/interpreter/miscutils.py	(original)
+++ pypy/dist/pypy/interpreter/miscutils.py	Mon Jan 24 12:22:20 2005
@@ -30,6 +30,8 @@
     def top(self, position=0):
         """'position' is 0 for the top of the stack, 1 for the item below,
         and so on.  It must not be negative."""
+        if position < 0:
+            raise ValueError, 'negative stack position'
         return self.items[~position]
 
     def depth(self):



More information about the Pypy-commit mailing list