# HG changeset patch
# User Carl Witty <cwitty@newtonlabs.com>
# Date 1194313697 28800
# Node ID 7e06c1131fb8c29a844875001b9f6b29c9313cea
# Parent  996d3484a6c138fa22288c3c5f09ad45963bdbfc
Don't recursively loop when gp overflows available memory

diff -r 996d3484a6c1 -r 7e06c1131fb8 sage/interfaces/gp.py
--- a/sage/interfaces/gp.py	Sun Nov 04 16:27:14 2007 -0800
+++ b/sage/interfaces/gp.py	Mon Nov 05 17:48:17 2007 -0800
@@ -204,7 +204,9 @@ class Gp(Expect):
                               wait_for_prompt=wait_for_prompt)
         if a.find("the PARI stack overflows") != -1:
             verbose("automatically doubling the PARI stack and re-executing current input line")
-            self.eval("allocatemem()")
+            b = self.eval("allocatemem()")
+            if b.find("Warning: not enough memory") != -1:
+                return a
             return self._eval_line(line)
         else:
             return a
