Trac #15822: Tropical semiring cannot exponentiate infinity

Just found this while experimenting with my own semirings:

{{{
sage: T = TropicalSemiring(QQ)
sage: T.infinity() ** 2
------------------------------------------------------------------------
---
TypeError                                 Traceback (most recent call
last)
<ipython-input-28-b94a4a077331> in <module>()
----> 1 T.infinity() ** Integer(2)

/scratch/sage-6.1.1/local/lib/python2.7/site-
packages/sage/rings/semirings/tropical_semiring.so in
sage.rings.semirings.tropical_semiring.TropicalSemiringElement.__pow__
(sage/rings/semirings/tropical_semiring.c:4218)()

/scratch/sage-6.1.1/local/lib/python2.7/site-
packages/sage/structure/element.so in
sage.structure.element.RingElement.__mul__
(sage/structure/element.c:14520)()

/scratch/sage-6.1.1/local/lib/python2.7/site-
packages/sage/structure/coerce.so in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(sage/structure/coerce.c:8150)()

TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and
'<type 'NoneType'>'
}}}

Here is a way to solve this
(sage/rings/semirings/tropical_semiring.pyx):

{{{
    def __pow__(base, exp, dummy):
        """
        Return ``self`` to ``exp``.

        EXAMPLES::

            sage: T = TropicalSemiring(QQ)
            sage: elt = T(2)
            sage: elt**3
            6
            sage: elt**-2
            -4
            sage: elt**(3/7)
            6/7
            sage: elt**0
            0

            sage: elt = T.infinity()
            sage: elt**0
            0
            sage: elt**(1/2)
            +infinity
            sage: elt*33
            +infinity
        """
        cdef TropicalSemiringElement self, x
        self = base
        if self._val is None:
            if exp > 0:
                return self
            elif exp == 0:
                return self.parent().one()
            raise ZeroDivisionError("Tropical division by infinity")
        x = self._new()
        x._val = exp*self._val
        return x
}}}

Is this good? (I cannot upload branches from here -- "fatal: remote
error: access denied or repository not exported: /sage.git")

URL: http://trac.sagemath.org/15822
Reported by: darij
Ticket author(s): Darij Grinberg
Reviewer(s): Travis Scrimshaw
Trac #15841: sage.combinat.finite_state_machine: incorrect indent in docstring

There was an indentation error in the docstring of class
{{{sage.combinat.finite_state_machine.FiniteStateMachine}}}
starting at {{{TESTS::}}}.

URL: http://trac.sagemath.org/15841
Reported by: cheuberg
Ticket author(s): Clemens Heuberger
Reviewer(s): Daniel Krenn