Repository: sympy/sympy

Issue:
oo**zoo
oo**zoo give recursion error.

Discussion:

Patch:
diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py
index d1e4f02f47..22d6dc94e8 100644
--- a/sympy/core/numbers.py
+++ b/sympy/core/numbers.py
@@ -2467,6 +2467,8 @@ def _eval_power(self, expt):
             return S.Zero
         if expt is S.NaN:
             return S.NaN
+        if expt is S.ComplexInfinity:
+            return S.NaN
 
         if expt.is_number:
             return self**expt.evalf()


Test patch:
diff --git a/sympy/core/tests/test_numbers.py b/sympy/core/tests/test_numbers.py
index c5f5537266..b276249c85 100644
--- a/sympy/core/tests/test_numbers.py
+++ b/sympy/core/tests/test_numbers.py
@@ -1482,3 +1482,7 @@ def test_comp():
     assert comp(sqrt(2).n(2), Float(1.4, 2), '')
     raises(ValueError, lambda: comp(sqrt(2).n(2), 1.4, ''))
     assert comp(sqrt(2).n(2), Float(1.4, 3), '') is False
+
+
+def test_issue_9491():
+    assert oo**zoo == nan