sympy/sympy — pull request #1930 by skirpichev (2013-03-25 00:16:34+00:00)
Title: issue 3654: Don't do costly expand() on top of Order.__new__() method

Do expand() only for multivariate O.

Also, first patch change compute_leading_term -> as_leading_term, as ``compute_leading_term(x)`` for ``x*(1 + x**2)**10000`` calls ``expand()`` too.

This seems to be related to Add._eval_nseries method. Sometimes, it doesn't return order term (e.g. ``(1 + x**2).nseries(x)``) - that's why ``Pow._eval_nseries()`` does actually ``expand_multinomial()`` for ``x*(1 + x**2)**10000``.

N.B.: Broken test also could be fixed with changes in order.py from [this pull request](https://github.com/sympy/sympy/pull/1863).