Repository: sympy/sympy

Issue:
`solveset(sinh(x).rewrite(exp), x)` returns ImageSet containing `nan`
```
>>> x = Symbol('x')
>>> solveset(sinh(x).rewrite(exp), x)
ImageSet(Lambda(_n, nan), Integers()) U ImageSet(Lambda(_n, _n*I*pi), Integers())
```

The `ImageSet(Lambda(_n, nan))` should not be there

Discussion:

Patch:
diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py
index ff1683e1b1..f141ebb1d4 100644
--- a/sympy/solvers/solveset.py
+++ b/sympy/solvers/solveset.py
@@ -221,7 +221,7 @@ def _invert_complex(f, g_ys, symbol):
         if isinstance(g_ys, FiniteSet):
             exp_invs = Union(*[imageset(Lambda(n, I*(2*n*pi + arg(g_y)) +
                                                log(Abs(g_y))), S.Integers)
-                               for g_y in g_ys])
+                               for g_y in g_ys if g_y != 0])
             return _invert_complex(f.args[0], exp_invs, symbol)
     return (f, g_ys)
 


Test patch:
diff --git a/sympy/solvers/tests/test_solveset.py b/sympy/solvers/tests/test_solveset.py
index 7c4c6dedd9..27116b4430 100644
--- a/sympy/solvers/tests/test_solveset.py
+++ b/sympy/solvers/tests/test_solveset.py
@@ -647,6 +647,9 @@ def test_solveset_complex_exp():
         imageset(Lambda(n, I*2*n*pi), S.Integers)
     assert solveset_complex(exp(x) - I, x) == \
         imageset(Lambda(n, I*(2*n*pi + pi/2)), S.Integers)
+    assert solveset_complex(1/exp(x), x) == S.EmptySet
+    assert solveset_complex(sinh(x).rewrite(exp), x) == \
+        imageset(Lambda(n, n*pi*I), S.Integers)
 
 
 def test_solve_complex_log():