sympy/sympy — pull request #2343 by skirpichev (2013-07-31 23:37:24+00:00)
Title: Fix issue 3900

Before:
```
In [2]: for i in tanh(1 + x).lseries(x):
...: print(i)
...: if O(i).getn() > 4:
...: break
...:
tanh(1)
-x*tanh(1)**2 + x
```

After:
```
In [1]: for i in tanh(1 + x).lseries(x):
...: print(i)
...: if O(i).getn() > 4:
...: break
...:
tanh(1)
-x*tanh(1)**2 + x
-x**2*tanh(1) + x**2*tanh(1)**3
-x**3*tanh(1)**4 - x**3/3 + 4*x**3*tanh(1)**2/3
-5*x**4*tanh(1)**3/3 + x**4*tanh(1)**5 + 2*x**4*tanh(1)/3
-17*x**5*tanh(1)**2/15 - x**5*tanh(1)**6 + 2*x**5/15 + 2*x**5*tanh(1)**4
```

The reason for this bug seems to be not related with the form of terms (e.g. not `a*(x-b)**e`). It is much simpler: we should break inner loop and not raise an exception instead.