Commits

nikomatsakis  committed cf9eb9a

fix out of memory error and incldue a include a test

  • Participants
  • Parent commits 3a49fda

Comments (0)

Files changed (3)

File pypy/translator/jvm/prebuiltnodes.py

     raise RuntimeError
 
 @with_types([])
+def throwMemoryError():
+    raise MemoryError
+
+@with_types([])
 def throwValueError():
     raise ValueError
 

File pypy/translator/jvm/src/pypy/Interlink.java

     public void throwIndexError();
     public void throwOverflowError();
     public void throwRuntimeError();
+    public void throwMemoryError();
     public void throwValueError();
     public void throwUnicodeDecodeError();
     public void throwOSError(int errCode);

File pypy/translator/oosupport/test_template/extreme.py

 class BaseTestExtreme:
 
     def test_memoryerror_due_to_oom(self):
-        py.test.skip("can't get MemoryError except block to show up")
+        def relentless_memory_consumption_machine():
+            lst = []
+            while True: lst.append([])
+            
         def fn():
             try:
-                lst = []
-                for i in range(sys.maxint): lst.append(i)
+                relentless_memory_consumption_machine()
             except MemoryError:
                 return "OK"
+            return "How much memory do you HAVE??"
         assert self.interpret(fn, []) == "OK"
         
     def test_runtimeerror_due_to_stack_overflow(self):