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/

     raise RuntimeError
+def throwMemoryError():
+    raise MemoryError
 def throwValueError():
     raise ValueError

File pypy/translator/jvm/src/pypy/

     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/

 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():
-                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):