Skip to content

Commit 46134bb

Browse files
committed
Remove compilation dependency of rings/convert/mpfi on cypari2
1 parent 9352a32 commit 46134bb

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

src/sage/doctest/rif_tol.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
# ****************************************************************************
2626

2727
from sage.doctest.marked_output import MarkedOutput
28+
from sage.rings.real_mpfi import RealIntervalField, RealIntervalFieldElement
2829

30+
_RIFtol: RealIntervalField | None = None
2931

30-
_RIFtol = None
3132

32-
33-
def RIFtol(*args):
33+
def RIFtol(*args) -> RealIntervalFieldElement:
3434
"""
3535
Create an element of the real interval field used for doctest tolerances.
3636
@@ -57,18 +57,7 @@ def RIFtol(*args):
5757
"""
5858
global _RIFtol
5959
if _RIFtol is None:
60-
try:
61-
# We need to import from sage.all to avoid circular imports.
62-
from sage.rings.real_mpfi import RealIntervalField
63-
except ImportError:
64-
from warnings import warn
65-
warn("RealIntervalField not available, ignoring all tolerance specifications in doctests")
66-
67-
def fake_RIFtol(*args):
68-
return 0
69-
_RIFtol = fake_RIFtol
70-
else:
71-
_RIFtol = RealIntervalField(1044)
60+
_RIFtol = RealIntervalField(1044)
7261
return _RIFtol(*args)
7362

7463

src/sage/rings/convert/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ foreach name, pyx : extension_data
1414
subdir: 'sage/rings/convert',
1515
install: true,
1616
include_directories: [inc_cpython, inc_rings],
17-
dependencies: [py_dep, cypari2, gmp, gsl, mpfi, mpfr, pari],
17+
dependencies: [py_dep, gmp, gsl, mpfi, mpfr],
1818
)
1919
endforeach
2020

src/sage/rings/convert/mpfi.pyx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ from sage.rings.complex_mpfr cimport ComplexNumber
3737
from sage.rings.complex_interval cimport ComplexIntervalFieldElement
3838
from sage.rings.complex_double cimport ComplexDoubleElement
3939

40-
from cypari2.gen cimport Gen
41-
4240

4341
cdef inline int return_real(mpfi_ptr im) noexcept:
4442
"""
@@ -440,6 +438,7 @@ cdef int mpfi_set_sage(mpfi_ptr re, mpfi_ptr im, x, field, int base) except -1:
440438
return return_real(im)
441439

442440
# Complex
441+
from cypari2.gen import Gen
443442
if isinstance(x, Gen):
444443
imag = x.imag()
445444
if im is NULL:

0 commit comments

Comments
 (0)