Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
add a fast path to coerce()
Browse files Browse the repository at this point in the history
  • Loading branch information
mezzarobba committed Feb 27, 2019
1 parent d99f2c4 commit 3b49d0a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sage/structure/parent.pyx
Expand Up @@ -1131,7 +1131,10 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
sage: V.coerce(0)
(0, 0, 0, 0, 0, 0, 0)
"""
mor = self._internal_coerce_map_from(parent(x))
cdef R = parent(x)
if R is self:
return x
mor = self._internal_coerce_map_from(R)
if mor is None:
if is_Integer(x) and not x:
try:
Expand Down

0 comments on commit 3b49d0a

Please sign in to comment.