diff --git a/src/sage/geometry/fan_morphism.py b/src/sage/geometry/fan_morphism.py index 7ef46b80d17..5a8aef777f8 100644 --- a/src/sage/geometry/fan_morphism.py +++ b/src/sage/geometry/fan_morphism.py @@ -89,7 +89,7 @@ from sage.modules.free_module_morphism import FreeModuleMorphism from sage.rings.infinity import Infinity from sage.rings.integer_ring import ZZ -from sage.rings.infinity import is_Infinite +from sage.rings.infinity import InfinityElement from functools import reduce @@ -1458,7 +1458,7 @@ def is_surjective(self): sage: phi.is_surjective() False """ - if is_Infinite(self.index()): + if isinstance(self.index(), InfinityElement): return False # Not surjective between vector spaces. for dcones in self.codomain_fan().cones(): for sigma_p in dcones: diff --git a/src/sage/modular/arithgroup/arithgroup_element.pyx b/src/sage/modular/arithgroup/arithgroup_element.pyx index 6bcd2c58550..db914af629b 100644 --- a/src/sage/modular/arithgroup/arithgroup_element.pyx +++ b/src/sage/modular/arithgroup/arithgroup_element.pyx @@ -375,8 +375,8 @@ cdef class ArithmeticSubgroupElement(MultiplicativeGroupElement): sage: G([1, 4, 0, 1]).acton(infinity) +Infinity """ - from sage.rings.infinity import is_Infinite, infinity - if is_Infinite(z): + from sage.rings.infinity import InfinityElement, infinity + if isinstance(z, InfinityElement): if self.c() != 0: return self.a() / self.c() else: diff --git a/src/sage/rings/infinity.py b/src/sage/rings/infinity.py index 182b2dd8b8d..16826c872ce 100644 --- a/src/sage/rings/infinity.py +++ b/src/sage/rings/infinity.py @@ -976,6 +976,10 @@ def is_Infinite(x) -> bool: EXAMPLES:: sage: sage.rings.infinity.is_Infinite(oo) + doctest:warning... + DeprecationWarning: The function is_Infinite is deprecated; + use 'isinstance(..., InfinityElement)' instead. + See https://github.com/sagemath/sage/issues/38022 for details. True sage: sage.rings.infinity.is_Infinite(-oo) True @@ -988,6 +992,9 @@ def is_Infinite(x) -> bool: sage: sage.rings.infinity.is_Infinite(ZZ) False """ + from sage.misc.superseded import deprecation + deprecation(38022, "The function is_Infinite is deprecated; use 'isinstance(..., InfinityElement)' instead.") + return isinstance(x, InfinityElement) diff --git a/src/sage/rings/multi_power_series_ring_element.py b/src/sage/rings/multi_power_series_ring_element.py index 32e16def317..70c882cc51c 100644 --- a/src/sage/rings/multi_power_series_ring_element.py +++ b/src/sage/rings/multi_power_series_ring_element.py @@ -157,7 +157,7 @@ from sage.structure.richcmp import richcmp from sage.rings.finite_rings.integer_mod_ring import Zmod -from sage.rings.infinity import infinity, is_Infinite +from sage.rings.infinity import infinity, InfinityElement from sage.rings.integer import Integer from sage.rings.polynomial.polynomial_ring import is_PolynomialRing from sage.rings.power_series_ring import is_PowerSeriesRing @@ -1956,7 +1956,7 @@ def exp(self, prec=infinity): assert (val >= 1) prec = min(prec, self.prec()) - if is_Infinite(prec): + if isinstance(prec, InfinityElement): prec = R.default_prec() n_inv_factorial = R.base_ring().one() x_pow_n = Rbg.one() @@ -2053,7 +2053,7 @@ def log(self, prec=infinity): assert (val >= 1) prec = min(prec, self.prec()) - if is_Infinite(prec): + if isinstance(prec, InfinityElement): prec = R.default_prec() x_pow_n = Rbg.one() log_x = Rbg.zero().add_bigoh(prec) diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index 8e1b76a7cc9..22a5cc46645 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -96,7 +96,7 @@ With power series the behavior is the same. # **************************************************************************** from cpython.object cimport Py_EQ, Py_NE -from sage.rings.infinity import infinity, is_Infinite +from sage.rings.infinity import infinity, InfinityElement from sage.rings.rational_field import QQ @@ -1901,7 +1901,7 @@ cdef class PowerSeries(AlgebraElement): assert(val >= 1) prec = min(prec, self.prec()) - if is_Infinite(prec): + if isinstance(prec, InfinityElement): prec = R.default_prec() n_inv_factorial = R.base_ring().one() x_pow_n = R.one() @@ -1987,7 +1987,7 @@ cdef class PowerSeries(AlgebraElement): x = self prec = min(prec, self.prec()) - if is_Infinite(prec): + if isinstance(prec, InfinityElement): prec = R.default_prec() n_inv_factorial = R.base_ring().one() x_pow_n = x @@ -2140,7 +2140,7 @@ cdef class PowerSeries(AlgebraElement): x = self prec = min(prec, self.prec()) - if is_Infinite(prec): + if isinstance(prec, InfinityElement): prec = R.default_prec() n_inv_factorial = R.base_ring().one() x_pow_n = x @@ -2228,7 +2228,7 @@ cdef class PowerSeries(AlgebraElement): assert(val >= 1) prec = min(prec, self.prec()) - if is_Infinite(prec): + if isinstance(prec, InfinityElement): prec = R.default_prec() n_inv_factorial = R.base_ring().one() x_pow_n = R.one()