From 31a98e235afa24e1e3e8196e52bd7c46dbc1863d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 1 Oct 2024 23:21:35 -0300 Subject: [PATCH 01/21] pari: update to 2.17.0. --- common/shlibs | 2 +- ...1f63771186bf01bbb2a1f3351688c3269fe4.patch | 21 +++++++++++++++++++ srcpkgs/pari/template | 4 ++-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/pari/patches/1ac81f63771186bf01bbb2a1f3351688c3269fe4.patch diff --git a/common/shlibs b/common/shlibs index e4f09f58695930..60946e5198feec 100644 --- a/common/shlibs +++ b/common/shlibs @@ -4196,7 +4196,7 @@ libsimavrparts.so.1 simavr-1.6_2 libsword-1.8.1.so libsword-1.8.1_6 libgivaro.so.9 givaro-4.1.1_1 liblinbox.so.0 linbox-1.6.3_1 -libpari-gmp-tls.so.8 pari-2.15.0_1 +libpari-gmp-tls.so.9 pari-2.17.0_1 libtree-sitter.so.0.24 tree-sitter-0.24.3_1 libplanarity.so.0 planarity-3.0.1.1_1 libgap.so.9 gap-4.13.0_1 diff --git a/srcpkgs/pari/patches/1ac81f63771186bf01bbb2a1f3351688c3269fe4.patch b/srcpkgs/pari/patches/1ac81f63771186bf01bbb2a1f3351688c3269fe4.patch new file mode 100644 index 00000000000000..30506cdf9dcdf0 --- /dev/null +++ b/srcpkgs/pari/patches/1ac81f63771186bf01bbb2a1f3351688c3269fe4.patch @@ -0,0 +1,21 @@ +From: Bill Allombert +Date: Tue, 1 Oct 2024 21:54:34 +0000 (+0200) +Subject: qfcvp: fix prototype code [#2575] +X-Git-Url: https://pari.math.u-bordeaux.fr/cgi-bin/sgitweb.cgi?p=pari.git;a=commitdiff_plain;h=1ac81f63771186bf01bbb2a1f3351688c3269fe4 + +qfcvp: fix prototype code [#2575] +--- + +diff --git a/src/functions/linear_algebra/qfcvp b/src/functions/linear_algebra/qfcvp +index 5ee883390a..7be5fa9570 100644 +--- a/src/functions/linear_algebra/qfcvp ++++ b/src/functions/linear_algebra/qfcvp +@@ -1,7 +1,7 @@ + Function: qfcvp + Section: linear_algebra + C-Name: qfcvp0 +-Prototype: GGDGDGD0,L,p ++Prototype: GGDGDGD0,L, + Help: qfcvp(x,t,{B},{m},{flag=0}): x being a square and symmetric + matrix representing a positive definite quadratic form, and t a vector of + the same dimension, this function deals with the vectors of whose squared diff --git a/srcpkgs/pari/template b/srcpkgs/pari/template index 6b2c5c00a1b7b2..116995aa672741 100644 --- a/srcpkgs/pari/template +++ b/srcpkgs/pari/template @@ -1,6 +1,6 @@ # Template file for 'pari' pkgname=pari -version=2.15.5 +version=2.17.0 revision=1 build_style=configure build_helper=qemu @@ -19,7 +19,7 @@ license="GPL-2.0-or-later" homepage="https://pari.math.u-bordeaux.fr" changelog="https://pari.math.u-bordeaux.fr/cgi-bin/gitweb.cgi?p=pari.git;a=blob_plain;f=CHANGES;hb=refs/heads/pari-${version%.*}" distfiles="https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-${version}.tar.gz" -checksum=0efdda7515d9d954f63324c34b34c560e60f73a81c3924a71260a2cc91d5f981 +checksum=e723e7cef18d08c6ece2283af9a9b4d56077c22b4fce998faaa588d389b1aea8 build_options="x11 pthreads" build_options_default="x11 pthreads" From 7a2b5da39833d90827c8aae43433585cc368cf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 1 Oct 2024 23:33:00 -0300 Subject: [PATCH 02/21] eclib: revbump for pari-2.17.0_1 --- srcpkgs/eclib/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/eclib/template b/srcpkgs/eclib/template index dd22d4e6de6f31..37a878b35b3e57 100644 --- a/srcpkgs/eclib/template +++ b/srcpkgs/eclib/template @@ -1,7 +1,7 @@ # Template file for 'eclib' pkgname=eclib version=20240408 -revision=1 +revision=2 build_style=gnu-configure configure_args="--with-flint --with-boost" makedepends="pari-devel ntl-devel flintlib-devel boost-devel" From 447c0456b78f9c46cfc7b95b65eef8935929b2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Wed, 30 Oct 2024 20:45:09 -0300 Subject: [PATCH 03/21] giac: revbump for pari-2.17.0_1 --- srcpkgs/giac/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/giac/template b/srcpkgs/giac/template index 82a3381723d8d3..c3737e0ef946de 100644 --- a/srcpkgs/giac/template +++ b/srcpkgs/giac/template @@ -1,7 +1,7 @@ # Template file for 'giac' pkgname=giac version=1.9.0.995 -revision=1 +revision=2 build_style=gnu-configure configure_args="--disable-micropy --disable-quickjs" hostmakedepends="automake gettext-devel libtool" From 02df2fc4bc86ebda7c96ec3a255902e0856661af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 1 Oct 2024 23:33:01 -0300 Subject: [PATCH 04/21] lcalc: revbump for pari-2.17.0_1 --- srcpkgs/lcalc/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/lcalc/template b/srcpkgs/lcalc/template index 3c6be5fcbc2828..aaab6d14ead440 100644 --- a/srcpkgs/lcalc/template +++ b/srcpkgs/lcalc/template @@ -1,7 +1,7 @@ # Template file for 'lcalc' pkgname=lcalc version=2.0.5 -revision=2 +revision=3 build_style=gnu-configure configure_args="--with-pari" hostmakedepends="automake libtool pkg-config gengetopt" From d0c15a15974b25144f396f860f988be46c290d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 1 Oct 2024 23:33:01 -0300 Subject: [PATCH 05/21] python3-cysignals: revbump for pari-2.17.0_1 --- srcpkgs/python3-cysignals/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/python3-cysignals/template b/srcpkgs/python3-cysignals/template index 6cd461880c9d6f..cf39b51cedeafc 100644 --- a/srcpkgs/python3-cysignals/template +++ b/srcpkgs/python3-cysignals/template @@ -1,7 +1,7 @@ # Template file for 'python3-cysignals' pkgname=python3-cysignals version=1.11.4 -revision=1 +revision=2 # need gnu-configure build style to support cross build build_style=gnu-configure build_helper=python3 From 1c057b01589a348b4c65c7b350809a1cd03e7b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 1 Oct 2024 23:33:01 -0300 Subject: [PATCH 06/21] python3-cypari2: revbump and patch for pari-2.17.0_1 --- srcpkgs/python3-cypari2/patches/165.patch | 38 ++ srcpkgs/python3-cypari2/patches/166.diff | 442 +++++++++++++++++++++ srcpkgs/python3-cypari2/patches/166a.patch | 65 +++ srcpkgs/python3-cypari2/patches/167.patch | 31 ++ srcpkgs/python3-cypari2/template | 2 +- 5 files changed, 577 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/python3-cypari2/patches/165.patch create mode 100644 srcpkgs/python3-cypari2/patches/166.diff create mode 100644 srcpkgs/python3-cypari2/patches/166a.patch create mode 100644 srcpkgs/python3-cypari2/patches/167.patch diff --git a/srcpkgs/python3-cypari2/patches/165.patch b/srcpkgs/python3-cypari2/patches/165.patch new file mode 100644 index 00000000000000..e7e01b71c06fcb --- /dev/null +++ b/srcpkgs/python3-cypari2/patches/165.patch @@ -0,0 +1,38 @@ +See: https://github.com/sagemath/cypari2/pull/165 +and https://github.com/sagemath/sage/pull/38749 + +From 0a5a7b42e53d065f8d78bdaa8181d6afa20d1f4f Mon Sep 17 00:00:00 2001 +From: Antonio Rojas +Date: Tue, 1 Oct 2024 18:54:19 +0200 +Subject: [PATCH] Add pari_PRIMES declaration + +Needed to port sagemath to work with pari 2.17 +--- + cypari2/paridecl.pxd | 1 + + cypari2/types.pxd | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/cypari2/paridecl.pxd b/cypari2/paridecl.pxd +index 29cb8ef..9ccf336 100644 +--- a/cypari2/paridecl.pxd ++++ b/cypari2/paridecl.pxd +@@ -118,6 +118,7 @@ cdef extern from *: # PARI headers already included by types.pxd + extern PariOUT* pariOut + extern PariOUT* pariErr + extern byteptr diffptr ++ extern pari_prime* pari_PRIMES + + ############################################### + # # +diff --git a/cypari2/types.pxd b/cypari2/types.pxd +index 9ee4fe6..7f00b52 100644 +--- a/cypari2/types.pxd ++++ b/cypari2/types.pxd +@@ -24,6 +24,7 @@ cdef extern from "pari/pari.h": + ctypedef long* GEN + ctypedef char* byteptr + ctypedef unsigned long pari_sp ++ ctypedef unsigned long pari_prime + + # PARI types + enum: diff --git a/srcpkgs/python3-cypari2/patches/166.diff b/srcpkgs/python3-cypari2/patches/166.diff new file mode 100644 index 00000000000000..c5a6f9a617d98b --- /dev/null +++ b/srcpkgs/python3-cypari2/patches/166.diff @@ -0,0 +1,442 @@ +diff --git a/autogen/args.py b/autogen/args.py +index cd84008..02c57b9 100644 +--- a/autogen/args.py ++++ b/autogen/args.py +@@ -304,11 +304,11 @@ def _typerepr(self): + def ctype(self): + return "long" + def always_default(self): +- return "0" ++ return "DEFAULT_BITPREC" + def get_argument_name(self, namesiter): + return "precision" + def c_convert_code(self): +- s = " {name} = prec_bits_to_words({name})\n" ++ s = " {name} = nbits2prec({name})\n" + return s.format(name=self.name) + + class PariArgumentBitprec(PariArgumentClass): +@@ -317,13 +317,9 @@ def _typerepr(self): + def ctype(self): + return "long" + def always_default(self): +- return "0" ++ return "DEFAULT_BITPREC" + def get_argument_name(self, namesiter): + return "precision" +- def c_convert_code(self): +- s = " if not {name}:\n" +- s += " {name} = default_bitprec()\n" +- return s.format(name=self.name) + + class PariArgumentSeriesPrec(PariArgumentClass): + def _typerepr(self): +diff --git a/autogen/doc.py b/autogen/doc.py +index 711827b..c71e7c6 100644 +--- a/autogen/doc.py ++++ b/autogen/doc.py +@@ -289,7 +289,7 @@ def get_rest_doc(function): + >>> from autogen.doc import get_rest_doc + >>> print(get_rest_doc("teichmuller")) + Teichmüller character of the :math:`p`-adic number :math:`x`, i.e. the unique +- :math:`(p-1)`-th root of unity congruent to :math:`x / p^{v_p(x)}` modulo :math:`p`... ++ :math:`(p-1)`-th root of unity congruent to :math:`x / p^{v_...(x)}` modulo :math:`p`... + + :: + +@@ -300,24 +300,24 @@ def get_rest_doc(function): + .. MATH:: + + f(x) = \exp (-i\pi/24).\eta ((x+1)/2)/\eta (x) {such that} +- j = (f^{24}-16)^3/f^{24}, ++ j = (f^{24}-16)^.../f^{24}, + + where :math:`j` is the elliptic :math:`j`-invariant (see the function :literal:`ellj`). + If :math:`flag = 1`, returns + + .. MATH:: + +- f_1(x) = \eta (x/2)/\eta (x) {such that} +- j = (f_1^{24}+16)^3/f_1^{24}. ++ f_...(x) = \eta (x/2)/\eta (x) {such that} ++ j = (f_...^{24}+16)^.../f_...^{24}. + + Finally, if :math:`flag = 2`, returns + + .. MATH:: + +- f_2(x) = \sqrt{2}\eta (2x)/\eta (x) {such that} +- j = (f_2^{24}+16)^3/f_2^{24}. ++ f_...(x) = \sqrt{2}\eta (2x)/\eta (x) {such that} ++ j = (f_...^{24}+16)^.../f_...^{24}. + +- Note the identities :math:`f^8 = f_1^8+f_2^8` and :math:`ff_1f_2 = \sqrt2`. ++ Note the identities :math:`f^... = f_...^...+f_...^...` and :math:`ff_...f_... = \sqrt2`. + + + :: +@@ -333,7 +333,7 @@ def get_rest_doc(function): + .. MATH:: + + \sum +- (x_i or y_i) 2^i ++ (x_... or y_...) 2^... + + See ``bitand`` (in the PARI manual) for the behavior for negative arguments. + """ +diff --git a/autogen/generator.py b/autogen/generator.py +index 048adce..4154723 100644 +--- a/autogen/generator.py ++++ b/autogen/generator.py +@@ -139,7 +139,7 @@ def handle_pari_function(self, function, cname, prototype="", help="", obsolete= + ... help=r"bnfinit(P,{flag=0},{tech=[]}): compute...", + ... **{"class":"basic", "section":"number_fields"}) + GEN bnfinit0(GEN, long, GEN, long) +- def bnfinit(P, long flag=0, tech=None, long precision=0): ++ def bnfinit(P, long flag=0, tech=None, long precision=DEFAULT_BITPREC): + ... + cdef bint _have_tech = (tech is not None) + if _have_tech: +@@ -149,7 +149,7 @@ def bnfinit(P, long flag=0, tech=None, long precision=0): + cdef GEN _tech = NULL + if _have_tech: + _tech = (tech).g +- precision = prec_bits_to_words(precision) ++ precision = nbits2prec(precision) + cdef GEN _ret = bnfinit0(_P, flag, _tech, precision) + return new_gen(_ret) + +diff --git a/autogen/parser.py b/autogen/parser.py +index d910946..a7fe02f 100644 +--- a/autogen/parser.py ++++ b/autogen/parser.py +@@ -109,7 +109,7 @@ def parse_prototype(proto, help, initial_args=[]): + >>> parse_prototype(proto, help) + ([GEN x, GEN* r=NULL], GEN) + >>> parse_prototype("lp", "foo()", [str("TEST")]) +- (['TEST', prec precision=0], long) ++ (['TEST', prec precision=DEFAULT_BITPREC], long) + """ + # Use the help string just for the argument names. + # "names" should be an iterator over the argument names. +diff --git a/cypari2/gen.pyx b/cypari2/gen.pyx +index a109244..d910ae5 100644 +--- a/cypari2/gen.pyx ++++ b/cypari2/gen.pyx +@@ -66,8 +66,7 @@ from .types cimport * + from .string_utils cimport to_string, to_bytes + from .paripriv cimport * + from .convert cimport PyObject_AsGEN, gen_to_integer +-from .pari_instance cimport (prec_bits_to_words, +- default_bitprec, get_var) ++from .pari_instance cimport DEFAULT_BITPREC, get_var + from .stack cimport (new_gen, new_gens2, new_gen_noclear, + clone_gen, clear_stack, reset_avma, + remove_from_pari_stack, move_gens_to_heap) +@@ -647,7 +646,7 @@ cdef class Gen(Gen_base): + if m is not None: + t0 = t0.Mod(m) + sig_on() +- return new_gen(gpow(t0.g, t1.g, prec_bits_to_words(0))) ++ return new_gen(gpow(t0.g, t1.g, nbits2prec(DEFAULT_BITPREC))) + + def __neg__(self): + sig_on() +@@ -902,6 +901,7 @@ cdef class Gen(Gen_base): + + >>> x = pari('x') + ++ >>> pari.setrand(1) + >>> (x**2 - 65).bnfinit().bnf_get_fu() + [Mod(x - 8, x^2 - 65)] + >>> (x**4 - x**2 + 1).bnfinit().bnf_get_fu() +@@ -951,6 +951,7 @@ cdef class Gen(Gen_base): + >>> import warnings + >>> with warnings.catch_warnings(record=True) as w: + ... warnings.simplefilter('always') ++ ... pari.setrand(1) + ... funits = (x**2 - 65).bnfinit().bnfunit() + ... assert len(w) == 1 + ... assert issubclass(w[0].category, DeprecationWarning) +@@ -2911,7 +2912,7 @@ cdef class Gen(Gen_base): + sig_on() + return new_gen(bernfrac(self)) + +- def bernreal(self, unsigned long precision=0): ++ def bernreal(self, unsigned long precision=DEFAULT_BITPREC): + r""" + The Bernoulli number `B_x`, as for the function bernfrac, + but `B_x` is returned as a real number (with the current +@@ -2926,9 +2927,9 @@ cdef class Gen(Gen_base): + 54.9711779448622 + """ + sig_on() +- return new_gen(bernreal(self, prec_bits_to_words(precision))) ++ return new_gen(bernreal(self, nbits2prec(precision))) + +- def besselk(nu, x, unsigned long precision=0): ++ def besselk(nu, x, unsigned long precision=DEFAULT_BITPREC): + """ + nu.besselk(x): K-Bessel function (modified Bessel function + of the second kind) of index nu, which can be complex, and argument +@@ -2963,9 +2964,9 @@ cdef class Gen(Gen_base): + """ + cdef Gen t0 = objtogen(x) + sig_on() +- return new_gen(kbessel(nu.g, t0.g, prec_bits_to_words(precision))) ++ return new_gen(kbessel(nu.g, t0.g, nbits2prec(precision))) + +- def eint1(x, long n=0, unsigned long precision=0): ++ def eint1(x, long n=0, unsigned long precision=DEFAULT_BITPREC): + r""" + x.eint1(n): exponential integral E1(x): + +@@ -2991,13 +2992,14 @@ cdef class Gen(Gen_base): + """ + sig_on() + if n <= 0: +- return new_gen(eint1(x.g, prec_bits_to_words(precision))) ++ return new_gen(eint1(x.g, nbits2prec(precision))) + else: +- return new_gen(veceint1(x.g, stoi(n), prec_bits_to_words(precision))) ++ return new_gen(veceint1(x.g, stoi(n), nbits2prec(precision))) + + log_gamma = Gen_base.lngamma + +- def polylog(x, long m, long flag=0, unsigned long precision=0): ++ def polylog(x, long m, long flag=0, ++ unsigned long precision=DEFAULT_BITPREC): + """ + x.polylog(m,flag=0): m-th polylogarithm of x. flag is optional, and + can be 0: default, 1: D_m -modified m-th polylog of x, 2: +@@ -3026,9 +3028,9 @@ cdef class Gen(Gen_base): + -0.400459056163451 + """ + sig_on() +- return new_gen(polylog0(m, x.g, flag, prec_bits_to_words(precision))) ++ return new_gen(polylog0(m, x.g, flag, nbits2prec(precision))) + +- def sqrtn(x, n, unsigned long precision=0): ++ def sqrtn(x, n, unsigned long precision=DEFAULT_BITPREC): + r""" + x.sqrtn(n): return the principal branch of the n-th root of x, + i.e., the one such that +@@ -3090,7 +3092,7 @@ cdef class Gen(Gen_base): + cdef GEN ans, zetan + cdef Gen t0 = objtogen(n) + sig_on() +- ans = gsqrtn(x.g, t0.g, &zetan, prec_bits_to_words(precision)) ++ ans = gsqrtn(x.g, t0.g, &zetan, nbits2prec(precision)) + return new_gens2(ans, zetan) + + def ffprimroot(self): +@@ -4531,7 +4533,8 @@ cdef class Gen(Gen_base): + g = polint(self.g, t0.g, t1.g, &dy) + return new_gens2(g, dy) + +- def ellwp(self, z='z', long n=20, long flag=0, unsigned long precision=0): ++ def ellwp(self, z='z', long n=20, long flag=0, ++ unsigned long precision=DEFAULT_BITPREC): + """ + Return the value or the series expansion of the Weierstrass + `P`-function at `z` on the lattice `self` (or the lattice +@@ -4609,7 +4612,7 @@ cdef class Gen(Gen_base): + elif typ(g0) == t_RFRAC: + g0 = rfrac_to_ser(g0, n+4) + +- cdef GEN r = ellwp0(self.g, g0, flag, prec_bits_to_words(precision)) ++ cdef GEN r = ellwp0(self.g, g0, flag, nbits2prec(precision)) + if flag == 1 and have_ellwp_flag1_bug(): + # Work around ellwp() bug: double the second element + set_gel(r, 2, gmulgs(gel(r, 2), 2)) +diff --git a/cypari2/pari_instance.pxd b/cypari2/pari_instance.pxd +index f239487..d56f2c2 100644 +--- a/cypari2/pari_instance.pxd ++++ b/cypari2/pari_instance.pxd +@@ -3,10 +3,14 @@ cimport cython + + from .gen cimport Gen + +-cpdef long prec_bits_to_words(unsigned long prec_in_bits) noexcept +-cpdef long prec_words_to_bits(long prec_in_words) noexcept + cpdef long default_bitprec() noexcept + ++cdef extern from *: ++ """ ++ #define DEFAULT_BITPREC prec2nbits(DEFAULTPREC) ++ """ ++ long DEFAULT_BITPREC ++ + cdef class Pari_auto: + pass + +diff --git a/cypari2/pari_instance.pyx b/cypari2/pari_instance.pyx +index 65d705a..cfb8ecc 100644 +--- a/cypari2/pari_instance.pyx ++++ b/cypari2/pari_instance.pyx +@@ -235,9 +235,9 @@ Verify that ``nfroots()`` (which has an unusual signature with a + non-default argument following a default argument) works: + + >>> pari.nfroots(x='x^4 - 1') +-[-1, 1] ++[-1, 1]... + >>> pari.nfroots(pari.nfinit('t^2 + 1'), "x^4 - 1") +-[-1, 1, Mod(-t, t^2 + 1), Mod(t, t^2 + 1)] ++[-1, 1, Mod(-t, t^2 + 1), Mod(t, t^2 + 1)]... + + Reset default precision for the following tests: + +@@ -299,10 +299,6 @@ from .stack cimport (new_gen, new_gen_noclear, clear_stack, + from .handle_error cimport _pari_init_error_handling + from .closure cimport _pari_init_closure + +-# Default precision (in PARI words) for the PARI library interface, +-# when no explicit precision is given and the inputs are exact. +-cdef long prec = prec_bits_to_words(53) +- + + ################################################################# + # conversions between various real precision models +@@ -341,57 +337,6 @@ def prec_dec_to_bits(long prec_in_dec): + return int(prec_in_dec*log_10 + 1.0) # Add one to round up + + +-cpdef long prec_bits_to_words(unsigned long prec_in_bits) noexcept: +- r""" +- Convert from precision expressed in bits to pari real precision +- expressed in words. Note: this rounds up to the nearest word, +- adjusts for the two codewords of a pari real, and is +- architecture-dependent. +- +- Examples: +- +- >>> from cypari2.pari_instance import prec_bits_to_words +- >>> import sys +- >>> bitness = '64' if sys.maxsize > (1 << 32) else '32' +- >>> prec_bits_to_words(70) == (5 if bitness == '32' else 4) +- True +- +- >>> ans32 = [(32, 3), (64, 4), (96, 5), (128, 6), (160, 7), (192, 8), (224, 9), (256, 10)] +- >>> ans64 = [(32, 3), (64, 3), (96, 4), (128, 4), (160, 5), (192, 5), (224, 6), (256, 6)] +- >>> [(32*n, prec_bits_to_words(32*n)) for n in range(1, 9)] == (ans32 if bitness == '32' else ans64) +- True +- """ +- if not prec_in_bits: +- return prec +- cdef unsigned long wordsize = BITS_IN_LONG +- +- # This equals ceil(prec_in_bits/wordsize) + 2 +- return (prec_in_bits - 1)//wordsize + 3 +- +- +-cpdef long prec_words_to_bits(long prec_in_words) noexcept: +- r""" +- Convert from pari real precision expressed in words to precision +- expressed in bits. Note: this adjusts for the two codewords of a +- pari real, and is architecture-dependent. +- +- Examples: +- +- >>> from cypari2.pari_instance import prec_words_to_bits +- >>> import sys +- >>> bitness = '64' if sys.maxsize > (1 << 32) else '32' +- >>> prec_words_to_bits(10) == (256 if bitness == '32' else 512) +- True +- +- >>> ans32 = [(3, 32), (4, 64), (5, 96), (6, 128), (7, 160), (8, 192), (9, 224)] +- >>> ans64 = [(3, 64), (4, 128), (5, 192), (6, 256), (7, 320), (8, 384), (9, 448)] # 64-bit +- >>> [(n, prec_words_to_bits(n)) for n in range(3, 10)] == (ans32 if bitness == '32' else ans64) +- True +- """ +- # see user's guide to the pari library, page 10 +- return (prec_in_words - 2) * BITS_IN_LONG +- +- + cpdef long default_bitprec() noexcept: + r""" + Return the default precision in bits. +@@ -402,51 +347,7 @@ cpdef long default_bitprec() noexcept: + >>> default_bitprec() + 64 + """ +- return (prec - 2) * BITS_IN_LONG +- +- +-def prec_dec_to_words(long prec_in_dec): +- r""" +- Convert from precision expressed in decimal to precision expressed +- in words. Note: this rounds up to the nearest word, adjusts for the +- two codewords of a pari real, and is architecture-dependent. +- +- Examples: +- +- >>> from cypari2.pari_instance import prec_dec_to_words +- >>> import sys +- >>> bitness = '64' if sys.maxsize > (1 << 32) else '32' +- >>> prec_dec_to_words(38) == (6 if bitness == '32' else 4) +- True +- +- >>> ans32 = [(10, 4), (20, 5), (30, 6), (40, 7), (50, 8), (60, 9), (70, 10), (80, 11)] +- >>> ans64 = [(10, 3), (20, 4), (30, 4), (40, 5), (50, 5), (60, 6), (70, 6), (80, 7)] # 64-bit +- >>> [(n, prec_dec_to_words(n)) for n in range(10, 90, 10)] == (ans32 if bitness == '32' else ans64) +- True +- """ +- return prec_bits_to_words(prec_dec_to_bits(prec_in_dec)) +- +- +-def prec_words_to_dec(long prec_in_words): +- r""" +- Convert from precision expressed in words to precision expressed in +- decimal. Note: this adjusts for the two codewords of a pari real, +- and is architecture-dependent. +- +- Examples: +- +- >>> from cypari2.pari_instance import prec_words_to_dec +- >>> import sys +- >>> bitness = '64' if sys.maxsize > (1 << 32) else '32' +- >>> prec_words_to_dec(5) == (28 if bitness == '32' else 57) +- True +- +- >>> ans32 = [(3, 9), (4, 19), (5, 28), (6, 38), (7, 48), (8, 57), (9, 67)] +- >>> ans64 = [(3, 19), (4, 38), (5, 57), (6, 77), (7, 96), (8, 115), (9, 134)] +- >>> [(n, prec_words_to_dec(n)) for n in range(3, 10)] == (ans32 if bitness == '32' else ans64) +- True +- """ +- return prec_bits_to_dec(prec_words_to_bits(prec_in_words)) ++ return DEFAULT_BITPREC + + + # Callbacks from PARI to print stuff using sys.stdout.write() instead +diff --git a/cypari2/paridecl.pxd b/cypari2/paridecl.pxd +index 9ccf336..7b8d12d 100644 +--- a/cypari2/paridecl.pxd ++++ b/cypari2/paridecl.pxd +@@ -5107,6 +5107,7 @@ cdef extern from *: # PARI headers already included by types.pxd + void killblock(GEN x) + GEN leading_coeff(GEN x) + void lg_increase(GEN x) ++ long lg2prec(long x) + long lgcols(GEN x) + long lgpol(GEN x) + GEN matpascal(long n) +@@ -5196,6 +5197,7 @@ cdef extern from *: # PARI headers already included by types.pxd + GEN polx_zx(long sv) + GEN powii(GEN x, GEN n) + GEN powIs(long n) ++ long prec2lg(long x) + long prec2nbits(long x) + double prec2nbits_mul(long x, double y) + long prec2ndec(long x) +diff --git a/cypari2/types.pxd b/cypari2/types.pxd +index 7f00b52..2c6487d 100644 +--- a/cypari2/types.pxd ++++ b/cypari2/types.pxd +@@ -53,6 +53,7 @@ cdef extern from "pari/pari.h": + t_INFINITY + + int BITS_IN_LONG ++ int LOWDEFAULTPREC + long DEFAULTPREC # 64 bits precision + long MEDDEFAULTPREC # 128 bits precision + long BIGDEFAULTPREC # 192 bits precision diff --git a/srcpkgs/python3-cypari2/patches/166a.patch b/srcpkgs/python3-cypari2/patches/166a.patch new file mode 100644 index 00000000000000..1abdb6d6146108 --- /dev/null +++ b/srcpkgs/python3-cypari2/patches/166a.patch @@ -0,0 +1,65 @@ +From 137caa8d45e39f103c19a7d29f85a8d158ecdbde Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= +Date: Sat, 2 Nov 2024 12:55:54 -0300 +Subject: [PATCH] Restore prec_words_to_bits as deprecated function + +This is needed to support sagemath < 10.5. +--- + cypari2/pari_instance.pxd | 2 ++ + cypari2/pari_instance.pyx | 30 ++++++++++++++++++++++++++++++ + 2 files changed, 32 insertions(+) + +diff --git a/cypari2/pari_instance.pxd b/cypari2/pari_instance.pxd +index d56f2c2..d6a75a7 100644 +--- a/cypari2/pari_instance.pxd ++++ b/cypari2/pari_instance.pxd +@@ -3,6 +3,8 @@ cimport cython + + from .gen cimport Gen + ++# DEPRECATED INTERNAL FUNCTION used (incorrectly) in sagemath < 10.5 ++cpdef long prec_words_to_bits(long prec_in_words) noexcept + cpdef long default_bitprec() noexcept + + cdef extern from *: +diff --git a/cypari2/pari_instance.pyx b/cypari2/pari_instance.pyx +index cfb8ecc..3e21a7d 100644 +--- a/cypari2/pari_instance.pyx ++++ b/cypari2/pari_instance.pyx +@@ -337,6 +337,36 @@ def prec_dec_to_bits(long prec_in_dec): + return int(prec_in_dec*log_10 + 1.0) # Add one to round up + + ++cpdef long prec_words_to_bits(long prec_in_words) noexcept: ++ r""" ++ Deprecated internal function. Used (incorrectly) in sagemath < 10.5. ++ ++ Convert from pari real precision expressed in words to precision ++ expressed in bits. Note: this adjusts for the two codewords of a ++ pari real, and is architecture-dependent. ++ ++ Examples: ++ ++ >>> from cypari2.pari_instance import prec_words_to_bits ++ >>> import sys ++ >>> import warnings ++ >>> warnings.simplefilter("ignore") ++ >>> bitness = '64' if sys.maxsize > (1 << 32) else '32' ++ >>> prec_words_to_bits(10) == (256 if bitness == '32' else 512) ++ True ++ ++ >>> ans32 = [(3, 32), (4, 64), (5, 96), (6, 128), (7, 160), (8, 192), (9, 224)] ++ >>> ans64 = [(3, 64), (4, 128), (5, 192), (6, 256), (7, 320), (8, 384), (9, 448)] # 64-bit ++ >>> [(n, prec_words_to_bits(n)) for n in range(3, 10)] == (ans32 if bitness == '32' else ans64) ++ True ++ """ ++ from warnings import warn ++ warn("'prec_words_to_bits` in cypari2 is internal and deprecated", ++ DeprecationWarning) ++ # see user's guide to the pari library, page 10 ++ return (prec_in_words - 2) * BITS_IN_LONG ++ ++ + cpdef long default_bitprec() noexcept: + r""" + Return the default precision in bits. diff --git a/srcpkgs/python3-cypari2/patches/167.patch b/srcpkgs/python3-cypari2/patches/167.patch new file mode 100644 index 00000000000000..6b9678cb2ffe8c --- /dev/null +++ b/srcpkgs/python3-cypari2/patches/167.patch @@ -0,0 +1,31 @@ +From 796b90d19442d2f704fd2916457601cf6c65f0d9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= +Date: Wed, 30 Oct 2024 17:52:04 -0300 +Subject: [PATCH] fix implicit noexcept warnings + +--- + cypari2/custom_block.pyx | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/cypari2/custom_block.pyx b/cypari2/custom_block.pyx +index ddbb829..67419f8 100644 +--- a/cypari2/custom_block.pyx ++++ b/cypari2/custom_block.pyx +@@ -12,14 +12,14 @@ from cysignals.signals cimport add_custom_signals + cdef extern from "pari/pari.h": + int PARI_SIGINT_block, PARI_SIGINT_pending + +-cdef int custom_signal_is_blocked(): ++cdef int custom_signal_is_blocked() noexcept: + return PARI_SIGINT_block + +-cdef void custom_signal_unblock(): ++cdef void custom_signal_unblock() noexcept: + global PARI_SIGINT_block + PARI_SIGINT_block = 0 + +-cdef void custom_set_pending_signal(int sig): ++cdef void custom_set_pending_signal(int sig) noexcept: + global PARI_SIGINT_pending + PARI_SIGINT_pending = sig + diff --git a/srcpkgs/python3-cypari2/template b/srcpkgs/python3-cypari2/template index 2a6b284f2f0ab1..e6f2dbb7e4ee5b 100644 --- a/srcpkgs/python3-cypari2/template +++ b/srcpkgs/python3-cypari2/template @@ -1,7 +1,7 @@ # Template file for 'python3-cypari2' pkgname=python3-cypari2 version=2.2.0 -revision=1 +revision=2 build_style=python3-pep517 hostmakedepends="python3-setuptools python3-wheel python3-Cython python3-cysignals pari perl" From be4ffae3b64cb4ebba0459bb34435bcda44f7694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 1 Oct 2024 23:33:02 -0300 Subject: [PATCH 07/21] sagemath: revbump and patch for pari-2.17.0_1 --- .../patches/38749-00-prepare_backport.patch | 89 + .../sagemath/patches/38749-pari_2.17.patch | 2056 +++++++++++++++++ .../patches/38749-zz-fixup_backport.patch | 95 + srcpkgs/sagemath/patches/get_patches | 2 + srcpkgs/sagemath/template | 2 +- 5 files changed, 2243 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/sagemath/patches/38749-00-prepare_backport.patch create mode 100644 srcpkgs/sagemath/patches/38749-pari_2.17.patch create mode 100644 srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch diff --git a/srcpkgs/sagemath/patches/38749-00-prepare_backport.patch b/srcpkgs/sagemath/patches/38749-00-prepare_backport.patch new file mode 100644 index 00000000000000..01e6e0bc150141 --- /dev/null +++ b/srcpkgs/sagemath/patches/38749-00-prepare_backport.patch @@ -0,0 +1,89 @@ +commit 95d7f3070d46c971fe1ea1fceb3cc6d8039c1d66 +Author: Gonzalo Tornaría +Date: Sun Nov 3 13:09:51 2024 -0300 + + prepare for backport of #38749 + +diff --git a/src/sage/modular/dirichlet.py b/src/sage/modular/dirichlet.py +index e579c5090e3..efc533c51f0 100644 +--- a/src/sage/modular/dirichlet.py ++++ b/src/sage/modular/dirichlet.py +@@ -2388,7 +2388,8 @@ class DirichletGroupFactory(UniqueFactory): + + :: + +- sage: r4 = CyclotomicField(4).ring_of_integers() ++ sage: K = CyclotomicField(4) ++ sage: r4 = K.ring_of_integers() + sage: G = DirichletGroup(60, r4) + sage: G.gens() + (Dirichlet character modulo 60 of conductor 4 +@@ -2401,8 +2402,7 @@ class DirichletGroupFactory(UniqueFactory): + zeta4 + sage: parent(val) + Gaussian Integers generated by zeta4 in Cyclotomic Field of order 4 and degree 2 +- sage: r4_29_0 = r4.residue_field(r4.ideal(29).factor()[0][0]); r4_29_0(val) +- doctest:warning ... DeprecationWarning: ... ++ sage: r4_29_0 = r4.residue_field(K(29).factor()[0][0]); r4_29_0(val) + 17 + sage: r4_29_0(val) * GF(29)(3) + 22 +diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py +index 49b4030b2e9..2a650138291 100644 +--- a/src/sage/rings/number_field/selmer_group.py ++++ b/src/sage/rings/number_field/selmer_group.py +@@ -73,7 +73,6 @@ def _ideal_generator(I): + sage: K. = QuadraticField(-11) + sage: [_ideal_generator(K.prime_above(p)) for p in primes(25)] + [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, -a, 13, 17, 19, 1/2*a + 9/2] +- + """ + try: + return I.gens_reduced()[0] +diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py +index 39a60361ec6..f258961f685 100644 +--- a/src/sage/schemes/elliptic_curves/gp_simon.py ++++ b/src/sage/schemes/elliptic_curves/gp_simon.py +@@ -57,6 +57,9 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, + sage: import sage.schemes.elliptic_curves.gp_simon + sage: E = EllipticCurve('389a1') + sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E) ++ doctest:warning...: ++ DeprecationWarning: please use the 2-descent algorithm over QQ inside pari ++ See https://github.com/sagemath/sage/issues/38461 for details. + (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)]) + + TESTS:: +diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py +index 393b77bc1ff..af946d05fb7 100644 +--- a/src/sage/schemes/plane_conics/con_number_field.py ++++ b/src/sage/schemes/plane_conics/con_number_field.py +@@ -123,9 +123,9 @@ class ProjectiveConic_number_field(ProjectiveConic_field): + sage: C = Conic(K, [1, 3, -5]) + sage: C.has_rational_point(point=True, obstruction=True) + (False, Fractional ideal (-i - 2)) +- sage: C.has_rational_point(algorithm="rnfisnorm") ++ sage: C.has_rational_point(algorithm='rnfisnorm') + False +- sage: C.has_rational_point(algorithm="rnfisnorm", obstruction=True, ++ sage: C.has_rational_point(algorithm='rnfisnorm', obstruction=True, + ....: read_cache=False) + Traceback (most recent call last): + ... +diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py +index 339406cd9d6..2baab7e5cda 100644 +--- a/src/sage/schemes/projective/projective_morphism.py ++++ b/src/sage/schemes/projective/projective_morphism.py +@@ -1764,10 +1764,10 @@ class SchemeMorphism_polynomial_projective_space_field(SchemeMorphism_polynomial + Scheme morphism: + From: Projective Space of dimension 1 over Number Field in a + with defining polynomial y^4 + 3*y^2 + 1 +- with a = 0.?e-151 + 0.618033988749895?*I ++ with a = 0.?e-113 + 0.618033988749895?*I + To: Projective Space of dimension 2 over Number Field in a + with defining polynomial y^4 + 3*y^2 + 1 +- with a = 0.?e-151 + 0.618033988749895?*I ++ with a = 0.?e-113 + 0.618033988749895?*I + Defn: Defined on coordinates by sending (x : y) to + (x^2 + (a^3 + 2*a)*x*y + 3*y^2 : y^2 : (2*a^2 + 3)*x*y) + diff --git a/srcpkgs/sagemath/patches/38749-pari_2.17.patch b/srcpkgs/sagemath/patches/38749-pari_2.17.patch new file mode 100644 index 00000000000000..4fbdd7358c0025 --- /dev/null +++ b/srcpkgs/sagemath/patches/38749-pari_2.17.patch @@ -0,0 +1,2056 @@ +diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py +index 745d5fcbbe7..86409ab3243 100644 +--- a/src/sage/arith/misc.py ++++ b/src/sage/arith/misc.py +@@ -2691,9 +2691,14 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds): + + Any object which has a factor method can be factored like this:: + +- sage: K. = QuadraticField(-1) # needs sage.rings.number_field +- sage: factor(122 - 454*i) # needs sage.rings.number_field +- (-i) * (-i - 2)^3 * (i + 1)^3 * (-2*i + 3) * (i + 4) ++ sage: # needs sage.rings.number_field ++ sage: K. = QuadraticField(-1) ++ sage: f = factor(122 - 454*i); f # random ++ (i) * (i - 1)^3 * (i + 2)^3 * (3*i + 2) * (i + 4) ++ sage: len(f) ++ 4 ++ sage: product(p[0]^p[1] for p in f) * f.unit() ++ -454*i + 122 + + To access the data in a factorization:: + +@@ -2775,8 +2780,10 @@ def radical(n, *args, **kwds): + ... + ArithmeticError: radical of 0 is not defined + sage: K. = QuadraticField(-1) # needs sage.rings.number_field +- sage: radical(K(2)) # needs sage.rings.number_field +- i + 1 ++ sage: r = radical(K(2)); r # random, needs sage.rings.number_field ++ i - 1 ++ sage: r.norm() # needs sage.rings.number_field ++ 2 + + Tests with numpy and gmpy2 numbers:: + +@@ -3031,7 +3038,7 @@ def is_squarefree(n): + sage: is_squarefree(O(2)) + False + sage: O(2).factor() +- (-I) * (I + 1)^2 ++ (...) * (...)^2 + + This method fails on domains which are not Unique Factorization Domains:: + +diff --git a/src/sage/categories/quotient_fields.py b/src/sage/categories/quotient_fields.py +index 76f0570a819..0e4d13ef889 100644 +--- a/src/sage/categories/quotient_fields.py ++++ b/src/sage/categories/quotient_fields.py +@@ -100,7 +100,7 @@ def gcd(self, other): + sage: R = ZZ.extension(x^2 + 1, names='i') + sage: i = R.1 + sage: gcd(5, 3 + 4*i) +- -i - 2 ++ 2*i - 1 + sage: P. = R[] + sage: gcd(t, i) + Traceback (most recent call last): +diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +index 6995f61f463..457b0ba2253 100644 +--- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py ++++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +@@ -690,10 +690,10 @@ def conjugate(self, M, adjugate=False, new_ideal=None): + + sage: # needs sage.rings.number_field + sage: ideal = A.ideal(5).factor()[1][0]; ideal +- Fractional ideal (2*a + 1) ++ Fractional ideal (-a + 2) + sage: g = f.conjugate(conj, new_ideal=ideal) + sage: g.domain().ideal() +- Fractional ideal (2*a + 1) ++ Fractional ideal (-a + 2) + """ + if self.domain().is_padic_base(): + return DynamicalSystem_Berkovich(self._system.conjugate(M, adjugate=adjugate)) +diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +index a74efd9129a..151f9e71335 100644 +--- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py ++++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +@@ -1790,7 +1790,7 @@ def primes_of_bad_reduction(self, check=True): + sage: P. = ProjectiveSpace(K,1) + sage: f = DynamicalSystem_projective([1/3*x^2+1/a*y^2, y^2]) + sage: f.primes_of_bad_reduction() # needs sage.rings.function_field +- [Fractional ideal (a), Fractional ideal (3)] ++ [Fractional ideal (-a), Fractional ideal (3)] + + This is an example where ``check=False`` returns extra primes:: + +diff --git a/src/sage/libs/pari/convert_sage.pyx b/src/sage/libs/pari/convert_sage.pyx +index 64386bcf632..db6725f39a5 100644 +--- a/src/sage/libs/pari/convert_sage.pyx ++++ b/src/sage/libs/pari/convert_sage.pyx +@@ -573,17 +573,16 @@ cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False): + sage: pari_prime_range(2, 19) + [2, 3, 5, 7, 11, 13, 17] + """ +- cdef long p = 0 +- cdef byteptr pari_prime_ptr = diffptr ++ cdef ulong i = 1 + res = [] +- while p < c_start: +- NEXT_PRIME_VIADIFF(p, pari_prime_ptr) +- while p < c_stop: ++ while pari_PRIMES[i] < c_start: ++ i+=1 ++ while pari_PRIMES[i] < c_stop: + if py_ints: +- res.append(p) ++ res.append(pari_PRIMES[i]) + else: + z = PY_NEW(Integer) +- mpz_set_ui(z.value, p) ++ mpz_set_ui(z.value, pari_PRIMES[i]) + res.append(z) +- NEXT_PRIME_VIADIFF(p, pari_prime_ptr) ++ i+=1 + return res +diff --git a/src/sage/libs/pari/convert_sage_real_mpfr.pyx b/src/sage/libs/pari/convert_sage_real_mpfr.pyx +index 98db6023dc9..5fd7fba1c47 100644 +--- a/src/sage/libs/pari/convert_sage_real_mpfr.pyx ++++ b/src/sage/libs/pari/convert_sage_real_mpfr.pyx +@@ -28,7 +28,7 @@ cpdef Gen new_gen_from_real_mpfr_element(RealNumber self): + + # We round up the precision to the nearest multiple of wordsize. + cdef int rounded_prec +- rounded_prec = (self.prec() + wordsize - 1) & ~(wordsize - 1) ++ rounded_prec = nbits2prec(self.prec()) + + # Yes, assigning to self works fine, even in Cython. + if rounded_prec > prec: +@@ -48,7 +48,7 @@ cpdef Gen new_gen_from_real_mpfr_element(RealNumber self): + exponent = mpfr_get_z_exp(mantissa, self.value) + + # Create a PARI REAL +- pari_float = cgetr(2 + rounded_prec / wordsize) ++ pari_float = cgetr(rounded_prec) + pari_float[1] = evalexpo(exponent + rounded_prec - 1) + evalsigne(mpfr_sgn(self.value)) + mpz_export(&pari_float[2], NULL, 1, wordsize // 8, 0, 0, mantissa) + mpz_clear(mantissa) +diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py +index 1ed571cd4b9..bd8dc9641d2 100644 +--- a/src/sage/libs/pari/tests.py ++++ b/src/sage/libs/pari/tests.py +@@ -1502,7 +1502,7 @@ + sage: pari(-104).quadclassunit() + [6, [6], [Qfb(5, -4, 6)], 1] + sage: pari(109).quadclassunit() +- [1, [], [], 5.56453508676047] ++ [1, [], [], 5.56453508676047, -1] + sage: pari(10001).quadclassunit() # random generators + [16, [16], [Qfb(10, 99, -5, 0.E-38)], 5.29834236561059] + sage: pari(10001).quadclassunit()[0] +@@ -1749,13 +1749,13 @@ + sage: y = QQ['yy'].0; _ = pari(y) # pari has variable ordering rules + sage: x = QQ['zz'].0; nf = pari(x^2 + 2).nfinit() + sage: nf.nfroots(y^2 + 2) +- [Mod(-zz, zz^2 + 2), Mod(zz, zz^2 + 2)] ++ [Mod(-zz, zz^2 + 2), Mod(zz, zz^2 + 2)]~ + sage: nf = pari(x^3 + 2).nfinit() + sage: nf.nfroots(y^3 + 2) +- [Mod(zz, zz^3 + 2)] ++ [Mod(zz, zz^3 + 2)]~ + sage: nf = pari(x^4 + 2).nfinit() + sage: nf.nfroots(y^4 + 2) +- [Mod(-zz, zz^4 + 2), Mod(zz, zz^4 + 2)] ++ [Mod(-zz, zz^4 + 2), Mod(zz, zz^4 + 2)]~ + + sage: nf = pari('x^2 + 1').nfinit() + sage: nf.nfrootsof1() +diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx +index 0c257cfaf33..780cae7fbf2 100644 +--- a/src/sage/matrix/matrix2.pyx ++++ b/src/sage/matrix/matrix2.pyx +@@ -16583,7 +16583,7 @@ cdef class Matrix(Matrix1): + ....: -2*a^2 + 4*a - 2, -2*a^2 + 1, 2*a, a^2 - 6, 3*a^2 - a ]) + sage: r,s,p = m._echelon_form_PID() + sage: s[2] +- (0, 0, -3*a^2 - 18*a + 34, -68*a^2 + 134*a - 53, -111*a^2 + 275*a - 90) ++ (0, 0, 3*a^2 + 18*a - 34, 68*a^2 - 134*a + 53, 111*a^2 - 275*a + 90) + sage: r * m == s and r.det() == 1 + True + +diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py +index 4d120c075da..f3a3ff7e65b 100644 +--- a/src/sage/modular/cusps_nf.py ++++ b/src/sage/modular/cusps_nf.py +@@ -1184,9 +1184,9 @@ def NFCusps_ideal_reps_for_levelN(N, nlists=1): + sage: from sage.modular.cusps_nf import NFCusps_ideal_reps_for_levelN + sage: NFCusps_ideal_reps_for_levelN(N) + [(Fractional ideal (1), +- Fractional ideal (67, a + 17), +- Fractional ideal (127, a + 48), +- Fractional ideal (157, a - 19))] ++ Fractional ideal (67, -4/7*a^3 + 13/7*a^2 + 39/7*a - 43), ++ Fractional ideal (127, -4/7*a^3 + 13/7*a^2 + 39/7*a - 42), ++ Fractional ideal (157, -4/7*a^3 + 13/7*a^2 + 39/7*a + 48))] + sage: L = NFCusps_ideal_reps_for_levelN(N, 5) + sage: all(len(L[i]) == k.class_number() for i in range(len(L))) + True +@@ -1244,7 +1244,7 @@ def units_mod_ideal(I): + sage: I = k.ideal(5, a + 1) + sage: units_mod_ideal(I) + [1, +- -2*a^2 - 4*a + 1, ++ 2*a^2 + 4*a - 1, + ...] + + :: +diff --git a/src/sage/modular/dirichlet.py b/src/sage/modular/dirichlet.py +index 1f6a7a94444..1cf3ccdb611 100644 +--- a/src/sage/modular/dirichlet.py ++++ b/src/sage/modular/dirichlet.py +@@ -2395,13 +2395,13 @@ class DirichletGroupFactory(UniqueFactory): + sage: parent(val) + Gaussian Integers generated by zeta4 in Cyclotomic Field of order 4 and degree 2 + sage: r4_29_0 = r4.residue_field(K(29).factor()[0][0]); r4_29_0(val) +- 17 ++ 12 + sage: r4_29_0(val) * GF(29)(3) +- 22 ++ 7 + sage: r4_29_0(G.gens()[2].values_on_gens()[2]) * 3 +- 22 ++ 7 + sage: parent(r4_29_0(G.gens()[2].values_on_gens()[2]) * 3) +- Residue field of Fractional ideal (-2*zeta4 + 5) ++ Residue field of Fractional ideal (-2*zeta4 - 5) + + :: + +diff --git a/src/sage/modular/modsym/p1list_nf.py b/src/sage/modular/modsym/p1list_nf.py +index 86d33071974..00bb0979ea4 100644 +--- a/src/sage/modular/modsym/p1list_nf.py ++++ b/src/sage/modular/modsym/p1list_nf.py +@@ -61,7 +61,7 @@ + + sage: alpha = MSymbol(N, a + 2, 3*a^2) + sage: alpha.lift_to_sl2_Ok() +- [-1, 4*a^2 - 13*a + 23, a + 2, 5*a^2 + 3*a - 3] ++ [-a - 1, 15*a^2 - 38*a + 86, a + 2, -a^2 + 9*a - 19] + sage: Ok = k.ring_of_integers() + sage: M = Matrix(Ok, 2, alpha.lift_to_sl2_Ok()) + sage: det(M) +@@ -977,11 +977,11 @@ def apply_J_epsilon(self, i, e1, e2=1): + sage: N = k.ideal(5, a + 1) + sage: P = P1NFList(N) + sage: u = k.unit_group().gens_values(); u +- [-1, -2*a^2 - 4*a + 1] ++ [-1, 2*a^2 + 4*a - 1] + sage: P.apply_J_epsilon(4, -1) + 2 + sage: P.apply_J_epsilon(4, u[0], u[1]) +- 5 ++ 1 + + :: + +@@ -1122,7 +1122,7 @@ def lift_to_sl2_Ok(N, c, d): + sage: M = Matrix(Ok, 2, lift_to_sl2_Ok(N, 0, 7)) + Traceback (most recent call last): + ... +- ValueError: <0> + <7> and the Fractional ideal (7, a) are not coprime. ++ ValueError: <0> + <7> and the Fractional ideal (7, -4/7*a^3 + 13/7*a^2 + 39/7*a - 19) are not coprime. + """ + k = N.number_field() + # check the input +diff --git a/src/sage/quadratic_forms/binary_qf.py b/src/sage/quadratic_forms/binary_qf.py +index 1a75f415b64..c89759288b9 100755 +--- a/src/sage/quadratic_forms/binary_qf.py ++++ b/src/sage/quadratic_forms/binary_qf.py +@@ -1646,7 +1646,7 @@ def solve_integer(self, n, *, algorithm='general', _flag=2): + sage: Q = BinaryQF([1, 0, 12345]) + sage: n = 2^99 + 5273 + sage: Q.solve_integer(n) # needs sage.libs.pari +- (-67446480057659, 7139620553488) ++ (67446480057659, 7139620553488) + sage: Q.solve_integer(n, algorithm='cornacchia') # needs sage.libs.pari + (67446480057659, 7139620553488) + sage: timeit('Q.solve_integer(n)') # not tested +@@ -1661,7 +1661,7 @@ def solve_integer(self, n, *, algorithm='general', _flag=2): + sage: Qs + [x^2 + x*y + 6*y^2, 2*x^2 - x*y + 3*y^2, 2*x^2 + x*y + 3*y^2] + sage: [Q.solve_integer(3) for Q in Qs] +- [None, (0, -1), (0, -1)] ++ [None, (0, 1), (0, 1)] + sage: [Q.solve_integer(5) for Q in Qs] + [None, None, None] + sage: [Q.solve_integer(6) for Q in Qs] +@@ -1741,11 +1741,11 @@ def solve_integer(self, n, *, algorithm='general', _flag=2): + sage: # needs sage.libs.pari + sage: Q = BinaryQF([1, 0, 5]) + sage: Q.solve_integer(126, _flag=1) +- [(11, -1), (-1, -5), (-1, 5), (-11, -1)] ++ [(-11, -1), (-1, -5), (-1, 5), (11, -1)] + sage: Q.solve_integer(126, _flag=2) + (11, -1) + sage: Q.solve_integer(126, _flag=3) +- [(11, -1), (-1, -5), (-1, 5), (-11, -1), (-9, -3), (9, -3)] ++ [(-11, -1), (-9, -3), (-1, -5), (-1, 5), (9, -3), (11, -1)] + """ + if self.is_negative_definite(): # not supported by PARI + return (-self).solve_integer(-n) +diff --git a/src/sage/rings/finite_rings/finite_field_prime_modn.py b/src/sage/rings/finite_rings/finite_field_prime_modn.py +index d94b0a4335a..0978c7328fe 100644 +--- a/src/sage/rings/finite_rings/finite_field_prime_modn.py ++++ b/src/sage/rings/finite_rings/finite_field_prime_modn.py +@@ -114,9 +114,9 @@ def _coerce_map_from_(self, S): + sage: RF13 = K.residue_field(pp) + sage: RF13.hom([GF(13)(1)]) + Ring morphism: +- From: Residue field of Fractional ideal (-w - 18) +- To: Finite Field of size 13 +- Defn: 1 |--> 1 ++ From: Residue field of Fractional ideal (w + 18) ++ To: Finite Field of size 13 ++ Defn: 1 |--> 1 + + Check that :issue:`19573` is resolved:: + +diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx +index 3146f7fd764..a8e77e48b76 100644 +--- a/src/sage/rings/finite_rings/residue_field.pyx ++++ b/src/sage/rings/finite_rings/residue_field.pyx +@@ -22,14 +22,13 @@ monogenic (i.e., 2 is an essential discriminant divisor):: + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^3 + x^2 - 2*x + 8) + sage: F = K.factor(2); F +- (Fractional ideal (-1/2*a^2 + 1/2*a - 1)) * (Fractional ideal (-a^2 + 2*a - 3)) +- * (Fractional ideal (3/2*a^2 - 5/2*a + 4)) ++ (Fractional ideal (-1/2*a^2 + 1/2*a - 1)) * (Fractional ideal (a^2 - 2*a + 3)) * (Fractional ideal (-3/2*a^2 + 5/2*a - 4)) + sage: F[0][0].residue_field() + Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1) + sage: F[1][0].residue_field() +- Residue field of Fractional ideal (-a^2 + 2*a - 3) ++ Residue field of Fractional ideal (a^2 - 2*a + 3) + sage: F[2][0].residue_field() +- Residue field of Fractional ideal (3/2*a^2 - 5/2*a + 4) ++ Residue field of Fractional ideal (-3/2*a^2 + 5/2*a - 4) + + We can also form residue fields from `\ZZ`:: + +@@ -126,10 +125,10 @@ First over a small non-prime field:: + sage: I = ideal([ubar*X + Y]); I + Ideal (ubar*X + Y) of Multivariate Polynomial Ring in X, Y over + Residue field in ubar of Fractional ideal +- (47, 517/55860*u^5 + 235/3724*u^4 + 9829/13965*u^3 +- + 54106/13965*u^2 + 64517/27930*u + 755696/13965) ++ (47, 4841/93100*u^5 + 34451/139650*u^4 + 303697/69825*u^3 ++ + 297893/27930*u^2 + 1649764/23275*u + 2633506/69825) + sage: I.groebner_basis() # needs sage.libs.singular +- [X + (-19*ubar^2 - 5*ubar - 17)*Y] ++ [X + (-15*ubar^2 + 3*ubar - 2)*Y] + + And now over a large prime field:: + +@@ -496,9 +495,9 @@ class ResidueField_generic(Field): + + sage: # needs sage.rings.number_field + sage: I = QQ[i].factor(2)[0][0]; I +- Fractional ideal (I + 1) ++ Fractional ideal (-I - 1) + sage: k = I.residue_field(); k +- Residue field of Fractional ideal (I + 1) ++ Residue field of Fractional ideal (-I - 1) + sage: type(k) + + +@@ -1008,7 +1007,7 @@ cdef class ReductionMap(Map): + sage: cr + Partially defined reduction map: + From: Number Field in a with defining polynomial x^2 + 1 +- To: Residue field of Fractional ideal (a + 1) ++ To: Residue field of Fractional ideal (-a + 1) + sage: cr == r # not implemented + True + sage: r(2 + a) == cr(2 + a) +@@ -1039,7 +1038,7 @@ cdef class ReductionMap(Map): + sage: cr + Partially defined reduction map: + From: Number Field in a with defining polynomial x^2 + 1 +- To: Residue field of Fractional ideal (a + 1) ++ To: Residue field of Fractional ideal (-a + 1) + sage: cr == r # not implemented + True + sage: r(2 + a) == cr(2 + a) +@@ -1071,7 +1070,7 @@ cdef class ReductionMap(Map): + sage: r = F.reduction_map(); r + Partially defined reduction map: + From: Number Field in a with defining polynomial x^2 + 1 +- To: Residue field of Fractional ideal (a + 1) ++ To: Residue field of Fractional ideal (-a + 1) + + We test that calling the function also works after copying:: + +@@ -1083,7 +1082,7 @@ cdef class ReductionMap(Map): + Traceback (most recent call last): + ... + ZeroDivisionError: Cannot reduce field element 1/2*a +- modulo Fractional ideal (a + 1): it has negative valuation ++ modulo Fractional ideal (-a + 1): it has negative valuation + + sage: # needs sage.rings.finite_rings + sage: R. = GF(2)[]; h = t^5 + t^2 + 1 +@@ -1105,11 +1104,11 @@ cdef class ReductionMap(Map): + sage: # needs sage.rings.number_field + sage: K. = NumberField(x^2 + 1) + sage: P1, P2 = [g[0] for g in K.factor(5)]; P1, P2 +- (Fractional ideal (-i - 2), Fractional ideal (2*i + 1)) ++ (Fractional ideal (2*i - 1), Fractional ideal (-2*i - 1)) + sage: a = 1/(1+2*i) + sage: F1, F2 = [g.residue_field() for g in [P1,P2]]; F1, F2 +- (Residue field of Fractional ideal (-i - 2), +- Residue field of Fractional ideal (2*i + 1)) ++ (Residue field of Fractional ideal (2*i - 1), ++ Residue field of Fractional ideal (-2*i - 1)) + sage: a.valuation(P1) + 0 + sage: F1(i/7) +@@ -1122,7 +1121,7 @@ cdef class ReductionMap(Map): + Traceback (most recent call last): + ... + ZeroDivisionError: Cannot reduce field element -2/5*i + 1/5 +- modulo Fractional ideal (2*i + 1): it has negative valuation ++ modulo Fractional ideal (-2*i - 1): it has negative valuation + """ + # The reduction map is just x |--> F(to_vs(x) * (PB**(-1))) if + # either x is integral or the denominator of x is coprime to +@@ -1188,8 +1187,7 @@ cdef class ReductionMap(Map): + sage: f = k.convert_map_from(K) + sage: s = f.section(); s + Lifting map: +- From: Residue field in abar of +- Fractional ideal (-14*a^4 + 24*a^3 + 26*a^2 - 58*a + 15) ++ From: Residue field in abar of Fractional ideal (14*a^4 - 24*a^3 - 26*a^2 + 58*a - 15) + To: Number Field in a with defining polynomial x^5 - 5*x + 2 + sage: s(k.gen()) + a +@@ -1424,8 +1422,7 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism): + sage: f = k.coerce_map_from(K.ring_of_integers()) + sage: s = f.section(); s + Lifting map: +- From: Residue field in abar of +- Fractional ideal (-14*a^4 + 24*a^3 + 26*a^2 - 58*a + 15) ++ From: Residue field in abar of Fractional ideal (14*a^4 - 24*a^3 - 26*a^2 + 58*a - 15) + To: Maximal Order generated by a in Number Field in a with defining polynomial x^5 - 5*x + 2 + sage: s(k.gen()) + a +@@ -1678,7 +1675,7 @@ cdef class LiftingMap(Section): + sage: F. = K.factor(7)[0][0].residue_field() + sage: F.lift_map() #indirect doctest + Lifting map: +- From: Residue field in tmod of Fractional ideal (theta_12^2 + 2) ++ From: Residue field in tmod of Fractional ideal (2*theta_12^3 + theta_12) + To: Maximal Order generated by theta_12 in Cyclotomic Field of order 12 and degree 4 + """ + return "Lifting" +diff --git a/src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx b/src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx +index e9962c3ccde..90a68c619f6 100644 +--- a/src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx ++++ b/src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx +@@ -103,7 +103,7 @@ class ResidueFiniteField_pari_ffelt(ResidueField_generic, FiniteField_pari_ffelt + sage: P.residue_class_degree() + 2 + sage: ff. = P.residue_field(); ff +- Residue field in alpha of Fractional ideal (-12*aa^2 + 189*aa - 475) ++ Residue field in alpha of Fractional ideal (12*aa^2 - 189*aa + 475) + sage: type(ff) + + sage: ff(alpha^2 + 1) +diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx +index 9616e7946bc..bcc45e703a2 100644 +--- a/src/sage/rings/integer.pyx ++++ b/src/sage/rings/integer.pyx +@@ -5585,7 +5585,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): + sage: 5.is_norm(K) + False + sage: n.is_norm(K, element=True) +- (True, -4*beta + 6) ++ (True, 4*beta + 6) + sage: n.is_norm(K, element=True)[1].norm() + 4 + sage: n = 5 +diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py +index 0ffac369720..1260650ef77 100644 +--- a/src/sage/rings/number_field/S_unit_solver.py ++++ b/src/sage/rings/number_field/S_unit_solver.py +@@ -12,10 +12,10 @@ + sage: x = polygen(ZZ, 'x') + sage: K. = NumberField(x^2 + x + 1) + sage: S = K.primes_above(3) +- sage: expected = [((0, 1), (4, 0), xi + 2, -xi - 1), +- ....: ((1, -1), (0, -1), 1/3*xi + 2/3, -1/3*xi + 1/3), ++ sage: expected = [((4, 1), (4, 0), xi + 2, -xi - 1), ++ ....: ((3, -1), (2, -1), 1/3*xi + 2/3, -1/3*xi + 1/3), + ....: ((1, 0), (5, 0), xi + 1, -xi), +- ....: ((2, 0), (5, 1), xi, -xi + 1)] ++ ....: ((2, 0), (3, 1), xi, -xi + 1)] + sage: sols = solve_S_unit_equation(K, S, 200) + sage: eq_up_to_order(sols, expected) + True +@@ -1448,7 +1448,7 @@ def embedding_to_Kp(a, prime, prec): + sage: from sage.rings.number_field.S_unit_solver import embedding_to_Kp + sage: K. = QuadraticField(17) + sage: p = K.prime_above(13); p +- Fractional ideal (-a + 2) ++ Fractional ideal (a - 2) + sage: embedding_to_Kp(a-3, p, 15) + -20542890112375827 + +@@ -1791,10 +1791,10 @@ def sieve_ordering(SUK, q): + Residue field of Fractional ideal (2*xi + 1)) + + sage: sieve_data[2] +- ([18, 12, 16, 8], [18, 16, 10, 4], [18, 10, 12, 10]) ++ ([18, 9, 16, 8], [18, 7, 10, 4], [18, 3, 12, 10]) + + sage: sieve_data[3] +- (648, 2916, 3888) ++ (972, 972, 3888) + """ + + K = SUK.number_field() +@@ -2170,23 +2170,23 @@ def construct_complement_dictionaries(split_primes_list, SUK, verbose=False): + sage: SUK = K.S_unit_group(S=K.primes_above(H)) + sage: split_primes_list = [3, 7] + sage: actual = construct_complement_dictionaries(split_primes_list, SUK) +- sage: expected = {3: {(0, 1, 0): [(1, 0, 0), (0, 1, 0)], +- ....: (1, 0, 0): [(1, 0, 0), (0, 1, 0)]}, +- ....: 7: {(0, 1, 0): [(1, 0, 0), (1, 4, 4), (1, 2, 2)], +- ....: (0, 1, 2): [(0, 1, 2), (0, 3, 4), (0, 5, 0)], +- ....: (0, 3, 2): [(1, 0, 0), (1, 4, 4), (1, 2, 2)], +- ....: (0, 3, 4): [(0, 1, 2), (0, 3, 4), (0, 5, 0)], +- ....: (0, 5, 0): [(0, 1, 2), (0, 3, 4), (0, 5, 0)], +- ....: (0, 5, 4): [(1, 0, 0), (1, 4, 4), (1, 2, 2)], +- ....: (1, 0, 0): [(0, 5, 4), (0, 3, 2), (0, 1, 0)], +- ....: (1, 0, 2): [(1, 0, 4), (1, 4, 2), (1, 2, 0)], ++ sage: expected = {3: {(1, 1, 0): [(1, 0, 0), (1, 1, 0)], ++ ....: (1, 0, 0): [(1, 0, 0), (1, 1, 0)]}, ++ ....: 7: {(1, 1, 0): [(1, 0, 0), (1, 4, 4), (1, 2, 2)], ++ ....: (1, 3, 2): [(1, 0, 0), (1, 4, 4), (1, 2, 2)], ++ ....: (1, 5, 4): [(1, 0, 0), (1, 4, 4), (1, 2, 2)], + ....: (1, 0, 4): [(1, 2, 4), (1, 4, 0), (1, 0, 2)], + ....: (1, 2, 0): [(1, 2, 4), (1, 4, 0), (1, 0, 2)], +- ....: (1, 2, 2): [(0, 5, 4), (0, 3, 2), (0, 1, 0)], ++ ....: (1, 4, 2): [(1, 2, 4), (1, 4, 0), (1, 0, 2)], ++ ....: (1, 1, 2): [(1, 1, 2), (1, 3, 4), (1, 5, 0)], ++ ....: (1, 3, 4): [(1, 1, 2), (1, 3, 4), (1, 5, 0)], ++ ....: (1, 5, 0): [(1, 1, 2), (1, 3, 4), (1, 5, 0)], ++ ....: (1, 0, 2): [(1, 0, 4), (1, 4, 2), (1, 2, 0)], + ....: (1, 2, 4): [(1, 0, 4), (1, 4, 2), (1, 2, 0)], + ....: (1, 4, 0): [(1, 0, 4), (1, 4, 2), (1, 2, 0)], +- ....: (1, 4, 2): [(1, 2, 4), (1, 4, 0), (1, 0, 2)], +- ....: (1, 4, 4): [(0, 5, 4), (0, 3, 2), (0, 1, 0)]}} ++ ....: (1, 0, 0): [(1, 5, 4), (1, 3, 2), (1, 1, 0)], ++ ....: (1, 2, 2): [(1, 5, 4), (1, 3, 2), (1, 1, 0)], ++ ....: (1, 4, 4): [(1, 5, 4), (1, 3, 2), (1, 1, 0)]}} + sage: all(set(actual[p][vec]) == set(expected[p][vec]) + ....: for p in [3, 7] for vec in expected[p]) + True +@@ -2693,9 +2693,9 @@ def sieve_below_bound(K, S, bound=10, bump=10, split_primes_list=[], verbose=Fal + sage: SUK = UnitGroup(K, S=tuple(K.primes_above(3))) + sage: S = SUK.primes() + sage: sols = sieve_below_bound(K, S, 10) +- sage: expected = [((1, -1), (0, -1), 1/3*xi + 2/3, -1/3*xi + 1/3), +- ....: ((0, 1), (4, 0), xi + 2, -xi - 1), +- ....: ((2, 0), (5, 1), xi, -xi + 1), ++ sage: expected = [((3, -1), (2, -1), 1/3*xi + 2/3, -1/3*xi + 1/3), ++ ....: ((4, 1), (4, 0), xi + 2, -xi - 1), ++ ....: ((2, 0), (3, 1), xi, -xi + 1), + ....: ((1, 0), (5, 0), xi + 1, -xi)] + sage: eq_up_to_order(sols, expected) + True +@@ -2758,10 +2758,10 @@ def solve_S_unit_equation(K, S, prec=106, include_exponents=True, include_bound= + sage: K. = NumberField(x^2 + x + 1) + sage: S = K.primes_above(3) + sage: sols = solve_S_unit_equation(K, S, 200) +- sage: expected = [((0, 1), (4, 0), xi + 2, -xi - 1), +- ....: ((1, -1), (0, -1), 1/3*xi + 2/3, -1/3*xi + 1/3), ++ sage: expected = [((4, 1), (4, 0), xi + 2, -xi - 1), ++ ....: ((3, -1), (2, -1), 1/3*xi + 2/3, -1/3*xi + 1/3), + ....: ((1, 0), (5, 0), xi + 1, -xi), +- ....: ((2, 0), (5, 1), xi, -xi + 1)] ++ ....: ((2, 0), (3, 1), xi, -xi + 1)] + sage: eq_up_to_order(sols, expected) + True + +@@ -2769,7 +2769,7 @@ def solve_S_unit_equation(K, S, prec=106, include_exponents=True, include_bound= + + sage: solutions, bound = solve_S_unit_equation(K, S, 100, include_bound=True) + sage: bound +- 7 ++ 6 + + You can omit the exponent vectors:: + +diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py +index c974c3df6ff..ee53ca6d674 100644 +--- a/src/sage/rings/number_field/galois_group.py ++++ b/src/sage/rings/number_field/galois_group.py +@@ -995,8 +995,8 @@ def artin_symbol(self, P): + sage: K. = NumberField(x^4 - 2*x^2 + 2, 'a').galois_closure() + sage: G = K.galois_group() + sage: [G.artin_symbol(P) for P in K.primes_above(7)] +- [(1,4)(2,3)(5,8)(6,7), (1,4)(2,3)(5,8)(6,7), +- (1,5)(2,6)(3,7)(4,8), (1,5)(2,6)(3,7)(4,8)] ++ [(1,5)(2,6)(3,7)(4,8), (1,5)(2,6)(3,7)(4,8), ++ (1,4)(2,3)(5,8)(6,7), (1,4)(2,3)(5,8)(6,7)] + sage: G.artin_symbol(17) + Traceback (most recent call last): + ... +diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py +index bb16476980e..3a98a997962 100644 +--- a/src/sage/rings/number_field/number_field.py ++++ b/src/sage/rings/number_field/number_field.py +@@ -3627,7 +3627,7 @@ def fractional_ideal(self, *gens, **kwds): + sage: L. = K.extension(x^2 - 3, x^2 + 1) + sage: M. = L.extension(x^2 + 1) + sage: L.ideal(K.ideal(2, a)) +- Fractional ideal (a) ++ Fractional ideal (-a) + sage: M.ideal(K.ideal(2, a)) == M.ideal(a*(b - c)/2) + True + +@@ -3665,40 +3665,29 @@ def ideals_of_bdd_norm(self, bound): + + sage: x = polygen(QQ, 'x') + sage: K. = NumberField(x^2 + 23) +- sage: d = K.ideals_of_bdd_norm(10) +- sage: for n in d: +- ....: print(n) +- ....: for I in sorted(d[n]): +- ....: print(I) +- 1 +- Fractional ideal (1) +- 2 +- Fractional ideal (2, 1/2*a - 1/2) +- Fractional ideal (2, 1/2*a + 1/2) +- 3 +- Fractional ideal (3, 1/2*a - 1/2) +- Fractional ideal (3, 1/2*a + 1/2) +- 4 +- Fractional ideal (2) +- Fractional ideal (4, 1/2*a + 3/2) +- Fractional ideal (4, 1/2*a + 5/2) +- 5 +- 6 +- Fractional ideal (1/2*a - 1/2) +- Fractional ideal (1/2*a + 1/2) +- Fractional ideal (6, 1/2*a + 5/2) +- Fractional ideal (6, 1/2*a + 7/2) +- 7 +- 8 +- Fractional ideal (4, a - 1) +- Fractional ideal (4, a + 1) +- Fractional ideal (1/2*a + 3/2) +- Fractional ideal (1/2*a - 3/2) +- 9 +- Fractional ideal (3) +- Fractional ideal (9, 1/2*a + 7/2) +- Fractional ideal (9, 1/2*a + 11/2) +- 10 ++ sage: d = K.ideals_of_bdd_norm(10); d # random ++ {1: [Fractional ideal (1)], ++ 2: [Fractional ideal (2, 1/2*a - 1/2), Fractional ideal (2, 1/2*a + 1/2)], ++ 3: [Fractional ideal (3, 1/2*a + 1/2), Fractional ideal (3, 1/2*a - 1/2)], ++ 4: [Fractional ideal (4, 1/2*a + 3/2), ++ Fractional ideal (2), ++ Fractional ideal (4, 1/2*a + 5/2)], ++ 5: [], ++ 6: [Fractional ideal (6, 1/2*a + 7/2), ++ Fractional ideal (-1/2*a - 1/2), ++ Fractional ideal (-1/2*a + 1/2), ++ Fractional ideal (6, 1/2*a + 5/2)], ++ 7: [], ++ 8: [Fractional ideal (1/2*a + 3/2), ++ Fractional ideal (4, a - 1), ++ Fractional ideal (4, a + 1), ++ Fractional ideal (-1/2*a + 3/2)], ++ 9: [Fractional ideal (9, 1/2*a + 7/2), ++ Fractional ideal (3), ++ Fractional ideal (9, 1/2*a + 11/2)], ++ 10: []} ++ sage: [[I.norm() for I in sorted(d[n])] for n in d] ++ [[1], [2, 2], [3, 3], [4, 4, 4], [], [6, 6, 6, 6], [], [8, 8, 8, 8], [9, 9, 9], []] + """ + hnf_ideals = self.pari_nf().ideallist(bound) + d = {} +@@ -3925,9 +3914,13 @@ def primes_of_bounded_norm(self, B): + EXAMPLES:: + + sage: K. = QuadraticField(-1) +- sage: K.primes_of_bounded_norm(10) +- [Fractional ideal (i + 1), Fractional ideal (-i - 2), +- Fractional ideal (2*i + 1), Fractional ideal (3)] ++ sage: P = K.primes_of_bounded_norm(10); P # random ++ [Fractional ideal (i + 1), ++ Fractional ideal (i + 2), ++ Fractional ideal (-i + 2), ++ Fractional ideal (3)] ++ sage: [p.norm() for p in P] ++ [2, 5, 5, 9] + sage: K.primes_of_bounded_norm(1) + [] + sage: x = polygen(QQ, 'x') +@@ -3936,10 +3929,10 @@ def primes_of_bounded_norm(self, B): + sage: P + [Fractional ideal (a), + Fractional ideal (a + 1), +- Fractional ideal (-a^2 - 1), ++ Fractional ideal (a^2 + 1), + Fractional ideal (a^2 + a - 1), + Fractional ideal (2*a + 1), +- Fractional ideal (-2*a^2 - a - 1), ++ Fractional ideal (2*a^2 + a + 1), + Fractional ideal (a^2 - 2*a - 1), + Fractional ideal (a + 3)] + sage: [p.norm() for p in P] +@@ -3988,11 +3981,13 @@ def primes_of_bounded_norm_iter(self, B): + + sage: K. = QuadraticField(-1) + sage: it = K.primes_of_bounded_norm_iter(10) +- sage: list(it) ++ sage: l = list(it); l # random + [Fractional ideal (i + 1), + Fractional ideal (3), +- Fractional ideal (-i - 2), +- Fractional ideal (2*i + 1)] ++ Fractional ideal (i + 2), ++ Fractional ideal (-i + 2)] ++ sage: [I.norm() for I in l] ++ [2, 9, 5, 5] + sage: list(K.primes_of_bounded_norm_iter(1)) + [] + """ +@@ -4317,7 +4312,7 @@ def pari_nf(self, important=True): + sage: k. = NumberField(x^4 - 3/2*x + 5/3); k + Number Field in a with defining polynomial x^4 - 3/2*x + 5/3 + sage: k.pari_nf() +- [y^4 - 324*y + 2160, [0, 2], 48918708, 216, ..., [36, 36*y, y^3 + 6*y^2 - 252, 6*y^2], [1, 0, 0, 252; 0, 1, 0, 0; 0, 0, 0, 36; 0, 0, 6, -36], [1, 0, 0, 0, 0, 0, -18, 42, 0, -18, -46, -60, 0, 42, -60, -60; 0, 1, 0, 0, 1, 0, 2, 0, 0, 2, -11, -1, 0, 0, -1, 9; 0, 0, 1, 0, 0, 0, 6, 6, 1, 6, -5, 0, 0, 6, 0, 0; 0, 0, 0, 1, 0, 6, -6, -6, 0, -6, -1, 2, 1, -6, 2, 0]] ++ [y^4 - 324*y + 2160, [0, 2], 48918708, 216, ..., [36, 36*y, y^3 + 6*y^2 - 252, -6*y^2], [1, 0, 0, 252; 0, 1, 0, 0; 0, 0, 0, 36; 0, 0, -6, 36], [1, 0, 0, 0, 0, 0, -18, -42, 0, -18, -46, 60, 0, -42, 60, -60; 0, 1, 0, 0, 1, 0, 2, 0, 0, 2, -11, 1, 0, 0, 1, 9; 0, 0, 1, 0, 0, 0, 6, -6, 1, 6, -5, 0, 0, -6, 0, 0; 0, 0, 0, 1, 0, -6, 6, -6, 0, 6, 1, 2, 1, -6, 2, 0]] + sage: pari(k) + [y^4 - 324*y + 2160, [0, 2], 48918708, 216, ...] + sage: gp(k) +@@ -4807,7 +4802,7 @@ def _S_class_group_and_units(self, S, proof=True): + 1/13*a^2 + 7/13*a - 332/13, + -1/13*a^2 + 6/13*a + 345/13, + -1, +- -2/13*a^2 - 1/13*a + 755/13] ++ 1/13*a^2 - 19/13*a - 7/13] + sage: units[5] in (1/13*a^2 - 19/13*a - 7/13, 1/13*a^2 + 20/13*a - 7/13) + True + sage: len(units) == 6 +@@ -4818,7 +4813,7 @@ def _S_class_group_and_units(self, S, proof=True): + + sage: K. = NumberField(2*x^2 - 1/3) + sage: K._S_class_group_and_units(tuple(K.primes_above(2) + K.primes_above(3))) +- ([6*a + 2, 6*a + 3, -1, -12*a + 5], []) ++ ([...6*a...2, ...6*a...3, -1, ...12*a...5], []) + """ + K_pari = self.pari_bnf(proof=proof) + S_pari = [p.pari_prime() for p in sorted(set(S))] +@@ -4996,7 +4991,7 @@ def selmer_generators(self, S, m, proof=True, orders=False): + 1/13*a^2 + 7/13*a - 332/13, + -1/13*a^2 + 6/13*a + 345/13, + -1, +- -2/13*a^2 - 1/13*a + 755/13] ++ 1/13*a^2 - 19/13*a - 7/13] + sage: gens[5] in (1/13*a^2 - 19/13*a - 7/13, 1/13*a^2 + 20/13*a - 7/13) + True + sage: gens[6] in (-1/13*a^2 + 45/13*a - 97/13, 1/13*a^2 - 45/13*a + 97/13) +@@ -5153,16 +5148,20 @@ def selmer_space(self, S, p, proof=None): + sage: KS2, gens, fromKS2, toKS2 = K.selmer_space([P2, P3, P5], 2) + sage: KS2 + Vector space of dimension 4 over Finite Field of size 2 +- sage: gens +- [a + 1, a, 2, -1] ++ sage: gens # random ++ [-a - 1, a, 2, -1] ++ sage: gens in ([-a - 1, a, 2, -1], [a + 1, a, 2, -1]) ++ True + + Each generator must have even valuation at primes not in `S`:: + +- sage: [K.ideal(g).factor() for g in gens] ++ sage: facgens = [K.ideal(g).factor() for g in gens]; facgens # random + [(Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1)), + Fractional ideal (a), + (Fractional ideal (2, a + 1))^2, + 1] ++ sage: facgens[2][0][1] ++ 2 + + sage: toKS2(10) + (0, 0, 1, 1) +@@ -5174,8 +5173,10 @@ def selmer_space(self, S, p, proof=None): + sage: KS3, gens, fromKS3, toKS3 = K.selmer_space([P2, P3, P5], 3) + sage: KS3 + Vector space of dimension 3 over Finite Field of size 3 +- sage: gens +- [1/2, 1/4*a + 1/4, a] ++ sage: gens # random ++ [1/2, -1/4*a - 1/4, a] ++ sage: gens in ([1/2, -1/4*a - 1/4, a], [1/2, 1/4*a + 1/4, a]) ++ True + + An example to show that the group `K(S,2)` may be strictly + larger than the group of elements giving extensions unramified +@@ -5640,7 +5641,7 @@ def different(self): + sage: k. = NumberField(x^2 + 23) + sage: d = k.different() + sage: d +- Fractional ideal (-a) ++ Fractional ideal (a) + sage: d.norm() + 23 + sage: k.disc() +@@ -5760,7 +5761,7 @@ def elements_of_norm(self, n, proof=None) -> list: + sage: K.elements_of_norm(3) + [] + sage: K.elements_of_norm(50) +- [-a - 7, 5*a - 5, 7*a + 1] ++ [7*a - 1, 5*a - 5, -7*a - 1] + + TESTS: + +@@ -5871,11 +5872,16 @@ def factor(self, n): + sage: K. = NumberField(x^2 + 1) + sage: K.factor(1/3) + (Fractional ideal (3))^-1 +- sage: K.factor(1+a) +- Fractional ideal (a + 1) +- sage: K.factor(1+a/5) +- (Fractional ideal (a + 1)) * (Fractional ideal (-a - 2))^-1 +- * (Fractional ideal (2*a + 1))^-1 * (Fractional ideal (-2*a + 3)) ++ sage: fac = K.factor(1+a); fac # random ++ Fractional ideal (-a - 1) ++ sage: len(fac) ++ 1 ++ sage: fac = K.factor(1+a/5); fac # random ++ (Fractional ideal (-a - 1)) * (Fractional ideal (2*a - 1))^-1 * (Fractional ideal (-2*a - 1))^-1 * (Fractional ideal (3*a + 2)) ++ sage: len(fac) ++ 4 ++ sage: product(I[0]^I[1] for I in list(fac)) ++ Fractional ideal (1/5*a + 1) + + An example over a relative number field:: + +@@ -5908,9 +5914,9 @@ def factor(self, n): + sage: (fi, fj) = f[::] + sage: (fi[1], fj[1]) + (1, 1) +- sage: fi[0] == L.fractional_ideal(1/2*a*b - a + 1/2) ++ sage: fi[0] == L.fractional_ideal(-1/2*a*b - a + 1/2) + True +- sage: fj[0] == L.fractional_ideal(-1/2*a*b - a + 1/2) ++ sage: fj[0] == L.fractional_ideal(1/2*a*b - a + 1/2) + True + """ + return self.ideal(n).factor() +@@ -6507,12 +6513,12 @@ def reduced_basis(self, prec=None): + sage: k. = NumberField(x^6 + 2218926655879913714112*x^4 - 32507675650290949030789018433536*x^3 + 4923635504174417014460581055002374467948544*x^2 - 36066074010564497464129951249279114076897746988630016*x + 264187244046129768986806800244258952598300346857154900812365824) + sage: new_basis = k.reduced_basis(prec=120) + sage: [c.minpoly() for c in new_basis] +- [x - 1, +- x^2 + x + 1, +- x^6 + 3*x^5 - 102*x^4 - 103*x^3 + 10572*x^2 - 59919*x + 127657, +- x^6 + 3*x^5 - 102*x^4 - 103*x^3 + 10572*x^2 - 59919*x + 127657, +- x^3 - 171*x + 848, +- x^6 + 171*x^4 + 1696*x^3 + 29241*x^2 + 145008*x + 719104] ++ [x^2 + x + 1, ++ x - 1, ++ x^6 + 3*x^5 - 102*x^4 - 315*x^3 + 10254*x^2 + 80955*x + 198147, ++ x^6 + 213*x^4 + 12567*x^2 + 198147, ++ x^6 + 171*x^4 - 1696*x^3 + 29241*x^2 - 145008*x + 719104, ++ x^6 + 171*x^4 - 1696*x^3 + 29241*x^2 - 145008*x + 719104] + sage: R = k.order(new_basis) + sage: R.discriminant()==k.discriminant() + True +@@ -7107,14 +7113,14 @@ def units(self, proof=None): + sage: K.units(proof=True) # takes forever, not tested + ... + sage: K.units(proof=False) # result not independently verified +- (-a^9 - a + 1, ++ (a^9 + a - 1, ++ -a^15 + a^12 - a^10 + a^9 + 2*a^8 - 3*a^7 - a^6 + 3*a^5 - a^4 - 4*a^3 + 3*a^2 + 2*a - 2, ++ a^15 + a^14 + a^13 + a^12 + a^10 - a^7 - a^6 - a^2 - 1, ++ 2*a^16 - 3*a^15 + 3*a^14 - 3*a^13 + 3*a^12 - a^11 + a^9 - 3*a^8 + 4*a^7 - 5*a^6 + 6*a^5 - 4*a^4 + 3*a^3 - 2*a^2 - 2*a + 4, + -a^16 + a^15 - a^14 + a^12 - a^11 + a^10 + a^8 - a^7 + 2*a^6 - a^4 + 3*a^3 - 2*a^2 + 2*a - 1, +- 2*a^16 - a^14 - a^13 + 3*a^12 - 2*a^10 + a^9 + 3*a^8 - 3*a^6 + 3*a^5 + 3*a^4 - 2*a^3 - 2*a^2 + 3*a + 4, +- a^15 + a^14 + 2*a^11 + a^10 - a^9 + a^8 + 2*a^7 - a^5 + 2*a^3 - a^2 - 3*a + 1, +- -a^16 - a^15 - a^14 - a^13 - a^12 - a^11 - a^10 - a^9 - a^8 - a^7 - a^6 - a^5 - a^4 - a^3 - a^2 + 2, +- -2*a^16 + 3*a^15 - 3*a^14 + 3*a^13 - 3*a^12 + a^11 - a^9 + 3*a^8 - 4*a^7 + 5*a^6 - 6*a^5 + 4*a^4 - 3*a^3 + 2*a^2 + 2*a - 4, +- a^15 - a^12 + a^10 - a^9 - 2*a^8 + 3*a^7 + a^6 - 3*a^5 + a^4 + 4*a^3 - 3*a^2 - 2*a + 2, +- 2*a^16 + a^15 - a^11 - 3*a^10 - 4*a^9 - 4*a^8 - 4*a^7 - 5*a^6 - 7*a^5 - 8*a^4 - 6*a^3 - 5*a^2 - 6*a - 7) ++ a^16 - 2*a^15 - 2*a^13 - a^12 - a^11 - 2*a^10 + a^9 - 2*a^8 + 2*a^7 - 3*a^6 - 3*a^4 - 2*a^3 - a^2 - 4*a + 2, ++ -a^15 - a^14 - 2*a^11 - a^10 + a^9 - a^8 - 2*a^7 + a^5 - 2*a^3 + a^2 + 3*a - 1, ++ -3*a^16 - 3*a^15 - 3*a^14 - 3*a^13 - 3*a^12 - 2*a^11 - 2*a^10 - 2*a^9 - a^8 + a^7 + 2*a^6 + 3*a^5 + 3*a^4 + 4*a^3 + 6*a^2 + 8*a + 8) + + TESTS: + +@@ -7123,7 +7129,7 @@ def units(self, proof=None): + + sage: K. = NumberField(1/2*x^2 - 1/6) + sage: K.units() +- (3*a - 2,) ++ (-3*a + 2,) + """ + proof = proof_flag(proof) + +@@ -7205,14 +7211,14 @@ def unit_group(self, proof=None): + (u0, u1, u2, u3, u4, u5, u6, u7, u8) + sage: U.gens_values() # result not independently verified + [-1, +- -a^9 - a + 1, ++ a^9 + a - 1, ++ -a^15 + a^12 - a^10 + a^9 + 2*a^8 - 3*a^7 - a^6 + 3*a^5 - a^4 - 4*a^3 + 3*a^2 + 2*a - 2, ++ a^15 + a^14 + a^13 + a^12 + a^10 - a^7 - a^6 - a^2 - 1, ++ 2*a^16 - 3*a^15 + 3*a^14 - 3*a^13 + 3*a^12 - a^11 + a^9 - 3*a^8 + 4*a^7 - 5*a^6 + 6*a^5 - 4*a^4 + 3*a^3 - 2*a^2 - 2*a + 4, + -a^16 + a^15 - a^14 + a^12 - a^11 + a^10 + a^8 - a^7 + 2*a^6 - a^4 + 3*a^3 - 2*a^2 + 2*a - 1, +- 2*a^16 - a^14 - a^13 + 3*a^12 - 2*a^10 + a^9 + 3*a^8 - 3*a^6 + 3*a^5 + 3*a^4 - 2*a^3 - 2*a^2 + 3*a + 4, +- a^15 + a^14 + 2*a^11 + a^10 - a^9 + a^8 + 2*a^7 - a^5 + 2*a^3 - a^2 - 3*a + 1, +- -a^16 - a^15 - a^14 - a^13 - a^12 - a^11 - a^10 - a^9 - a^8 - a^7 - a^6 - a^5 - a^4 - a^3 - a^2 + 2, +- -2*a^16 + 3*a^15 - 3*a^14 + 3*a^13 - 3*a^12 + a^11 - a^9 + 3*a^8 - 4*a^7 + 5*a^6 - 6*a^5 + 4*a^4 - 3*a^3 + 2*a^2 + 2*a - 4, +- a^15 - a^12 + a^10 - a^9 - 2*a^8 + 3*a^7 + a^6 - 3*a^5 + a^4 + 4*a^3 - 3*a^2 - 2*a + 2, +- 2*a^16 + a^15 - a^11 - 3*a^10 - 4*a^9 - 4*a^8 - 4*a^7 - 5*a^6 - 7*a^5 - 8*a^4 - 6*a^3 - 5*a^2 - 6*a - 7] ++ a^16 - 2*a^15 - 2*a^13 - a^12 - a^11 - 2*a^10 + a^9 - 2*a^8 + 2*a^7 - 3*a^6 - 3*a^4 - 2*a^3 - a^2 - 4*a + 2, ++ -a^15 - a^14 - 2*a^11 - a^10 + a^9 - a^8 - 2*a^7 + a^5 - 2*a^3 + a^2 + 3*a - 1, ++ -3*a^16 - 3*a^15 - 3*a^14 - 3*a^13 - 3*a^12 - 2*a^11 - 2*a^10 - 2*a^9 - a^8 + a^7 + 2*a^6 + 3*a^5 + 3*a^4 + 4*a^3 + 6*a^2 + 8*a + 8] + """ + proof = proof_flag(proof) + +@@ -7261,8 +7267,8 @@ def S_unit_group(self, proof=None, S=None): + sage: U = K.S_unit_group(S=a); U + S-unit group with structure C10 x Z x Z x Z of + Number Field in a with defining polynomial x^4 - 10*x^3 + 100*x^2 - 375*x + 1375 +- with S = (Fractional ideal (5, 1/275*a^3 + 4/55*a^2 - 5/11*a + 5), +- Fractional ideal (11, 1/275*a^3 + 4/55*a^2 - 5/11*a + 9)) ++ with S = (Fractional ideal (5, -7/275*a^3 + 1/11*a^2 - 9/11*a), ++ Fractional ideal (11, -7/275*a^3 + 1/11*a^2 - 9/11*a + 3)) + sage: U.gens() + (u0, u1, u2, u3) + sage: U.gens_values() # random +@@ -7273,8 +7279,8 @@ def S_unit_group(self, proof=None, S=None): + sage: [u.multiplicative_order() for u in U.gens()] + [10, +Infinity, +Infinity, +Infinity] + sage: U.primes() +- (Fractional ideal (5, 1/275*a^3 + 4/55*a^2 - 5/11*a + 5), +- Fractional ideal (11, 1/275*a^3 + 4/55*a^2 - 5/11*a + 9)) ++ (Fractional ideal (5, -7/275*a^3 + 1/11*a^2 - 9/11*a), ++ Fractional ideal (11, -7/275*a^3 + 1/11*a^2 - 9/11*a + 3)) + + With the default value of `S`, the S-unit group is the same as + the global unit group:: +@@ -7426,8 +7432,8 @@ def S_unit_solutions(self, S=[], prec=106, include_exponents=False, include_boun + + sage: # needs sage.rings.padics + sage: solutions, bound = K.S_unit_solutions(S, prec=100, include_bound=True) +- sage: bound +- 7 ++ sage: bound in (6, 7) ++ True + """ + from .S_unit_solver import solve_S_unit_equation + return solve_S_unit_equation(self, S, prec, include_exponents, include_bound, proof) +@@ -8782,7 +8788,7 @@ def subfields(self, degree=0, name=None): + (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: + From: Number Field in a1 with defining polynomial x^2 - 2 + To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 +- Defn: a1 |--> a^2 + 3/2, None), ++ Defn: a1 |--> -a^2 - 3/2, None), + (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: + From: Number Field in a2 with defining polynomial x^2 + 4 + To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 +@@ -8790,14 +8796,14 @@ def subfields(self, degree=0, name=None): + (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: + From: Number Field in a3 with defining polynomial x^2 + 2 + To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 +- Defn: a3 |--> 2*a^3 + 5*a, None), ++ Defn: a3 |--> -2*a^3 - 5*a, None), + (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: + From: Number Field in a4 with defining polynomial x^4 + 1 + To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 +- Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: ++ Defn: a4 |--> -a^3 - 1/2*a^2 - 5/2*a - 3/4, Ring morphism: + From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 + To: Number Field in a4 with defining polynomial x^4 + 1 +- Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4) ++ Defn: a |--> 1/2*a4^3 + a4^2 + 1/2*a4) + ] + """ + return self._subfields_helper(degree=degree, name=name, +@@ -12694,12 +12700,12 @@ def _splitting_classes_gens_(K, m, d): + sage: L = K.subfields(20)[0][0] + sage: L.conductor() # needs sage.groups + 101 +- sage: _splitting_classes_gens_(L,101,20) # needs sage.libs.gap # optional - gap_package_polycyclic ++ sage: _splitting_classes_gens_(L,101,20) # optional - gap_package_polycyclic, needs sage.libs.gap + [95] + + sage: K = CyclotomicField(44) + sage: L = K.subfields(4)[0][0] +- sage: _splitting_classes_gens_(L,44,4) # needs sage.libs.gap # optional - gap_package_polycyclic ++ sage: _splitting_classes_gens_(L,44,4) # optional - gap_package_polycyclic, needs sage.libs.gap + [37] + + sage: K = CyclotomicField(44) +@@ -12711,7 +12717,7 @@ def _splitting_classes_gens_(K, m, d): + with zeta44_0 = 3.837971894457990? + sage: L.conductor() # needs sage.groups + 11 +- sage: _splitting_classes_gens_(L,11,5) # needs sage.libs.gap # optional - gap_package_polycyclic ++ sage: _splitting_classes_gens_(L,11,5) # optional - gap_package_polycyclic, needs sage.libs.gap + [10] + """ + from sage.groups.abelian_gps.abelian_group import AbelianGroup +diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx +index 27432813b2b..1a676ee087b 100644 +--- a/src/sage/rings/number_field/number_field_element.pyx ++++ b/src/sage/rings/number_field/number_field_element.pyx +@@ -1954,14 +1954,14 @@ cdef class NumberFieldElement(NumberFieldElement_base): + sage: x = polygen(ZZ, 'x') + sage: K. = NumberField(x^2 + 1) + sage: (6*i + 6).factor() +- (-i) * (i + 1)^3 * 3 ++ (i) * (-i - 1)^3 * 3 + + In the following example, the class number is 2. If a factorization + in prime elements exists, we will find it:: + + sage: K. = NumberField(x^2 - 10) + sage: factor(169*a + 531) +- (-6*a - 19) * (-3*a - 1) * (-2*a + 9) ++ (-6*a - 19) * (2*a - 9) * (3*a + 1) + sage: factor(K(3)) + Traceback (most recent call last): + ... +@@ -4238,7 +4238,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): + + sage: P5s = F(5).support() + sage: P5s +- [Fractional ideal (-t^2 - 1), Fractional ideal (t^2 - 2*t - 1)] ++ [Fractional ideal (t^2 + 1), Fractional ideal (t^2 - 2*t - 1)] + sage: all(5 in P5 for P5 in P5s) + True + sage: all(P5.is_prime() for P5 in P5s) +@@ -4487,7 +4487,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): + sage: f = Qi.embeddings(K)[0] + sage: a = f(2+3*i) * (2-zeta)^2 + sage: a.descend_mod_power(Qi,2) +- [-2*i + 3, 3*i + 2] ++ [3*i + 2, 2*i - 3] + + An absolute example:: + +diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py +index 3686840ccba..b269045cf96 100644 +--- a/src/sage/rings/number_field/number_field_ideal.py ++++ b/src/sage/rings/number_field/number_field_ideal.py +@@ -75,7 +75,7 @@ class NumberFieldIdeal(Ideal_generic): + Fractional ideal (3) + sage: F = pari(K).idealprimedec(5) + sage: K.ideal(F[0]) +- Fractional ideal (2*i + 1) ++ Fractional ideal (-2*i - 1) + + TESTS: + +@@ -236,7 +236,7 @@ def _richcmp_(self, other, op): + sage: K. = NumberField(x^2 + 3); K + Number Field in a with defining polynomial x^2 + 3 + sage: f = K.factor(15); f +- (Fractional ideal (1/2*a + 3/2))^2 * (Fractional ideal (5)) ++ (Fractional ideal (-a))^2 * (Fractional ideal (5)) + sage: (f[0][0] < f[1][0]) + True + sage: (f[0][0] == f[0][0]) +@@ -273,7 +273,7 @@ def _mul_(self, other): + sage: A = K.ideal([5, 2 + I]) + sage: B = K.ideal([13, 5 + 12*I]) + sage: A*B +- Fractional ideal (4*I - 7) ++ Fractional ideal (-4*I + 7) + sage: (K.ideal(3 + I) * K.ideal(7 + I)).gens() + (10*I + 20,) + +@@ -683,17 +683,17 @@ def free_module(self): + sage: I.free_module() + Free module of degree 4 and rank 4 over Integer Ring + User basis matrix: +- [ 4 0 0 0] +- [ -3 7 -1 1] +- [ 3 7 1 1] +- [ 0 -10 0 -2] ++ [ 4 0 0 0] ++ [ 3 7 1 1] ++ [ 0 10 0 2] ++ [ 3 -7 1 -1] + sage: J = I^(-1); J.free_module() + Free module of degree 4 and rank 4 over Integer Ring + User basis matrix: + [ 1/4 0 0 0] +- [-3/16 7/16 -1/16 1/16] + [ 3/16 7/16 1/16 1/16] +- [ 0 -5/8 0 -1/8] ++ [ 0 5/8 0 1/8] ++ [ 3/16 -7/16 1/16 -1/16] + + An example of intersecting ideals by intersecting free modules.:: + +@@ -790,7 +790,7 @@ def gens_reduced(self, proof=None): + sage: J.is_principal() + False + sage: J.gens_reduced() +- (5, a) ++ (5, -a) + sage: all(j.parent() is K for j in J.gens()) + True + sage: all(j.parent() is K for j in J.gens_reduced()) +@@ -2069,7 +2069,7 @@ def ramification_index(self): + sage: K. = NumberField(x^2 + 2); K + Number Field in a with defining polynomial x^2 + 2 + sage: f = K.factor(2); f +- (Fractional ideal (a))^2 ++ (Fractional ideal (...a))^2 + sage: f[0][0].ramification_index() + 2 + sage: K.ideal(13).ramification_index() +@@ -2416,9 +2416,9 @@ def denominator(self): + sage: I = K.ideal((3+4*i)/5); I + Fractional ideal (4/5*i + 3/5) + sage: I.denominator() +- Fractional ideal (2*i + 1) ++ Fractional ideal (-2*i - 1) + sage: I.numerator() +- Fractional ideal (-i - 2) ++ Fractional ideal (2*i - 1) + sage: I.numerator().is_integral() and I.denominator().is_integral() + True + sage: I.numerator() + I.denominator() == K.unit_ideal() +@@ -2447,9 +2447,9 @@ def numerator(self): + sage: I = K.ideal((3+4*i)/5); I + Fractional ideal (4/5*i + 3/5) + sage: I.denominator() +- Fractional ideal (2*i + 1) ++ Fractional ideal (-2*i - 1) + sage: I.numerator() +- Fractional ideal (-i - 2) ++ Fractional ideal (2*i - 1) + sage: I.numerator().is_integral() and I.denominator().is_integral() + True + sage: I.numerator() + I.denominator() == K.unit_ideal() +@@ -3164,11 +3164,11 @@ def _p_quotient(self, p): + Partially defined quotient map + from Number Field in i with defining polynomial x^2 + 1 + to an explicit vector space representation for the quotient of +- the ring of integers by (p,I) for the ideal I=Fractional ideal (-i - 2). ++ the ring of integers by (p,I) for the ideal I=Fractional ideal (2*i - 1). + sage: lift + Lifting map + to Gaussian Integers generated by i in Number Field in i with defining polynomial x^2 + 1 +- from quotient of integers by Fractional ideal (-i - 2) ++ from quotient of integers by Fractional ideal (2*i - 1) + """ + return quotient_char_p(self, p) + +@@ -3213,11 +3213,11 @@ def residue_field(self, names=None): + + sage: K. = NumberField(x^2 + 1) + sage: P1, P2 = [g[0] for g in K.factor(5)]; P1, P2 +- (Fractional ideal (-i - 2), Fractional ideal (2*i + 1)) ++ (Fractional ideal (2*i - 1), Fractional ideal (-2*i - 1)) + sage: a = 1/(1+2*i) + sage: F1, F2 = [g.residue_field() for g in [P1, P2]]; F1, F2 +- (Residue field of Fractional ideal (-i - 2), +- Residue field of Fractional ideal (2*i + 1)) ++ (Residue field of Fractional ideal (2*i - 1), ++ Residue field of Fractional ideal (-2*i - 1)) + sage: a.valuation(P1) + 0 + sage: F1(i/7) +@@ -3230,7 +3230,7 @@ def residue_field(self, names=None): + Traceback (most recent call last): + ... + ZeroDivisionError: Cannot reduce field element -2/5*i + 1/5 +- modulo Fractional ideal (2*i + 1): it has negative valuation ++ modulo Fractional ideal (-2*i - 1): it has negative valuation + + An example with a relative number field:: + +@@ -3491,7 +3491,7 @@ def quotient_char_p(I, p): + [] + + sage: I = K.factor(13)[0][0]; I +- Fractional ideal (-2*i + 3) ++ Fractional ideal (3*i + 2) + sage: I.residue_class_degree() + 1 + sage: quotient_char_p(I, 13)[0] +diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py +index 7f6cfd9b1b7..eb39f6f4d12 100644 +--- a/src/sage/rings/number_field/number_field_ideal_rel.py ++++ b/src/sage/rings/number_field/number_field_ideal_rel.py +@@ -11,7 +11,7 @@ + sage: G = [from_A(z) for z in I.gens()]; G + [7, -2*b*a - 1] + sage: K.fractional_ideal(G) +- Fractional ideal ((1/2*b + 2)*a - 1/2*b + 2) ++ Fractional ideal ((-1/2*b + 2)*a - 1/2*b - 2) + sage: K.fractional_ideal(G).absolute_norm().factor() + 7^2 + +@@ -277,7 +277,7 @@ def gens_reduced(self): + sage: L. = K.extension(5*x^2 + 1) + sage: P = L.primes_above(2)[0] + sage: P.gens_reduced() +- (2, -15*a*b + 3*a + 1) ++ (2, -15*a*b - 3*a + 1) + """ + try: + # Compute the single generator, if it exists +@@ -385,7 +385,7 @@ def relative_norm(self): + sage: K. = NumberField(x^2 + 6) + sage: L. = K.extension(K['x'].gen()^4 + a) + sage: N = L.ideal(b).relative_norm(); N +- Fractional ideal (-a) ++ Fractional ideal (a) + sage: N.parent() + Monoid of ideals of Number Field in a with defining polynomial x^2 + 6 + sage: N.ring() +@@ -409,8 +409,10 @@ def relative_norm(self): + sage: K. = NumberField(2*x^2 - 1/3) + sage: L. = K.extension(5*x^2 + 1) + sage: P = L.primes_above(2)[0] +- sage: P.relative_norm() +- Fractional ideal (6*a + 2) ++ sage: rn = P.relative_norm(); rn # random ++ Fractional ideal (6*a - 2) ++ sage: rn in [K.ideal(6*a - 2), K.ideal(-6*a -2)] ++ True + """ + L = self.number_field() + K = L.base_field() +@@ -528,8 +530,10 @@ def ideal_below(self): + sage: K. = NumberField(2*x^2 - 1/3) + sage: L. = K.extension(5*x^2 + 1) + sage: P = L.primes_above(2)[0] +- sage: P.ideal_below() +- Fractional ideal (6*a + 2) ++ sage: ib = P.ideal_below(); ib # random ++ Fractional ideal (6*a - 2) ++ sage: ib in [K.ideal(6*a - 2), K.ideal(-6*a -2)] ++ True + """ + L = self.number_field() + K = L.base_field() +@@ -548,14 +552,12 @@ def factor(self): + sage: x = polygen(ZZ, 'x') + sage: K. = QQ.extension([x^2 + 11, x^2 - 5]) + sage: K.factor(5) +- (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4))^2 +- * (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4))^2 ++ (Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 3/4))^2 * (Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 7/4))^2 + sage: K.ideal(5).factor() +- (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4))^2 +- * (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4))^2 ++ (Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 3/4))^2 * (Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 7/4))^2 + sage: K.ideal(5).prime_factors() +- [Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4), +- Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4)] ++ [Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 3/4), ++ Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 7/4)] + + sage: PQ. = QQ[] + sage: F. = NumberFieldTower([X^2 - 2, X^2 - 3]) +@@ -914,7 +916,7 @@ def is_NumberFieldFractionalIdeal_rel(x): + sage: is_NumberFieldFractionalIdeal_rel(I) + True + sage: N = I.relative_norm(); N +- Fractional ideal (-a) ++ Fractional ideal (a) + sage: is_NumberFieldFractionalIdeal_rel(N) + False + """ +diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py +index 9ab6fd4c261..6e9bf71baf4 100644 +--- a/src/sage/rings/number_field/number_field_rel.py ++++ b/src/sage/rings/number_field/number_field_rel.py +@@ -233,21 +233,21 @@ def __init__(self, base, polynomial, name, + sage: l. = k.extension(5*x^2 + 3); l + Number Field in b with defining polynomial 5*x^2 + 3 over its base field + sage: l.pari_rnf() +- [x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4), ..., y^4 + 6*y^2 + 1, x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4)], [0, 0]] ++ [x^2 + (5/4*y^3 - 1/4*y^2 + 27/4*y - 3/4)*x + (-9/4*y^3 - 1/4*y^2 - 47/4*y - 7/4), ..., y^4 + 6*y^2 + 1, x^2 + (5/4*y^3 - 1/4*y^2 + 27/4*y - 3/4)*x + (-9/4*y^3 - 1/4*y^2 - 47/4*y - 7/4)], [0, 0]] + sage: b + b + + sage: l. = k.extension(x^2 + 3/5); l + Number Field in b with defining polynomial x^2 + 3/5 over its base field + sage: l.pari_rnf() +- [x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4), ..., y^4 + 6*y^2 + 1, x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4)], [0, 0]] ++ [x^2 + (5/4*y^3 - 1/4*y^2 + 27/4*y - 3/4)*x + (-9/4*y^3 - 1/4*y^2 - 47/4*y - 7/4), ..., y^4 + 6*y^2 + 1, x^2 + (5/4*y^3 - 1/4*y^2 + 27/4*y - 3/4)*x + (-9/4*y^3 - 1/4*y^2 - 47/4*y - 7/4)], [0, 0]] + sage: b + b + + sage: l. = k.extension(x - 1/a0); l + Number Field in b with defining polynomial x + 1/2*a0 over its base field + sage: l.pari_rnf() +- [x, [4, -x^3 - x^2 - 7*x - 3, -x^3 + x^2 - 7*x + 3, 2*x^3 + 10*x], ..., [x^4 + 6*x^2 + 1, -x, -1, y^4 + 6*y^2 + 1, x], [0, 0]] ++ [x, [4, -x^3 + x^2 - 7*x + 3, -2*x^3 - 10*x, x^3 + x^2 + 7*x + 3], ..., [x^4 + 6*x^2 + 1, -x, -1, y^4 + 6*y^2 + 1, x], [0, 0]] + sage: b + -1/2*a0 + +@@ -1635,9 +1635,9 @@ def _pari_relative_structure(self): + sage: K. = NumberField(x^2 + 1) + sage: L. = K.extension(x^2 - 1/2) + sage: L._pari_relative_structure() +- (x^2 + Mod(-y, y^2 + 1), +- Mod(Mod(1/2*y - 1/2, y^2 + 1)*x, x^2 + Mod(-y, y^2 + 1)), +- Mod(Mod(-y - 1, y^2 + 1)*x, Mod(1, y^2 + 1)*x^2 + Mod(-1/2, y^2 + 1))) ++ (x^2 + Mod(y, y^2 + 1), ++ Mod(Mod(-1/2*y - 1/2, y^2 + 1)*x, x^2 + Mod(y, y^2 + 1)), ++ Mod(Mod(y - 1, y^2 + 1)*x, x^2 + Mod(-1/2, y^2 + 1))) + + An example where both fields are defined by non-integral or + non-monic polynomials:: +@@ -1937,7 +1937,7 @@ def absolute_polynomial(self): + sage: k.relative_polynomial() + x^2 + 1/3 + sage: k.pari_relative_polynomial() +- x^2 + Mod(y, y^2 + 1)*x - 1 ++ x^2 + Mod(-y, y^2 + 1)*x - 1 + """ + return QQ['x'](self._pari_rnfeq()[0]) + +@@ -2721,7 +2721,7 @@ def uniformizer(self, P, others='positive'): + sage: x = polygen(ZZ, 'x') + sage: K. = NumberField([x^2 + 23, x^2 - 3]) + sage: P = K.prime_factors(5)[0]; P +- Fractional ideal (5, 1/2*a + b - 5/2) ++ Fractional ideal (5, -1/2*a + b + 5/2) + sage: u = K.uniformizer(P) + sage: u.valuation(P) + 1 +diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py +index 55db3bbbcbf..8b69baf5464 100644 +--- a/src/sage/rings/number_field/order.py ++++ b/src/sage/rings/number_field/order.py +@@ -495,7 +495,7 @@ def fractional_ideal(self, *args, **kwds): + sage: K. = NumberField(x^2 + 2) + sage: R = K.maximal_order() + sage: R.fractional_ideal(2/3 + 7*a, a) +- Fractional ideal (1/3*a) ++ Fractional ideal (-1/3*a) + """ + return self.number_field().fractional_ideal(*args, **kwds) + +@@ -569,7 +569,7 @@ def __mul__(self, right): + sage: k. = NumberField(x^2 + 5077); G = k.class_group(); G + Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077 + sage: G.0 ^ -9 +- Fractional ideal class (43, a + 13) ++ Fractional ideal class (67, a + 45) + sage: Ok = k.maximal_order(); Ok + Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077 + sage: Ok * (11, a + 7) +@@ -2918,7 +2918,7 @@ def GaussianIntegers(names='I', latex_name='i'): + sage: ZZI + Gaussian Integers generated by I in Number Field in I with defining polynomial x^2 + 1 with I = 1*I + sage: factor(3 + I) +- (-I) * (I + 1) * (2*I + 1) ++ (-I) * (I - 2) * (-I + 1) + sage: CC(I) + 1.00000000000000*I + sage: I.minpoly() +@@ -2949,7 +2949,7 @@ def EisensteinIntegers(names='omega'): + with defining polynomial x^2 + x + 1 + with omega = -0.50000000000000000? + 0.866025403784439?*I + sage: factor(3 + omega) +- (-1) * (-omega - 3) ++ (omega + 1) * (-2*omega + 1) + sage: CC(omega) + -0.500000000000000 + 0.866025403784439*I + sage: omega.minpoly() +diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py +index acdf2954fdf..7da6b58a209 100644 +--- a/src/sage/rings/number_field/selmer_group.py ++++ b/src/sage/rings/number_field/selmer_group.py +@@ -71,7 +71,7 @@ def _ideal_generator(I): + + sage: K. = QuadraticField(-11) + sage: [_ideal_generator(K.prime_above(p)) for p in primes(25)] +- [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, -a, 13, 17, 19, 1/2*a + 9/2] ++ [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, a, 13, 17, 19, 1/2*a + 9/2] + """ + try: + return I.gens_reduced()[0] +diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py +index e12977e8464..c5bf39a1c73 100644 +--- a/src/sage/rings/polynomial/polynomial_quotient_ring.py ++++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py +@@ -1429,13 +1429,13 @@ def S_class_group(self, S, proof=True): + sage: R. = K[] + sage: S. = R.quotient(x^2 + 23) + sage: S.S_class_group([]) +- [((2, -a + 1, 1/2*xbar + 1/2, -1/2*a*xbar + 1/2*a + 1), 6)] ++ [((2, a + 1, -1/2*xbar + 3/2, 1/2*a*xbar - 1/2*a + 1), 6)] + sage: S.S_class_group([K.ideal(3, a-1)]) + [] + sage: S.S_class_group([K.ideal(2, a+1)]) + [] + sage: S.S_class_group([K.ideal(a)]) +- [((2, -a + 1, 1/2*xbar + 1/2, -1/2*a*xbar + 1/2*a + 1), 6)] ++ [((2, a + 1, -1/2*xbar + 3/2, 1/2*a*xbar - 1/2*a + 1), 6)] + + Now we take an example over a nontrivial base with two factors, each + contributing to the class group:: +@@ -1495,14 +1495,14 @@ def S_class_group(self, S, proof=True): + sage: C = S.S_class_group([]) + sage: C[:2] + [((1/4*xbar^2 + 31/4, +- (-1/8*a + 1/8)*xbar^2 - 31/8*a + 31/8, +- 1/16*xbar^3 + 1/16*xbar^2 + 31/16*xbar + 31/16, +- -1/16*a*xbar^3 + (1/16*a + 1/8)*xbar^2 - 31/16*a*xbar + 31/16*a + 31/8), ++ (1/8*a + 1/8)*xbar^2 + 31/8*a + 31/8, ++ -1/16*xbar^3 + 3/16*xbar^2 - 31/16*xbar + 93/16, ++ 1/16*a*xbar^3 + (-1/16*a + 1/8)*xbar^2 + 31/16*a*xbar - 31/16*a + 31/8), + 6), + ((-1/4*xbar^2 - 23/4, +- (1/8*a - 1/8)*xbar^2 + 23/8*a - 23/8, +- -1/16*xbar^3 - 1/16*xbar^2 - 23/16*xbar - 23/16, +- 1/16*a*xbar^3 + (-1/16*a - 1/8)*xbar^2 + 23/16*a*xbar - 23/16*a - 23/8), ++ (-1/8*a - 1/8)*xbar^2 - 23/8*a - 23/8, ++ 1/16*xbar^3 + 1/16*xbar^2 + 23/16*xbar + 23/16, ++ -1/16*a*xbar^3 + (1/16*a - 1/8)*xbar^2 - 23/16*a*xbar + 23/16*a - 23/8), + 6)] + sage: C[2][1] + 2 +@@ -1514,11 +1514,11 @@ def S_class_group(self, S, proof=True): + ....: 1/16*a*xbar^3 - 1/16*a*xbar^2 + 23/16*a*xbar - 23/16*a) + sage: gens[0] == expected_gens[0] + True +- sage: gens[1] in (expected_gens[1], expected_gens[1]/2 + expected_gens[0]/2) ++ sage: gens[1] in (expected_gens[1], expected_gens[1]/2 + expected_gens[0]/2, -expected_gens[1]/2 + expected_gens[0]/2) + True +- sage: gens[2] in (expected_gens[2], expected_gens[2] + expected_gens[0]/2) ++ sage: gens[2] in (expected_gens[2], expected_gens[2] + expected_gens[0]/2, -expected_gens[2] + expected_gens[0]/2) + True +- sage: gens[3] in (expected_gens[3], expected_gens[3] + expected_gens[0]/2) ++ sage: gens[3] in (expected_gens[3], expected_gens[3] + expected_gens[0]/2, -expected_gens[3] + expected_gens[0]/2) + True + """ + fields, isos, iso_classes = self._S_decomposition(tuple(S)) +@@ -1611,7 +1611,7 @@ def class_group(self, proof=True): + sage: R. = K[] + sage: S. = R.quotient(x^2 + 23) + sage: S.class_group() +- [((2, -a + 1, 1/2*xbar + 1/2, -1/2*a*xbar + 1/2*a + 1), 6)] ++ [((2, a + 1, -1/2*xbar + 3/2, 1/2*a*xbar - 1/2*a + 1), 6)] + + Here is an example of a product of number fields, both of which + contribute to the class group:: +@@ -1711,19 +1711,19 @@ def S_units(self, S, proof=True): + with defining polynomial x^2 + 3 with a = 1.732050807568878?*I + with modulus y^3 + 5 + sage: [u for u, o in L.S_units([]) if o is Infinity] +- [(-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2, +- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2] ++ [(-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3, ++ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2] + sage: [u for u, o in L.S_units([K.ideal(1/2*a - 3/2)]) + ....: if o is Infinity] + [(-1/6*a - 1/2)*b^2 + (1/3*a - 1)*b + 4/3*a, +- (-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2, +- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2] ++ (-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3, ++ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2] + sage: [u for u, o in L.S_units([K.ideal(2)]) if o is Infinity] + [(1/2*a - 1/2)*b^2 + (a + 1)*b + 3, +- (1/6*a + 1/2)*b^2 + (-1/3*a + 1)*b - 5/6*a + 1/2, + (1/6*a + 1/2)*b^2 + (-1/3*a + 1)*b - 5/6*a - 1/2, +- (-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2, +- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2] ++ 1/3*a*b^2 + (1/3*a + 1)*b - 1/6*a + 3/2, ++ (-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3, ++ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2] + + Note that all the returned values live where we expect them to:: + +@@ -1808,8 +1808,8 @@ def units(self, proof=True): + with defining polynomial x^2 + 3 with a = 1.732050807568878?*I + with modulus y^3 + 5 + sage: [u for u, o in L.units() if o is Infinity] +- [(-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2, +- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2] ++ [(-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3, ++ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2] + sage: L. = K.extension(y^3 + 5) + sage: L.unit_group() + Unit group with structure C6 x Z x Z of +@@ -1817,8 +1817,8 @@ def units(self, proof=True): + sage: L.unit_group().gens() # abstract generators + (u0, u1, u2) + sage: L.unit_group().gens_values()[1:] +- [(-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2, +- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2] ++ [(-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3, ++ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2] + + Note that all the returned values live where we expect them to:: + +diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py +index 300d64b8279..08c04e6e234 100644 +--- a/src/sage/rings/qqbar.py ++++ b/src/sage/rings/qqbar.py +@@ -2776,11 +2776,12 @@ def number_field_elements_from_algebraics(numbers, minimal=False, + To: Algebraic Real Field + Defn: a |--> 1.732050807568878?) + sage: number_field_elements_from_algebraics((rt2,qqI)) # needs sage.symbolic +- (Number Field in a with defining polynomial y^4 + 1, [-a^3 + a, a^2], ++ (Number Field in a with defining polynomial y^4 + 1, ++ [a^3 - a, a^2], + Ring morphism: +- From: Number Field in a with defining polynomial y^4 + 1 +- To: Algebraic Field +- Defn: a |--> 0.7071067811865475? + 0.7071067811865475?*I) ++ From: Number Field in a with defining polynomial y^4 + 1 ++ To: Algebraic Field ++ Defn: a |--> -0.7071067811865475? - 0.7071067811865475?*I) + + Note that for the first example, where \sage does not realize that + the number is real, we get a homomorphism to ``QQbar``:: +@@ -4590,8 +4591,7 @@ def _exact_field(self): + Number Field in a with defining polynomial y^4 - 20*y^2 + 81 + with a in -3.789313782671036? + sage: (QQbar(7)^(3/5))._exact_field() +- Number Field in a with defining polynomial +- y^5 - 2*y^4 - 18*y^3 + 38*y^2 + 82*y - 181 with a in 2.554256611698490? ++ Number Field in a with defining polynomial y^5 - 7 with a in 1.475773161594552? + """ + sd = self._descr + if isinstance(sd, (ANRational, ANExtensionElement)): +@@ -4611,7 +4611,7 @@ def _exact_value(self): + sage: (sqrt(QQbar(2)) + sqrt(QQbar(19)))._exact_value() + -1/9*a^3 + a^2 + 11/9*a - 10 where a^4 - 20*a^2 + 81 = 0 and a in -3.789313782671036? + sage: (QQbar(7)^(3/5))._exact_value() +- 2*a^4 + 2*a^3 - 34*a^2 - 17*a + 150 where a^5 - 2*a^4 - 18*a^3 + 38*a^2 + 82*a - 181 = 0 and a in 2.554256611698490? ++ a^3 where a^5 - 7 = 0 and a in 1.475773161594552? + """ + sd = self._descr + if isinstance(sd, (ANRational, ANExtensionElement)): +@@ -7839,8 +7839,8 @@ def handle_sage_input(self, sib, coerce, is_qqbar): + sage: sage_input(v, verify=True) + # Verified + R. = QQ[] +- v = QQbar.polynomial_root(AA.common_polynomial(y^8 - y^7 + y^5 - y^4 + y^3 - y + 1), CIF(RIF(RR(0.91354545764260087), RR(0.91354545764260098)), RIF(RR(0.40673664307580015), RR(0.40673664307580021)))) +- v^5 + v^3 ++ v = QQbar.polynomial_root(AA.common_polynomial(y^8 - y^7 + y^5 - y^4 + y^3 - y + 1), CIF(RIF(RR(0.66913060635885813), RR(0.66913060635885824)), RIF(-RR(0.74314482547739424), -RR(0.74314482547739413)))) ++ v^6 + v^5 + sage: v = QQbar(sqrt(AA(2))) + sage: v.exactify() + sage: sage_input(v, verify=True) +diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx +index 272650abeef..0dbe3453dd2 100644 +--- a/src/sage/rings/rational.pyx ++++ b/src/sage/rings/rational.pyx +@@ -1446,7 +1446,7 @@ cdef class Rational(sage.structure.element.FieldElement): + sage: 0.is_norm(K) + True + sage: (1/7).is_norm(K, element=True) +- (True, 1/7*beta + 3/7) ++ (True, -3/7*beta + 5/7) + sage: (1/10).is_norm(K, element=True) + (False, None) + sage: (1/691).is_norm(QQ, element=True) +@@ -1558,7 +1558,7 @@ cdef class Rational(sage.structure.element.FieldElement): + EXAMPLES:: + + sage: QQ(2)._bnfisnorm(QuadraticField(-1, 'i')) # needs sage.rings.number_field +- (i + 1, 1) ++ (-i + 1, 1) + sage: x = polygen(QQ, 'x') + sage: 7._bnfisnorm(NumberField(x^3 - 2, 'b')) # needs sage.rings.number_field + (1, 7) +diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py +index 0eba4c662ec..2208cefca1d 100755 +--- a/src/sage/schemes/affine/affine_morphism.py ++++ b/src/sage/schemes/affine/affine_morphism.py +@@ -1158,13 +1158,11 @@ def reduce_base_field(self): + sage: H = End(A) + sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) # needs sage.symbolic + sage: f.reduce_base_field() # needs sage.symbolic +- Scheme endomorphism of Affine Space of dimension 1 over Number +- Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 +- with a = 1.442249570307409? + 1.414213562373095?*I ++ Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 with a = 1.442249570307409? - 1.414213562373095?*I + Defn: Defined on coordinates by sending (x) to + ((-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2 - 772/269*a +- - 1092/269)*x^2 + (48/269*a^5 - 27/269*a^4 + 320/269*a^3 - 468/269*a^2 +- + 1041/269*a + 1092/269)) ++ - 1092/269)*x^2 + (-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2 ++ - 1041/269*a - 1092/269)) + + :: + +diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py +index a63dbf57809..84a719adfbb 100755 +--- a/src/sage/schemes/elliptic_curves/ell_field.py ++++ b/src/sage/schemes/elliptic_curves/ell_field.py +@@ -902,7 +902,7 @@ def division_field(self, n, names='t', map=False, **kwds): + by y^2 = x^3 + 5*a0*x^2 + (-200*a0^2)*x + (-42000*a0^2+42000*a0+126000) + over Number Field in a0 with defining polynomial x^3 - 3*x^2 + 3*x + 9 + sage: K. = E.division_field(3, simplify_all=True); K +- Number Field in b with defining polynomial x^12 - 25*x^10 + 130*x^8 + 645*x^6 + 1050*x^4 + 675*x^2 + 225 ++ Number Field in b with defining polynomial x^12 + 5*x^10 + 40*x^8 + 315*x^6 + 750*x^4 + 675*x^2 + 2025 + + Some higher-degree examples:: + +diff --git a/src/sage/schemes/elliptic_curves/ell_local_data.py b/src/sage/schemes/elliptic_curves/ell_local_data.py +index 7434659b5a2..df076ed62b6 100755 +--- a/src/sage/schemes/elliptic_curves/ell_local_data.py ++++ b/src/sage/schemes/elliptic_curves/ell_local_data.py +@@ -1161,7 +1161,7 @@ def check_prime(K, P): + sage: check_prime(K, a + 1) + Fractional ideal (a + 1) + sage: [check_prime(K, P) for P in K.primes_above(31)] +- [Fractional ideal (5/2*a + 1/2), Fractional ideal (5/2*a - 1/2)] ++ [Fractional ideal (-5/2*a - 1/2), Fractional ideal (-5/2*a + 1/2)] + sage: L. = NumberField(x^2 + 3) + sage: check_prime(K, L.ideal(5)) + Traceback (most recent call last): +diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py +index eea2e5cc243..cceab500959 100755 +--- a/src/sage/schemes/elliptic_curves/ell_number_field.py ++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py +@@ -229,9 +229,9 @@ def simon_two_descent(self, verbose=0, lim1=2, lim3=4, limtriv=2, + sage: E == loads(dumps(E)) + True + sage: E.simon_two_descent() +- (2, 2, [(0 : 0 : 1), (1/18*a + 7/18 : -5/54*a - 17/54 : 1)]) ++ (2, 2, [(0 : 0 : 1), (1/8*a + 5/8 : -3/16*a - 7/16 : 1)]) + sage: E.simon_two_descent(lim1=5, lim3=5, limtriv=10, maxprob=7, limbigprime=10) +- (2, 2, [(-1 : 0 : 1), (-2 : -1/2*a - 1/2 : 1)]) ++ (2, 2, [(-1 : 0 : 1), (1/2*a - 5/2 : -1/2*a - 13/2 : 1)]) + + :: + +@@ -277,7 +277,7 @@ def simon_two_descent(self, verbose=0, lim1=2, lim3=4, limtriv=2, + sage: E.simon_two_descent() # long time (4s on sage.math, 2013) + (3, + 3, +- [(1/8*zeta43_0^2 - 3/8*zeta43_0 - 1/4 : -5/16*zeta43_0^2 + 7/16*zeta43_0 + 1/8 : 1), ++ [(-1/2*zeta43_0^2 - 1/2*zeta43_0 + 7 : -3/2*zeta43_0^2 - 5/2*zeta43_0 + 18 : 1), + (0 : 0 : 1)]) + """ + verbose = int(verbose) +@@ -872,7 +872,7 @@ def local_data(self, P=None, proof=None, algorithm='pari', globally=False): + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve([1 + i, 0, 1, 0, 0]) + sage: E.local_data() +- [Local data at Fractional ideal (2*i + 1): ++ [Local data at Fractional ideal (-2*i - 1): + Reduction type: bad non-split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 + over Number Field in i with defining polynomial x^2 + 1 +@@ -880,7 +880,7 @@ def local_data(self, P=None, proof=None, algorithm='pari', globally=False): + Conductor exponent: 1 + Kodaira Symbol: I1 + Tamagawa Number: 1, +- Local data at Fractional ideal (-2*i + 3): ++ Local data at Fractional ideal (3*i + 2): + Reduction type: bad split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 + over Number Field in i with defining polynomial x^2 + 1 +@@ -898,7 +898,7 @@ def local_data(self, P=None, proof=None, algorithm='pari', globally=False): + Kodaira Symbol: I0 + Tamagawa Number: 1 + sage: E.local_data(2*i + 1) +- Local data at Fractional ideal (2*i + 1): ++ Local data at Fractional ideal (-2*i - 1): + Reduction type: bad non-split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 + over Number Field in i with defining polynomial x^2 + 1 +@@ -1456,8 +1456,10 @@ def kodaira_symbol(self, P, proof=None): + sage: K. = NumberField(x^2 - 5) + sage: E = EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875]) + sage: bad_primes = E.discriminant().support(); bad_primes +- [Fractional ideal (-a), Fractional ideal (7/2*a - 81/2), +- Fractional ideal (-a - 52), Fractional ideal (2)] ++ [Fractional ideal (-a), ++ Fractional ideal (-7/2*a + 81/2), ++ Fractional ideal (-a - 52), ++ Fractional ideal (2)] + sage: [E.kodaira_symbol(P) for P in bad_primes] + [I0, I1, I1, II] + sage: K. = QuadraticField(-11) +@@ -1483,10 +1485,12 @@ def conductor(self): + + sage: K. = NumberField(x^2 + 1) + sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]).conductor() +- Fractional ideal (21*i - 3) ++ Fractional ideal (3*i + 21) + sage: K. = NumberField(x^2 - x + 3) +- sage: EllipticCurve([1 + a, -1 + a, 1 + a, -11 + a, 5 - 9*a]).conductor() +- Fractional ideal (-6*a) ++ sage: cond = EllipticCurve([1 + a, -1 + a, 1 + a, -11 + a, 5 - 9*a]).conductor(); cond # random ++ Fractional ideal (6*a) ++ sage: cond == K.ideal(6*a) ++ True + + A not so well known curve with everywhere good reduction:: + +@@ -2584,8 +2588,8 @@ def isogeny_class(self, reducible_primes=None, algorithm='Billerey', minimal_mod + sage: [E1.ainvs() for E1 in C] + [(0, 0, 0, 0, -27), + (0, 0, 0, 0, 1), +- (i + 1, i, i + 1, -i + 3, 4*i), +- (i + 1, i, i + 1, -i + 33, -58*i)] ++ (i + 1, i, 0, 3, -i), ++ (i + 1, i, 0, 33, 91*i)] + + The matrix of degrees of cyclic isogenies between curves:: + +@@ -2616,13 +2620,13 @@ class :class:`EllipticCurveIsogeny` allowed composition. In + sage: [((i,j), isogs[i][j].x_rational_map()) + ....: for i in range(4) for j in range(4) if isogs[i][j] != 0] + [((0, 1), (1/9*x^3 - 12)/x^2), +- ((0, 3), (-1/2*i*x^2 + i*x - 12*i)/(x - 3)), ++ ((0, 3), (1/2*i*x^2 - 2*i*x + 15*i)/(x - 3)), + ((1, 0), (x^3 + 4)/x^2), +- ((1, 2), (-1/2*i*x^2 - i*x - 2*i)/(x + 1)), +- ((2, 1), (1/2*i*x^2 - x)/(x + 3/2*i)), +- ((2, 3), (x^3 + 4*i*x^2 - 10*x - 10*i)/(x^2 + 4*i*x - 4)), +- ((3, 0), (1/2*i*x^2 + x + 4*i)/(x - 5/2*i)), +- ((3, 2), (1/9*x^3 - 4/3*i*x^2 - 34/3*x + 226/9*i)/(x^2 - 8*i*x - 16))] ++ ((1, 2), (1/2*i*x^2 + i)/(x + 1)), ++ ((2, 1), (-1/2*i*x^2 - 1/2*i)/(x - 1/2*i)), ++ ((2, 3), (x^3 - 2*i*x^2 - 7*x + 4*i)/(x^2 - 2*i*x - 1)), ++ ((3, 0), (-1/2*i*x^2 + 2*x - 5/2*i)/(x + 7/2*i)), ++ ((3, 2), (1/9*x^3 + 2/3*i*x^2 - 13/3*x - 116/9*i)/(x^2 + 10*i*x - 25))] + + The isogeny class may be visualized by obtaining its graph and + plotting it:: +@@ -3103,10 +3107,10 @@ def is_isogenous(self, other, proof=True, maxnorm=100): + sage: K. = QuadraticField(-1) + sage: E1 = EllipticCurve([i + 1, 0, 1, -240*i - 400, -2869*i - 2627]) + sage: E1.conductor() +- Fractional ideal (-4*i - 7) ++ Fractional ideal (4*i + 7) + sage: E2 = EllipticCurve([1+i,0,1,0,0]) + sage: E2.conductor() +- Fractional ideal (-4*i - 7) ++ Fractional ideal (4*i + 7) + sage: E1.is_isogenous(E2) # long time + True + sage: E1.is_isogenous(E2, proof=False) # faster (~170ms) +@@ -3433,8 +3437,8 @@ def lll_reduce(self, points, height_matrix=None, precision=None): + sage: Q = E(0,-1) + sage: E.lll_reduce([P,Q]) + ( +- [0 1] +- [(0 : -1 : 1), (-2 : -1/2*a - 1/2 : 1)], [1 0] ++ [ 0 -1] ++ [(0 : -1 : 1), (-2 : 1/2*a - 1/2 : 1)], [ 1 0] + ) + + :: +@@ -3445,9 +3449,10 @@ def lll_reduce(self, points, height_matrix=None, precision=None): + ....: E.point([-17/18*a - 1/9, -109/108*a - 277/108])] + sage: E.lll_reduce(points) + ( +- [(-a + 4 : -3*a + 7 : 1), (-17/18*a - 1/9 : 109/108*a + 277/108 : 1)], +- [ 1 0] +- [ 1 -1] ++ [(-a + 4 : -3*a + 7 : 1), (-17/18*a - 1/9 : -109/108*a - 277/108 : 1)], ++ ++ [1 0] ++ [1 1] + ) + """ + r = len(points) +diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py +index 0da080ffdbe..61b016ca08e 100755 +--- a/src/sage/schemes/elliptic_curves/ell_point.py ++++ b/src/sage/schemes/elliptic_curves/ell_point.py +@@ -142,7 +142,6 @@ + + try: + from sage.libs.pari.all import pari, PariError +- from cypari2.pari_instance import prec_words_to_bits + except ImportError: + PariError = () + +@@ -2672,10 +2671,10 @@ def has_good_reduction(self, P=None): + sage: K. = NumberField(x^2 + 1) + sage: E = EllipticCurve(K, [0,1,0,-160,308]) + sage: P = E(26, -120) +- sage: E.discriminant().support() +- [Fractional ideal (i + 1), +- Fractional ideal (-i - 2), +- Fractional ideal (2*i + 1), ++ sage: E.discriminant().support() # random ++ [Fractional ideal (-i - 1), ++ Fractional ideal (2*i - 1), ++ Fractional ideal (-2*i - 1), + Fractional ideal (3)] + sage: [E.tamagawa_exponent(p) for p in E.discriminant().support()] + [1, 4, 4, 4] +@@ -3705,7 +3704,7 @@ def elliptic_logarithm(self, embedding=None, precision=100, + E_pari = E_work.pari_curve() + log_pari = E_pari.ellpointtoz(pt_pari, precision=working_prec) + +- while prec_words_to_bits(log_pari.precision()) < precision: ++ while log_pari.bitprecision() < precision: + # result is not precise enough, re-compute with double + # precision. if the base field is not QQ, this + # requires modifying the precision of the embedding, +diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py +index 0bc71b09d42..feb584fdf72 100755 +--- a/src/sage/schemes/elliptic_curves/ell_rational_field.py ++++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py +@@ -1848,7 +1848,7 @@ def simon_two_descent(self, verbose=0, lim1=5, lim3=50, limtriv=3, + sage: E = EllipticCurve('389a1') + sage: E._known_points = [] # clear cached points + sage: E.simon_two_descent() +- (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)]) ++ (2, 2, [(-3/4 : 7/8 : 1), (5/4 : 5/8 : 1)]) + sage: E = EllipticCurve('5077a1') + sage: E.simon_two_descent() + (3, 3, [(1 : 0 : 1), (2 : 0 : 1), (0 : 2 : 1)]) +diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +index a4eb66a6df7..8b597e41595 100755 +--- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py ++++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +@@ -800,17 +800,17 @@ def deg_one_primes_iter(K, principal_only=False): + [Fractional ideal (2, a + 1), + Fractional ideal (3, a + 1), + Fractional ideal (3, a + 2), +- Fractional ideal (a), ++ Fractional ideal (-a), + Fractional ideal (7, a + 3), + Fractional ideal (7, a + 4)] + sage: it = deg_one_primes_iter(K, True) + sage: [next(it) for _ in range(6)] +- [Fractional ideal (a), +- Fractional ideal (-2*a + 3), +- Fractional ideal (2*a + 3), ++ [Fractional ideal (-a), ++ Fractional ideal (2*a - 3), ++ Fractional ideal (-2*a - 3), + Fractional ideal (a + 6), + Fractional ideal (a - 6), +- Fractional ideal (-3*a + 4)] ++ Fractional ideal (3*a - 4)] + """ + # imaginary quadratic fields have no principal primes of norm < disc / 4 + start = K.discriminant().abs() // 4 if principal_only and K.signature() == (0,1) else 2 +diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py +index 6be377e2f74..4134ae1b7a6 100644 +--- a/src/sage/schemes/elliptic_curves/gp_simon.py ++++ b/src/sage/schemes/elliptic_curves/gp_simon.py +@@ -49,7 +49,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, + doctest:warning...: + DeprecationWarning: please use the 2-descent algorithm over QQ inside pari + See https://github.com/sagemath/sage/issues/38461 for details. +- (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)]) ++ (2, 2, [(-3/4 : 7/8 : 1), (5/4 : 5/8 : 1)]) + + TESTS:: + +diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py +index 13edc68a022..a83fd8705ac 100755 +--- a/src/sage/schemes/elliptic_curves/isogeny_class.py ++++ b/src/sage/schemes/elliptic_curves/isogeny_class.py +@@ -223,8 +223,8 @@ def _repr_(self): + sage: C.curves + [Elliptic Curve defined by y^2 = x^3 + (-27) over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, + Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, +- Elliptic Curve defined by y^2 + (i+1)*x*y + (i+1)*y = x^3 + i*x^2 + (-i+3)*x + 4*i over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, +- Elliptic Curve defined by y^2 + (i+1)*x*y + (i+1)*y = x^3 + i*x^2 + (-i+33)*x + (-58*i) over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] ++ Elliptic Curve defined by y^2 + (i+1)*x*y = x^3 + i*x^2 + 3*x + (-i) over Number Field in i with defining polynomial x^2 + 1 with i = 1*I, ++ Elliptic Curve defined by y^2 + (i+1)*x*y = x^3 + i*x^2 + 33*x + 91*i over Number Field in i with defining polynomial x^2 + 1 with i = 1*I] + """ + if self._label: + return "Elliptic curve isogeny class %s" % (self._label) +@@ -615,8 +615,8 @@ def __init__(self, E, reducible_primes=None, algorithm='Billerey', minimal_model + sage: [E1.ainvs() for E1 in C] + [(0, 0, 0, 0, -27), + (0, 0, 0, 0, 1), +- (i + 1, i, i + 1, -i + 3, 4*i), +- (i + 1, i, i + 1, -i + 33, -58*i)] ++ (i + 1, i, 0, 3, -i), ++ (i + 1, i, 0, 33, 91*i)] + + The matrix of degrees of cyclic isogenies between curves:: + +@@ -647,13 +647,13 @@ class :class:`EllipticCurveIsogeny` allowed composition. In + sage: [((i,j), isogs[i][j].x_rational_map()) + ....: for i in range(4) for j in range(4) if isogs[i][j] != 0] + [((0, 1), (1/9*x^3 - 12)/x^2), +- ((0, 3), (-1/2*i*x^2 + i*x - 12*i)/(x - 3)), ++ ((0, 3), (1/2*i*x^2 - 2*i*x + 15*i)/(x - 3)), + ((1, 0), (x^3 + 4)/x^2), +- ((1, 2), (-1/2*i*x^2 - i*x - 2*i)/(x + 1)), +- ((2, 1), (1/2*i*x^2 - x)/(x + 3/2*i)), +- ((2, 3), (x^3 + 4*i*x^2 - 10*x - 10*i)/(x^2 + 4*i*x - 4)), +- ((3, 0), (1/2*i*x^2 + x + 4*i)/(x - 5/2*i)), +- ((3, 2), (1/9*x^3 - 4/3*i*x^2 - 34/3*x + 226/9*i)/(x^2 - 8*i*x - 16))] ++ ((1, 2), (1/2*i*x^2 + i)/(x + 1)), ++ ((2, 1), (-1/2*i*x^2 - 1/2*i)/(x - 1/2*i)), ++ ((2, 3), (x^3 - 2*i*x^2 - 7*x + 4*i)/(x^2 - 2*i*x - 1)), ++ ((3, 0), (-1/2*i*x^2 + 2*x - 5/2*i)/(x + 7/2*i)), ++ ((3, 2), (1/9*x^3 + 2/3*i*x^2 - 13/3*x - 116/9*i)/(x^2 + 10*i*x - 25))] + + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve([1+i, -i, i, 1, 0]) +diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +index 6a0194fb0f9..90f7382a94e 100755 +--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py ++++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +@@ -886,15 +886,15 @@ def isogenies_5_0(E, minimal_models=True): + from Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 + to Elliptic Curve defined by +- y^2 + y = x^3 + (241565/32*a^5-362149/48*a^4+180281/24*a^3-9693307/4*a^2+14524871/6*a-7254985/3)*x +- + (1660391123/192*a^5-829315373/96*a^4+77680504/9*a^3-66622345345/24*a^2+33276655441/12*a-24931615912/9) ++ y^2 + y = x^3 + (643/8*a^5-15779/48*a^4-32939/24*a^3-71989/2*a^2+214321/6*a-112115/3)*x ++ + (2901961/96*a^5+4045805/48*a^4+12594215/18*a^3-30029635/6*a^2+15341626/3*a-38944312/9) + over Number Field in a with defining polynomial x^6 - 320*x^3 - 320, + Isogeny of degree 5 + from Elliptic Curve defined by y^2 + y = x^3 + over Number Field in a with defining polynomial x^6 - 320*x^3 - 320 + to Elliptic Curve defined by +- y^2 + y = x^3 + (47519/32*a^5-72103/48*a^4+32939/24*a^3-1909753/4*a^2+2861549/6*a-1429675/3)*x +- + (-131678717/192*a^5+65520419/96*a^4-12594215/18*a^3+5280985135/24*a^2-2637787519/12*a+1976130088/9) ++ y^2 + y = x^3 + (-1109/8*a^5-53873/48*a^4-180281/24*a^3-14491/2*a^2+35899/6*a-43745/3)*x ++ + (-17790679/96*a^5-60439571/48*a^4-77680504/9*a^3+1286245/6*a^2-4961854/3*a-73854632/9) + over Number Field in a with defining polynomial x^6 - 320*x^3 - 320] + """ + F = E.base_field() +diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py +index e09a1f60262..69fe9960c3d 100755 +--- a/src/sage/schemes/plane_conics/con_number_field.py ++++ b/src/sage/schemes/plane_conics/con_number_field.py +@@ -121,7 +121,7 @@ def has_rational_point(self, point=False, obstruction=False, + sage: K. = QuadraticField(-1) + sage: C = Conic(K, [1, 3, -5]) + sage: C.has_rational_point(point=True, obstruction=True) +- (False, Fractional ideal (-i - 2)) ++ (False, Fractional ideal (i + 2)) + sage: C.has_rational_point(algorithm='rnfisnorm') + False + sage: C.has_rational_point(algorithm='rnfisnorm', obstruction=True, +@@ -135,7 +135,7 @@ def has_rational_point(self, point=False, obstruction=False, + sage: L. = NumberField(x^3 - 5) + sage: C = Conic(L, [1, 2, -3]) + sage: C.has_rational_point(point=True, algorithm='rnfisnorm') +- (True, (5/3 : -1/3 : 1)) ++ (True, (-5/3 : 1/3 : 1)) + + sage: K. = NumberField(x^4+2) + sage: Conic(QQ, [4,5,6]).has_rational_point() +diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py +index 20031e81a41..fcbb0c01e82 100755 +--- a/src/sage/schemes/projective/projective_morphism.py ++++ b/src/sage/schemes/projective/projective_morphism.py +@@ -928,7 +928,7 @@ def normalize_coordinates(self, **kwds): + Dynamical System of Projective Space of dimension 1 over + Number Field in a with defining polynomial 3*x^2 + 1 + Defn: Defined on coordinates by sending (z : w) to +- ((-3/2*a + 1/2)*z^2 + (-3/2*a + 1/2)*w^2 : (-3/2*a - 3/2)*z*w) ++ ((3/2*a + 1/2)*z^2 + (3/2*a + 1/2)*w^2 : (-3/2*a + 3/2)*z*w) + + :: + +@@ -1728,11 +1728,11 @@ def _number_field_from_algebraics(self): + sage: f._number_field_from_algebraics() # needs sage.symbolic + Scheme endomorphism of Projective Space of dimension 1 over Number + Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 +- with a = 1.442249570307409? + 1.414213562373095?*I ++ with a = 1.442249570307409? - 1.414213562373095?*I + Defn: Defined on coordinates by sending (x : y) to + ((-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2 - 772/269*a +- - 1092/269)*x^2 + (48/269*a^5 - 27/269*a^4 + 320/269*a^3 - 468/269*a^2 +- + 1041/269*a + 1092/269)*y^2 : y^2) ++ - 1092/269)*x^2 + (-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2 ++ - 1041/269*a - 1092/269)*y^2 : y^2) + + :: + +@@ -1745,12 +1745,12 @@ def _number_field_from_algebraics(self): + Scheme morphism: + From: Projective Space of dimension 1 over Number Field in a + with defining polynomial y^4 + 3*y^2 + 1 +- with a = 0.?e-113 + 0.618033988749895?*I ++ with a = 0.?e-166 + 1.618033988749895?*I + To: Projective Space of dimension 2 over Number Field in a + with defining polynomial y^4 + 3*y^2 + 1 +- with a = 0.?e-113 + 0.618033988749895?*I ++ with a = 0.?e-166 + 1.618033988749895?*I + Defn: Defined on coordinates by sending (x : y) to +- (x^2 + (a^3 + 2*a)*x*y + 3*y^2 : y^2 : (2*a^2 + 3)*x*y) ++ (x^2 + (-a^3 - 2*a)*x*y + 3*y^2 : y^2 : (-2*a^2 - 3)*x*y) + + The following was fixed in :issue:`23808`:: + +diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py +index 7f941ec6726..b0f443acb4e 100755 +--- a/src/sage/schemes/projective/projective_point.py ++++ b/src/sage/schemes/projective/projective_point.py +@@ -1238,10 +1238,10 @@ def _number_field_from_algebraics(self): + sage: P. = ProjectiveSpace(QQbar, 1) + sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]) + sage: S = Q._number_field_from_algebraics(); S +- (1/2*a^3 + a^2 - 1/2*a : 1) ++ (-1/2*a^3 + a^2 + 1/2*a : 1) + sage: S.codomain() + Projective Space of dimension 1 over Number Field in a with defining +- polynomial y^4 + 1 with a = 0.7071067811865475? + 0.7071067811865475?*I ++ polynomial y^4 + 1 with a = -0.7071067811865475? - 0.7071067811865475?*I + + The following was fixed in :issue:`23808`:: + +@@ -1251,7 +1251,7 @@ def _number_field_from_algebraics(self): + sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]);Q + (-0.7071067811865475? + 1*I : 1) + sage: S = Q._number_field_from_algebraics(); S +- (1/2*a^3 + a^2 - 1/2*a : 1) ++ (-1/2*a^3 + a^2 + 1/2*a : 1) + sage: T = S.change_ring(QQbar) # Used to fail + sage: T + (-0.7071067811865475? + 1.000000000000000?*I : 1) +diff --git a/src/sage/structure/factorization.py b/src/sage/structure/factorization.py +index ab3fa717031..b16822791dc 100644 +--- a/src/sage/structure/factorization.py ++++ b/src/sage/structure/factorization.py +@@ -143,17 +143,17 @@ + sage: K. = NumberField(x^2 + 3); K + Number Field in a with defining polynomial x^2 + 3 + sage: f = K.factor(15); f +- (Fractional ideal (1/2*a + 3/2))^2 * (Fractional ideal (5)) ++ (Fractional ideal (-a))^2 * (Fractional ideal (5)) + sage: f.universe() + Monoid of ideals of Number Field in a with defining polynomial x^2 + 3 + sage: f.unit() + Fractional ideal (1) + sage: g = K.factor(9); g +- (Fractional ideal (1/2*a + 3/2))^4 ++ (Fractional ideal (-a))^4 + sage: f.lcm(g) +- (Fractional ideal (1/2*a + 3/2))^4 * (Fractional ideal (5)) ++ (Fractional ideal (-a))^4 * (Fractional ideal (5)) + sage: f.gcd(g) +- (Fractional ideal (1/2*a + 3/2))^2 ++ (Fractional ideal (-a))^2 + sage: f.is_integral() + True + diff --git a/srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch b/srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch new file mode 100644 index 00000000000000..4a5550140eab6a --- /dev/null +++ b/srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch @@ -0,0 +1,95 @@ +commit 031e32abfded6902eeb5974b51026bec05e6a3c5 +Author: Gonzalo Tornaría +Date: Sun Nov 3 18:23:36 2024 -0300 + + fixup backport of #38749 + +diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py +index 75b2ecc69d8..4f52eba6279 100644 +--- a/src/sage/rings/number_field/number_field_ideal_rel.py ++++ b/src/sage/rings/number_field/number_field_ideal_rel.py +@@ -380,6 +380,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal): + + EXAMPLES:: + ++ sage: pari.setrand(3) + sage: R. = QQ[] + sage: K. = NumberField(x^2 + 6) + sage: L. = K.extension(K['x'].gen()^4 + a) +diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py +index c499bc2812c..c28e3b0a7a9 100644 +--- a/src/sage/rings/number_field/order.py ++++ b/src/sage/rings/number_field/order.py +@@ -590,7 +590,7 @@ class Order(IntegralDomain, sage.rings.abc.Order): + sage: k. = NumberField(x^2 + 5077); G = k.class_group(); G + Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077 + sage: G.0 ^ -9 +- Fractional ideal class (67, a + 45) ++ Fractional ideal class (43, a + 13) + sage: Ok = k.maximal_order(); Ok + Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077 + sage: Ok * (11, a + 7) +@@ -2994,7 +2994,7 @@ def EisensteinIntegers(names="omega"): + with defining polynomial x^2 + x + 1 + with omega = -0.50000000000000000? + 0.866025403784439?*I + sage: factor(3 + omega) +- (omega + 1) * (-2*omega + 1) ++ (-omega - 1) * (2*omega - 1) + sage: CC(omega) + -0.500000000000000 + 0.866025403784439*I + sage: omega.minpoly() +diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py +index 0e60ef0f6a2..4c615e75ac9 100644 +--- a/src/sage/schemes/elliptic_curves/ell_number_field.py ++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py +@@ -2603,6 +2603,7 @@ class EllipticCurve_number_field(EllipticCurve_field): + + EXAMPLES:: + ++ sage: pari.setrand(1) + sage: K. = QuadraticField(-1) + sage: E = EllipticCurve(K, [0,0,0,0,1]) + sage: C = E.isogeny_class(); C +diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +index 3fe8260947d..cf905787257 100644 +--- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py ++++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +@@ -795,6 +795,7 @@ def deg_one_primes_iter(K, principal_only=False): + + EXAMPLES:: + ++ sage: pari.setrand(1) + sage: K. = QuadraticField(-5) + sage: from sage.schemes.elliptic_curves.gal_reps_number_field import deg_one_primes_iter + sage: it = deg_one_primes_iter(K) +diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py +index fdf6f0852e8..046b635cca8 100644 +--- a/src/sage/schemes/elliptic_curves/gp_simon.py ++++ b/src/sage/schemes/elliptic_curves/gp_simon.py +@@ -57,9 +57,6 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, + sage: import sage.schemes.elliptic_curves.gp_simon + sage: E = EllipticCurve('389a1') + sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E) +- doctest:warning...: +- DeprecationWarning: please use the 2-descent algorithm over QQ inside pari +- See https://github.com/sagemath/sage/issues/38461 for details. + (2, 2, [(-3/4 : 7/8 : 1), (5/4 : 5/8 : 1)]) + + TESTS:: +diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py +index 5f4512f5be6..2c1c6aef618 100644 +--- a/src/sage/schemes/projective/projective_morphism.py ++++ b/src/sage/schemes/projective/projective_morphism.py +@@ -1764,10 +1764,10 @@ class SchemeMorphism_polynomial_projective_space_field(SchemeMorphism_polynomial + Scheme morphism: + From: Projective Space of dimension 1 over Number Field in a + with defining polynomial y^4 + 3*y^2 + 1 +- with a = 0.?e-166 + 1.618033988749895?*I ++ with a = 0.?e-165 + 1.618033988749895?*I + To: Projective Space of dimension 2 over Number Field in a + with defining polynomial y^4 + 3*y^2 + 1 +- with a = 0.?e-166 + 1.618033988749895?*I ++ with a = 0.?e-165 + 1.618033988749895?*I + Defn: Defined on coordinates by sending (x : y) to + (x^2 + (-a^3 - 2*a)*x*y + 3*y^2 : y^2 : (-2*a^2 - 3)*x*y) + diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 28162dff8a38e1..3232a1c60954a3 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -34,3 +34,5 @@ get_pr 38344 "ecm 7.0.6" #get_pr 37645 "fix doctest" #get_pr 37885 "cython warnings" + +get_pr 38749 "pari 2.17" diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index b116e62bc67a5a..b3835fb2276dcb 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,7 +1,7 @@ # Template file for 'sagemath' pkgname=sagemath version=10.4 -revision=3 +revision=4 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} build_style=python3-pep517 From b6d6280ae4f2b8d3b5e8ce3e8b9da174b83e9bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 11 Aug 2024 22:53:42 -0300 Subject: [PATCH 08/21] python3-Cython: alternative fix for 6122 --- srcpkgs/python3-Cython/patches/fix-regression.patch | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/srcpkgs/python3-Cython/patches/fix-regression.patch b/srcpkgs/python3-Cython/patches/fix-regression.patch index f2e761608e373b..f5957cfa59c2f5 100644 --- a/srcpkgs/python3-Cython/patches/fix-regression.patch +++ b/srcpkgs/python3-Cython/patches/fix-regression.patch @@ -15,3 +15,11 @@ serious regression, e.g. sagemath FTBS with cython 3.0.11 warning(self.pos, "Implicit noexcept declaration is deprecated." " Function declaration should contain 'noexcept' keyword.", +@@ -3128,6 +3126,7 @@ class DefNode(FuncDefNode): + if scope is None: + scope = cfunc.scope + cfunc_type = cfunc.type ++ has_explicit_exc_clause=True + if len(self.args) != len(cfunc_type.args) or cfunc_type.has_varargs: + error(self.pos, "wrong number of arguments") + error(cfunc.pos, "previous declaration here") From b7b29269efc6c434d665224cbadf9282318c92c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Mon, 5 Aug 2024 00:21:23 -0300 Subject: [PATCH 09/21] sagemath: update to 10.5.beta2. --- .../sagemath/patches/36641-sympy_1.13.patch | 22 +- .../sagemath/patches/37884-gap_4.13.1.patch | 28 +- .../sagemath/patches/38250-numpy_2.0.patch | 587 ------------------ .../sagemath/patches/38344-ecm_7.0.6.patch | 43 -- srcpkgs/sagemath/patches/get_patches | 4 +- srcpkgs/sagemath/template | 6 +- 6 files changed, 21 insertions(+), 669 deletions(-) delete mode 100644 srcpkgs/sagemath/patches/38250-numpy_2.0.patch delete mode 100644 srcpkgs/sagemath/patches/38344-ecm_7.0.6.patch diff --git a/srcpkgs/sagemath/patches/36641-sympy_1.13.patch b/srcpkgs/sagemath/patches/36641-sympy_1.13.patch index 625c582cdd41b7..01e859ad023f4d 100644 --- a/srcpkgs/sagemath/patches/36641-sympy_1.13.patch +++ b/srcpkgs/sagemath/patches/36641-sympy_1.13.patch @@ -1,8 +1,5 @@ -diff --git a/build/pkgs/sympy/requirements.txt b/build/pkgs/sympy/requirements.txt -new file mode 100644 -index 00000000000..3ef8f90b550 diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py -index 7e9eab2ff2e..43365cd645e 100644 +index 823a0d14a41..de1c8531814 100644 --- a/src/sage/doctest/forker.py +++ b/src/sage/doctest/forker.py @@ -150,14 +150,15 @@ def init_sage(controller=None): @@ -28,7 +25,7 @@ index 7e9eab2ff2e..43365cd645e 100644 The displayhook sorts dictionary keys to simplify doctesting of dictionary output:: diff --git a/src/sage/functions/hypergeometric.py b/src/sage/functions/hypergeometric.py -index 010c61febe0..bbccbd20032 100644 +index ade7836b310..eb5c6665c0d 100644 --- a/src/sage/functions/hypergeometric.py +++ b/src/sage/functions/hypergeometric.py @@ -124,7 +124,7 @@ @@ -40,21 +37,8 @@ index 010c61febe0..bbccbd20032 100644 sage: hypergeometric((5, 4), (4, 4), 3)._mathematica_init_() # needs sage.symbolic 'HypergeometricPFQ[{5,4},{4,4},3]' -diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx -index a92fe241355..f62311423be 100644 ---- a/src/sage/symbolic/expression.pyx -+++ b/src/sage/symbolic/expression.pyx -@@ -1167,7 +1167,7 @@ cdef class Expression(Expression_abc): - sage: unicode_art(SR(13 - I)) - 13 - ⅈ - sage: unicode_art(SR(1.3 - I)) -- 1.3 - ⅈ -+ 1.3 - 1.0⋅ⅈ - sage: unicode_art(cos(I)) - cosh(1) - diff --git a/src/sage/typeset/ascii_art.py b/src/sage/typeset/ascii_art.py -index 28024405d27..458fa8724a3 100644 +index 83d92af8959..e470e2bd88d 100644 --- a/src/sage/typeset/ascii_art.py +++ b/src/sage/typeset/ascii_art.py @@ -44,11 +44,12 @@ diff --git a/srcpkgs/sagemath/patches/37884-gap_4.13.1.patch b/srcpkgs/sagemath/patches/37884-gap_4.13.1.patch index 1550d47e2436c6..321e0a94487da3 100644 --- a/srcpkgs/sagemath/patches/37884-gap_4.13.1.patch +++ b/srcpkgs/sagemath/patches/37884-gap_4.13.1.patch @@ -1,21 +1,21 @@ diff --git a/src/sage/algebras/fusion_rings/fusion_double.py b/src/sage/algebras/fusion_rings/fusion_double.py -index 7ce086f70d0..954513572c3 100644 +index 71277561331..3b681d75d3b 100644 --- a/src/sage/algebras/fusion_rings/fusion_double.py +++ b/src/sage/algebras/fusion_rings/fusion_double.py @@ -133,7 +133,7 @@ class FusionDouble(CombinatorialFreeModule): sage: G = SmallPermutationGroup(16,9) - sage: F = FusionDouble(G, prefix="b",inject_variables=True) + sage: F = FusionDouble(G, prefix='b', inject_variables=True) sage: b13^2 # long time (4s) - b0 + b2 + b4 + b15 + b16 + b17 + b18 + b24 + b26 + b27 + b0 + b3 + b4 - """ @staticmethod + def __classcall_private__(cls, G, prefix='s', inject_variables=False): diff --git a/src/sage/categories/simplicial_sets.py b/src/sage/categories/simplicial_sets.py -index e714a4571c4..a2b87a729d1 100644 +index aabd3cdbb4f..14bebdcd080 100644 --- a/src/sage/categories/simplicial_sets.py +++ b/src/sage/categories/simplicial_sets.py -@@ -593,9 +593,9 @@ def _canonical_twisting_operator(self): +@@ -591,9 +591,9 @@ def _canonical_twisting_operator(self): sage: X = simplicial_sets.Torus() sage: d = X._canonical_twisting_operator() sage: d @@ -27,7 +27,7 @@ index e714a4571c4..a2b87a729d1 100644 sage: Y = simplicial_sets.RealProjectiveSpace(2) sage: d2 = Y._canonical_twisting_operator() sage: d2 -@@ -677,10 +677,10 @@ def twisted_chain_complex(self, twisting_operator=None, dimensions=None, augment +@@ -674,10 +674,10 @@ def twisted_chain_complex(self, twisting_operator=None, dimensions=None, augment sage: X = simplicial_sets.Torus() sage: C = X.twisted_chain_complex() sage: C.differential(1) @@ -41,7 +41,7 @@ index e714a4571c4..a2b87a729d1 100644 [ -1 -1] sage: C.differential(3) [] -@@ -848,29 +848,29 @@ def twisted_homology(self, n, reduced=False): +@@ -844,29 +844,29 @@ def twisted_homology(self, n, reduced=False): sage: # needs sage.graphs sage: Y = simplicial_sets.Torus() sage: Y.twisted_homology(1) @@ -80,10 +80,10 @@ index e714a4571c4..a2b87a729d1 100644 [1 0 0 0 0] [0 1 0 0 0] diff --git a/src/sage/combinat/matrices/latin.py b/src/sage/combinat/matrices/latin.py -index 936edcc6ea4..c06a53d9afd 100644 +index e2d818e9480..84e6c4fcc9b 100644 --- a/src/sage/combinat/matrices/latin.py +++ b/src/sage/combinat/matrices/latin.py -@@ -2453,7 +2453,7 @@ def p3_group_bitrade_generators(p): +@@ -2444,7 +2444,7 @@ def p3_group_bitrade_generators(p): EXAMPLES:: sage: from sage.combinat.matrices.latin import * @@ -93,7 +93,7 @@ index 936edcc6ea4..c06a53d9afd 100644 (1,2,3)(4,7,8)(5,6,9), (1,9,2)(3,7,4)(5,8,6), diff --git a/src/sage/groups/cubic_braid.py b/src/sage/groups/cubic_braid.py -index 257b400f1c7..36423c756aa 100644 +index 61db70925e1..521289c7578 100644 --- a/src/sage/groups/cubic_braid.py +++ b/src/sage/groups/cubic_braid.py @@ -282,7 +282,7 @@ def _richcmp_(self, other, op): @@ -106,7 +106,7 @@ index 257b400f1c7..36423c756aa 100644 c1*c0^-1*c1, c0^-1*c1^-1*c0^-1, c0^-1*c1^-1, c1^-1*c0*c1^-1, c0*c1^-1*c0^-1, c0^-1*c1, c0^-1*c1*c0, c0*c1^-1, c1*c0^-1, diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py -index 4bb52ee4efb..85f572fac6c 100644 +index 4ac2faa783b..7016d08381b 100644 --- a/src/sage/groups/finitely_presented.py +++ b/src/sage/groups/finitely_presented.py @@ -1344,8 +1344,8 @@ def abelianization_map(self): @@ -161,10 +161,10 @@ index 4bb52ee4efb..85f572fac6c 100644 sage: G.characteristic_varieties(groebner=True) {0: [-1 + F1, 1 + F1, 1 - F1 + F1^2, 1 + F1 + F1^2], 1: [1 - F1 + F1^2], 2: []} diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py -index c1f2683907b..d219e104a2c 100644 +index 5c153b93d4c..bd4afad2942 100644 --- a/src/sage/groups/perm_gps/permgroup_named.py +++ b/src/sage/groups/perm_gps/permgroup_named.py -@@ -3468,16 +3468,14 @@ class SmallPermutationGroup(PermutationGroup_generic): +@@ -3465,16 +3465,14 @@ class SmallPermutationGroup(PermutationGroup_generic): sage: G = SmallPermutationGroup(12,4); G Group of order 12 and GAP Id 4 as a permutation group sage: G.gens() @@ -186,7 +186,7 @@ index c1f2683907b..d219e104a2c 100644 sage: def numgps(n): return ZZ(libgap.NumberSmallGroups(n)) sage: all(SmallPermutationGroup(n,k).id() == [n,k] ....: for n in [1..64] for k in [1..numgps(n)]) -@@ -3486,11 +3484,11 @@ class SmallPermutationGroup(PermutationGroup_generic): +@@ -3483,11 +3481,11 @@ class SmallPermutationGroup(PermutationGroup_generic): sage: H.is_abelian() False sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()] diff --git a/srcpkgs/sagemath/patches/38250-numpy_2.0.patch b/srcpkgs/sagemath/patches/38250-numpy_2.0.patch deleted file mode 100644 index e28fd857afcb75..00000000000000 --- a/srcpkgs/sagemath/patches/38250-numpy_2.0.patch +++ /dev/null @@ -1,587 +0,0 @@ -diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py -index 28f81d7b798..d184c52bf19 100644 ---- a/src/sage/arith/misc.py -+++ b/src/sage/arith/misc.py -@@ -2277,7 +2277,7 @@ def power_mod(a, n, m): - - sage: from numpy import int32 # needs numpy - sage: power_mod(int32(2), int32(390), int32(391)) # needs numpy -- 285 -+ ...285... - sage: from gmpy2 import mpz - sage: power_mod(mpz(2), mpz(390), mpz(391)) - mpz(285) -diff --git a/src/sage/calculus/interpolators.pyx b/src/sage/calculus/interpolators.pyx -index 221b52369e2..bb0be7bab0c 100644 ---- a/src/sage/calculus/interpolators.pyx -+++ b/src/sage/calculus/interpolators.pyx -@@ -27,6 +27,9 @@ Development supported by NSF award No. 0702939. - import numpy as np - cimport numpy as np - -+if int(np.version.short_version[0]) > 1: -+ np.set_printoptions(legacy="1.25") -+ - from math import pi - cdef double TWOPI = 2*pi - -diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx -index 6ec80d89aa7..c09d93c4260 100644 ---- a/src/sage/calculus/riemann.pyx -+++ b/src/sage/calculus/riemann.pyx -@@ -44,6 +44,9 @@ from sage.calculus.integration import numerical_integral - import numpy as np - cimport numpy as np - -+if int(np.version.short_version[0]) > 1: -+ np.set_printoptions(legacy="1.25") -+ - from math import pi - from math import sin - from math import cos -diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py -index b198fed0c0d..b3ebd206cd2 100644 ---- a/src/sage/combinat/fully_packed_loop.py -+++ b/src/sage/combinat/fully_packed_loop.py -@@ -66,6 +66,9 @@ def _make_color_list(n, colors=None, color_map=None, randomize=False): - r""" - TESTS:: - -+ sage: import numpy as np -+ sage: if int(np.version.short_version[0]) > 1: -+ ....: np.set_printoptions(legacy="1.25") - sage: from sage.combinat.fully_packed_loop import _make_color_list - sage: _make_color_list(5) - sage: _make_color_list(5, ['blue', 'red']) -diff --git a/src/sage/env.py b/src/sage/env.py -index 722649ab3da..abb9b19f9e3 100644 ---- a/src/sage/env.py -+++ b/src/sage/env.py -@@ -296,7 +296,7 @@ def sage_include_directories(use_sources=False): - sage: import sage.env - sage: sage.env.sage_include_directories() - ['...', -- '.../numpy/core/include', -+ '.../numpy/...core/include', - '.../include/python...'] - - To check that C/C++ files are correctly found, we verify that we can -diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py -index e100ba3ee23..2a03bb68f67 100644 ---- a/src/sage/functions/special.py -+++ b/src/sage/functions/special.py -@@ -217,6 +217,9 @@ class SphericalHarmonic(BuiltinFunction): - sage: spherical_harmonic(1, 1, pi/2, pi).n() # abs tol 1e-14 # needs sage.symbolic - 0.345494149471335 - sage: from scipy.special import sph_harm # NB: arguments x and y are swapped # needs scipy -+ sage: import numpy as np # needs scipy -+ sage: if int(np.version.short_version[0]) > 1: # needs scipy -+ ....: np.set_printoptions(legacy="1.25") # needs scipy - sage: sph_harm(1, 1, pi.n(), (pi/2).n()) # abs tol 1e-14 # needs scipy sage.symbolic - (0.3454941494713355-4.231083042742082e-17j) - -diff --git a/src/sage/graphs/generators/classical_geometries.py b/src/sage/graphs/generators/classical_geometries.py -index da04362eef3..957f88d2061 100644 ---- a/src/sage/graphs/generators/classical_geometries.py -+++ b/src/sage/graphs/generators/classical_geometries.py -@@ -1315,7 +1315,7 @@ def CossidentePenttilaGraph(q): - - from sage.libs.gap.libgap import libgap - adj_list = libgap.function_factory("""function(q) -- local z, e, so, G, nu, G1, G0, B, T, s, O1, O2, x; -+ local z, e, so, G, nu, G1, G0, B, T, s, O1, O2, x, sqo; - LoadPackage("grape"); - G0:=SO(3,q^2); - so:=GeneratorsOfGroup(G0); -diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py -index 063931ae274..0bafbd00564 100644 ---- a/src/sage/graphs/generic_graph.py -+++ b/src/sage/graphs/generic_graph.py -@@ -18420,6 +18420,9 @@ def shortest_path_all_pairs(self, by_weight=False, algorithm=None, - M = self.adjacency_matrix(vertices=int_to_vertex) - - # We call the Floyd-Warshall method from SciPy -+ import numpy # to ensure numpy 2.0 compatibility -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") - from numpy import array as np_array - from scipy.sparse.csgraph import floyd_warshall - dd, pp = floyd_warshall(np_array(M), directed=self.is_directed(), -diff --git a/src/sage/graphs/graph_generators_pyx.pyx b/src/sage/graphs/graph_generators_pyx.pyx -index 033e8b22adc..04b20d3229b 100644 ---- a/src/sage/graphs/graph_generators_pyx.pyx -+++ b/src/sage/graphs/graph_generators_pyx.pyx -@@ -57,7 +57,7 @@ def RandomGNP(n, p, bint directed=False, bint loops=False, seed=None): - - sage: from numpy import mean # needs numpy - sage: abs(mean([RandomGNP(200, .2).density() for i in range(30)]) - .2) < .001 # needs numpy -- True -+ ...True... - sage: RandomGNP(150, .2, loops=True) - Traceback (most recent call last): - ... -diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx -index a810418389c..c38df5412f0 100644 ---- a/src/sage/matrix/matrix1.pyx -+++ b/src/sage/matrix/matrix1.pyx -@@ -705,12 +705,15 @@ cdef class Matrix(Matrix0): - Type ``numpy.typecodes`` for a list of the possible - typecodes:: - -- sage: import numpy # needs numpy -- sage: sorted(numpy.typecodes.items()) # needs numpy -+ sage: import numpy # needs numpy -+ sage: numpy.typecodes.items() # needs numpy # random - [('All', '?bhilqpBHILQPefdgFDGSUVOMm'), ('AllFloat', 'efdgFDG'), -- ('AllInteger', 'bBhHiIlLqQpP'), ('Character', 'c'), ('Complex', 'FDG'), -- ('Datetime', 'Mm'), ('Float', 'efdg'), ('Integer', 'bhilqp'), -- ('UnsignedInteger', 'BHILQP')] -+ ... -+ -+ For instance, you can see possibilities for real floating point numbers:: -+ -+ sage: numpy.typecodes['Float'] # needs numpy -+ 'efdg' - - Alternatively, numpy automatically calls this function (via - the magic :meth:`__array__` method) to convert Sage matrices -diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx -index d71d22ac1f7..b6f297a3510 100644 ---- a/src/sage/modules/free_module_element.pyx -+++ b/src/sage/modules/free_module_element.pyx -@@ -555,7 +555,11 @@ def vector(arg0, arg1=None, arg2=None, sparse=None, immutable=False): - R = None - - try: -+ import numpy - from numpy import ndarray -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") -+ - except ImportError: - pass - else: -@@ -1188,7 +1192,11 @@ cdef class FreeModuleElement(Vector): # abstract base class - over Rational Field to numpy array of type <... 'float'>: - setting an array element with a sequence. - """ -+ import numpy - from numpy import array -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") -+ - try: - return array(self, dtype=dtype) - except ValueError as e: -diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py -index e3d94d1746e..7ae8ca4966f 100644 ---- a/src/sage/numerical/optimize.py -+++ b/src/sage/numerical/optimize.py -@@ -155,6 +155,10 @@ def find_root(f, a, b, xtol=10e-13, rtol=2.0**-50, maxiter=100, full_output=Fals - b = max(s_1, s_2) - - import scipy.optimize -+ import numpy -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") -+ - g = lambda x: float(f(x)) - brentqRes = scipy.optimize.brentq(g, a, b, - full_output=full_output, xtol=xtol, rtol=rtol, maxiter=maxiter) -@@ -288,6 +292,10 @@ def find_local_minimum(f, a, b, tol=1.48e-08, maxfun=500): - a = float(a) - b = float(b) - import scipy.optimize -+ import numpy -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") -+ - xmin, fval, iter, funcalls = scipy.optimize.fminbound(f, a, b, full_output=1, xtol=tol, maxfun=maxfun) - return fval, xmin - -@@ -376,6 +384,8 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default", - sage: def rosen(x): # The Rosenbrock function - ....: return sum(100.0r*(x[1r:]-x[:-1r]**2.0r)**2.0r + (1r-x[:-1r])**2.0r) - sage: import numpy -+ sage: if int(numpy.version.short_version[0]) > 1: -+ ....: numpy.set_printoptions(legacy="1.25") - sage: from numpy import zeros - sage: def rosen_der(x): - ....: xm = x[1r:-1r] -@@ -393,6 +403,9 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default", - from sage.structure.element import Expression - from sage.ext.fast_callable import fast_callable - import numpy -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") -+ - from scipy import optimize - if isinstance(func, Expression): - var_list = func.variables() -@@ -530,6 +543,8 @@ def minimize_constrained(func,cons,x0,gradient=None,algorithm='default', **args) - from sage.structure.element import Expression - from sage.ext.fast_callable import fast_callable - import numpy -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") - from scipy import optimize - function_type = type(lambda x,y: x+y) - -@@ -652,6 +667,8 @@ def find_fit(data, model, initial_guess=None, parameters=None, variables=None, s - ``lmdif`` and ``lmder`` algorithms. - """ - import numpy -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") - - if not isinstance(data, numpy.ndarray): - try: -diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py -index ac1dc79d802..23e2517ca56 100644 ---- a/src/sage/plot/arrow.py -+++ b/src/sage/plot/arrow.py -@@ -53,6 +53,9 @@ def get_minmax_data(self): - - EXAMPLES:: - -+ sage: import numpy # to ensure numpy 2.0 compatibility -+ sage: if int(numpy.version.short_version[0]) > 1: -+ ....: numpy.set_printoptions(legacy="1.25") - sage: from sage.plot.arrow import CurveArrow - sage: b = CurveArrow(path=[[(0,0),(.5,.5),(1,0)],[(.5,1),(0,0)]], - ....: options={}) -diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx -index f1f2671a803..4d71414e1c2 100644 ---- a/src/sage/plot/complex_plot.pyx -+++ b/src/sage/plot/complex_plot.pyx -@@ -1282,15 +1282,13 @@ def rgb_to_hls(rgb): - raise ValueError("Last dimension of input array must be 3; " - "shape {} was found.".format(rgb.shape)) - in_shape = rgb.shape -- rgb = np.array( -- rgb, copy=False, dtype=np.dtype(float), ndmin=2 -- ) -+ rgb = np.asarray(rgb, dtype=np.dtype(float)) - rgb_max = rgb.max(-1) - rgb_min = rgb.min(-1) - l = (rgb_max + rgb_min)/2.0 # lightness - - hls = np.zeros_like(rgb) -- delta = rgb.ptp(-1) -+ delta = np.ptp(rgb, -1) - s = np.zeros_like(delta) - - ipos = delta > 0 -diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py -index a84d162cb56..94f5db09d83 100644 ---- a/src/sage/plot/graphics.py -+++ b/src/sage/plot/graphics.py -@@ -2754,7 +2754,7 @@ def matplotlib(self, filename=None, - sage: xmin, xmax = sub.get_xlim() - sage: ymin, ymax = sub.get_ylim() - sage: xmin > xmax, ymin > ymax -- (True, True) -+ (...True..., ...True...) - """ - if not isinstance(ticks, (list, tuple)): - ticks = (ticks, None) -diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py -index fa86a44bd0a..a585cacf9cd 100644 ---- a/src/sage/plot/histogram.py -+++ b/src/sage/plot/histogram.py -@@ -92,6 +92,8 @@ def get_minmax_data(self): - {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0} - """ - import numpy -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") - - # Extract these options (if they are not None) and pass them to - # histogram() -diff --git a/src/sage/plot/multigraphics.py b/src/sage/plot/multigraphics.py -index b583be32317..6be448f1e04 100644 ---- a/src/sage/plot/multigraphics.py -+++ b/src/sage/plot/multigraphics.py -@@ -784,6 +784,9 @@ def _add_subplot(self, figure, index, **options): - True - sage: G.position(1) - (0.2, 0.3, 0.4, 0.1) -+ sage: import numpy # to ensure numpy 2.0 compatibility -+ sage: if int(numpy.version.short_version[0]) > 1: -+ ....: numpy.set_printoptions(legacy="1.25") - sage: ax1.get_position().bounds # tol 1.0e-13 - (0.2, 0.3, 0.4000000000000001, 0.10000000000000003) - -@@ -1295,6 +1298,9 @@ def position(self, index): - sage: g1 = plot(sin(x), (x, -pi, pi)) - sage: g2 = circle((0,1), 1.) - sage: G = graphics_array([g1, g2]) -+ sage: import numpy # to ensure numpy 2.0 compatibility -+ sage: if int(numpy.version.short_version[0]) > 1: -+ ....: numpy.set_printoptions(legacy="1.25") - sage: G.position(0) # tol 5.0e-3 - (0.025045451349937315, - 0.03415488992713045, -diff --git a/src/sage/plot/plot3d/implicit_surface.pyx b/src/sage/plot/plot3d/implicit_surface.pyx -index ce0da48a4e0..f4d5059b620 100644 ---- a/src/sage/plot/plot3d/implicit_surface.pyx -+++ b/src/sage/plot/plot3d/implicit_surface.pyx -@@ -468,6 +468,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): - sage: cube_marcher.y_vertices.tolist() - [[[<1.0, 0.5, 0.0>, None]], [[None, None]]] - sage: cube_marcher.x_vertices.any() # This shouldn't affect the X vertices. -+ ... - """ - (self.y_vertices, self.y_vertices_swapped) = \ - (self.y_vertices_swapped, self.y_vertices) -@@ -574,6 +575,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): - sage: cube_marcher.x_vertices.tolist() - [[None, None], [None, <1.5, 1.0, 1.0>]] - sage: cube_marcher.y_vertices.any() or cube_marcher.z_vertices.any() # This shouldn't affect the Y or Z vertices. -+ ... - """ - cdef bint has_prev = (_prev is not None) - cdef bint has_next = (_next is not None) -diff --git a/src/sage/plot/scatter_plot.py b/src/sage/plot/scatter_plot.py -index 4ad418f040b..781854d372c 100644 ---- a/src/sage/plot/scatter_plot.py -+++ b/src/sage/plot/scatter_plot.py -@@ -63,9 +63,9 @@ def get_minmax_data(self): - sage: s = scatter_plot([[0,1],[2,4],[3.2,6]]) - sage: d = s.get_minmax_data() - sage: d['xmin'] -- 0.0 -+ ...0.0... - sage: d['ymin'] -- 1.0 -+ ...1.0... - """ - return {'xmin': self.xdata.min(), - 'xmax': self.xdata.max(), -diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py -index 663d3aee70b..d2cb11088c7 100644 ---- a/src/sage/plot/streamline_plot.py -+++ b/src/sage/plot/streamline_plot.py -@@ -71,6 +71,9 @@ def get_minmax_data(self): - EXAMPLES:: - - sage: x, y = var('x y') -+ sage: import numpy # to ensure numpy 2.0 compatibility -+ sage: if int(numpy.version.short_version[0]) > 1: -+ ....: numpy.set_printoptions(legacy="1.25") - sage: d = streamline_plot((.01*x, x+y), (x,10,20), (y,10,20))[0].get_minmax_data() - sage: d['xmin'] - 10.0 -diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx -index e2c71af9c25..59ba4a95ab6 100644 ---- a/src/sage/probability/probability_distribution.pyx -+++ b/src/sage/probability/probability_distribution.pyx -@@ -140,6 +140,9 @@ cdef class ProbabilityDistribution: - 1.8, - 2.0] - """ -+ import numpy as np -+ if int(np.version.short_version[0]) > 1: -+ np.set_printoptions(legacy="1.25") - import pylab - ell = [float(self.get_random_element()) for _ in range(num_samples)] - S = pylab.hist(ell, bins, density=True) -diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx -index c59a2b46d6f..b4dddebb4dc 100644 ---- a/src/sage/rings/complex_double.pyx -+++ b/src/sage/rings/complex_double.pyx -@@ -2558,10 +2558,10 @@ cdef class ComplexToCDF(Morphism): - - sage: # needs numpy - sage: import numpy -- sage: f = CDF.coerce_map_from(numpy.complex_) -- sage: f(numpy.complex_(I)) -+ sage: f = CDF.coerce_map_from(numpy.complex128) -+ sage: f(numpy.complex128(I)) - 1.0*I -- sage: f(numpy.complex_(I)).parent() -+ sage: f(numpy.complex128(I)).parent() - Complex Double Field - """ - def __init__(self, R): -@@ -2578,7 +2578,7 @@ cdef class ComplexToCDF(Morphism): - EXAMPLES:: - - sage: import numpy # needs numpy -- sage: CDF(numpy.complex_(I)) # indirect doctest # needs numpy -+ sage: CDF(numpy.complex128(I)) # indirect doctest # needs numpy - 1.0*I - """ - cdef ComplexDoubleElement z = ComplexDoubleElement.__new__(ComplexDoubleElement) -@@ -2592,7 +2592,7 @@ cdef class ComplexToCDF(Morphism): - EXAMPLES:: - - sage: import numpy # needs numpy -- sage: f = sage.rings.complex_double.ComplexToCDF(numpy.complex_) # needs numpy -+ sage: f = sage.rings.complex_double.ComplexToCDF(numpy.complex128) # needs numpy - sage: f._repr_type() # needs numpy - 'Native' - """ -diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx -index b4a1fa5039b..38c30f7627b 100644 ---- a/src/sage/rings/integer.pyx -+++ b/src/sage/rings/integer.pyx -@@ -593,6 +593,8 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): - Test comparisons with numpy types (see :issue:`13386` and :issue:`18076`):: - - sage: import numpy # needs numpy -+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy - sage: numpy.int8('12') == 12 # needs numpy - True - sage: 12 == numpy.int8('12') # needs numpy -diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx -index dcf2af7cdf2..c87eccd44f1 100644 ---- a/src/sage/rings/polynomial/polynomial_element.pyx -+++ b/src/sage/rings/polynomial/polynomial_element.pyx -@@ -8851,7 +8851,7 @@ cdef class Polynomial(CommutativePolynomial): - 'you expect.') - - import numpy -- from numpy.linalg.linalg import LinAlgError -+ from numpy.linalg import LinAlgError - from sage.rings.complex_double import CDF - - numpy_dtype = ('complex' if input_complex else 'double') -diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx -index 95b472e912c..76fbfedab95 100644 ---- a/src/sage/rings/real_mpfi.pyx -+++ b/src/sage/rings/real_mpfi.pyx -@@ -231,6 +231,8 @@ specified if given a non-interval and an interval:: - TESTS:: - - sage: import numpy # needs numpy -+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy - sage: RIF(2) == numpy.int8('2') # needs numpy - True - sage: numpy.int8('2') == RIF(2) # needs numpy -diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx -index 8f240627e77..70ce616f92f 100644 ---- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx -+++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx -@@ -77,6 +77,8 @@ cdef class PeriodicRegion: - EXAMPLES:: - - sage: import numpy as np -+ sage: if int(np.version.short_version[0]) > 1: -+ ....: np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - sage: data = np.zeros((4, 4)) - sage: PeriodicRegion(CDF(2), CDF(2*I), data).is_empty() -@@ -295,6 +297,8 @@ cdef class PeriodicRegion: - EXAMPLES:: - - sage: import numpy as np -+ sage: if int(np.version.short_version[0]) > 1: -+ ....: np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - sage: data = np.zeros((10, 10)) - sage: data[1:4,1:4] = True -@@ -317,6 +321,8 @@ cdef class PeriodicRegion: - EXAMPLES:: - - sage: import numpy as np -+ sage: if int(np.version.short_version[0]) > 1: -+ ....: np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - sage: data = np.zeros((4, 4)) - sage: data[1,1] = True -@@ -370,6 +376,8 @@ cdef class PeriodicRegion: - EXAMPLES:: - - sage: import numpy as np -+ sage: if int(np.version.short_version[0]) > 1: -+ ....: np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - - sage: data = np.zeros((20, 20)) -@@ -520,6 +528,8 @@ cdef class PeriodicRegion: - TESTS:: - - sage: import numpy as np -+ sage: if int(np.version.short_version[0]) > 1: -+ ....: np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - sage: data = np.zeros((4, 4)) - sage: data[1, 1] = True -diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py -index b2e6b301bf7..6937f6cb410 100644 ---- a/src/sage/stats/basic_stats.py -+++ b/src/sage/stats/basic_stats.py -@@ -227,6 +227,8 @@ def std(v, bias=False): - - sage: # needs numpy - sage: import numpy -+ sage: if int(numpy.version.short_version[0]) > 1: -+ ....: numpy.set_printoptions(legacy="1.25") - sage: x = numpy.array([1,2,3,4,5]) - sage: std(x, bias=False) - 1.5811388300841898 -@@ -304,6 +306,8 @@ def variance(v, bias=False): - sage: variance([RIF(1.0103, 1.0103), RIF(2)]) - 0.4897530450000000? - sage: import numpy # needs numpy -+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy - sage: x = numpy.array([1,2,3,4,5]) # needs numpy - sage: variance(x, bias=False) # needs numpy - 2.5 -diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx -index 2e22ec45c69..23adae84fb4 100644 ---- a/src/sage/stats/time_series.pyx -+++ b/src/sage/stats/time_series.pyx -@@ -1718,6 +1718,8 @@ cdef class TimeSeries: - if len(v0) == 1: - return v1[0]/v0[0] - import numpy -+ if int(numpy.version.short_version[0]) > 1: -+ numpy.set_printoptions(legacy="1.25") - coeffs = numpy.polyfit(v0,v1,1) - return coeffs[0] - -diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx -index dfbd5ff82fa..955a256e9b4 100644 ---- a/src/sage/structure/coerce.pyx -+++ b/src/sage/structure/coerce.pyx -@@ -520,6 +520,8 @@ cdef class CoercionModel: - Check that :issue:`8426` is fixed (see also :issue:`18076`):: - - sage: import numpy # needs numpy -+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy - - sage: # needs sage.rings.real_mpfr - sage: x = polygen(RR) -diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx -index 2cb2f09c715..cd89ad2a256 100644 ---- a/src/sage/symbolic/function.pyx -+++ b/src/sage/symbolic/function.pyx -@@ -964,6 +964,9 @@ cdef class BuiltinFunction(Function): - mpc(real='0.83373002513114902', imag='-0.98889770576286506') - - sage: import numpy # needs numpy -+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy -+ - sage: sin(numpy.int32(0)) # needs numpy - 0.0 - sage: type(_) # needs numpy -diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx -index 501b0920898..5b007d9e5fd 100644 ---- a/src/sage/symbolic/ring.pyx -+++ b/src/sage/symbolic/ring.pyx -@@ -1162,6 +1162,8 @@ cdef class NumpyToSRMorphism(Morphism): - We check that :issue:`8949` and :issue:`9769` are fixed (see also :issue:`18076`):: - - sage: import numpy # needs numpy -+ sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -+ ....: numpy.set_printoptions(legacy="1.25") # needs numpy - sage: f(x) = x^2 - sage: f(numpy.int8('2')) # needs numpy - 4 diff --git a/srcpkgs/sagemath/patches/38344-ecm_7.0.6.patch b/srcpkgs/sagemath/patches/38344-ecm_7.0.6.patch deleted file mode 100644 index db0ae9030623b6..00000000000000 --- a/srcpkgs/sagemath/patches/38344-ecm_7.0.6.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/src/sage/interfaces/ecm.py b/src/sage/interfaces/ecm.py -index 99287dec718..98011970404 100644 ---- a/src/sage/interfaces/ecm.py -+++ b/src/sage/interfaces/ecm.py -@@ -508,7 +508,6 @@ def _find_factor(self, n, factor_digits, B1, **kwds): - """ - n = self._validate(n) - kwds.setdefault('c', 1000000000) -- kwds.setdefault('I', 1) - if factor_digits is not None: - B1 = self.recommended_B1(factor_digits) - kwds['one'] = True -diff --git a/src/sage/libs/libecm.pyx b/src/sage/libs/libecm.pyx -index 886a9b816e4..83fb7adaf8d 100644 ---- a/src/sage/libs/libecm.pyx -+++ b/src/sage/libs/libecm.pyx -@@ -149,11 +149,13 @@ def ecmfactor(number, double B1, verbose=False, sigma=0): - Some special cases:: - - sage: ecmfactor(1, 100) -- (True, 1, ...) -+ Traceback (most recent call last): -+ ... -+ ValueError: Input number (1) must be greater than 1 - sage: ecmfactor(0, 100) - Traceback (most recent call last): - ... -- ValueError: Input number (0) must be positive -+ ValueError: Input number (0) must be greater than 1 - """ - cdef mpz_t n, f - cdef int res -@@ -164,8 +166,8 @@ def ecmfactor(number, double B1, verbose=False, sigma=0): - sage_int_number = Integer(number) - sage_int_sigma = Integer(sigma) - -- if number <= 0: -- raise ValueError("Input number (%s) must be positive"%number) -+ if number <= 1: -+ raise ValueError("Input number (%s) must be greater than 1"%number) - - if verbose: - print("Performing one curve with B1=%1.0f" % B1) diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 28162dff8a38e1..5cab228f286365 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -19,7 +19,7 @@ get_pr() { echo "curl -sL \"$url\" | filterdiff ... > \"$pr-$desc.patch\"" if [ -z "$dry" ]; then curl -sL "$url" | - filterdiff -p1 -x src/setup.py -x build/* -x src/doc/* | + filterdiff -p1 -x src/setup.py -x environment* -x src/environment* -x build/* -x src/doc/* | cat > "$pr-$desc.patch" fi } @@ -29,8 +29,6 @@ cd $(dirname "$0") get_pr 36641 "sympy 1.13" get_pr 37884 "gap 4.13.1" -get_pr 38250 "numpy 2.0" -get_pr 38344 "ecm 7.0.6" #get_pr 37645 "fix doctest" #get_pr 37885 "cython warnings" diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index b116e62bc67a5a..f5e1d8c68cfcbe 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,7 +1,7 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.4 -revision=3 +version=10.5.beta2 +revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} build_style=python3-pep517 @@ -32,7 +32,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=f6579e85f33bd9bb6e9b991bfc4c49dab1e649858ed9ee41c7cec75cb92d4c62 +checksum=0fe0c82dd6959951fc07d55737d270290f64947e183a403ca25709e21b751dee nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here From 4427805e284a6bb5590cdf475cdd451446ebc158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Wed, 14 Aug 2024 00:12:02 -0300 Subject: [PATCH 10/21] sagemath: enable all cython warnings --- srcpkgs/sagemath/patches/37885-cython_warnings.patch | 12 ++++++++++++ srcpkgs/sagemath/patches/get_patches | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/sagemath/patches/37885-cython_warnings.patch diff --git a/srcpkgs/sagemath/patches/37885-cython_warnings.patch b/srcpkgs/sagemath/patches/37885-cython_warnings.patch new file mode 100644 index 00000000000000..fa4b648cfc1577 --- /dev/null +++ b/srcpkgs/sagemath/patches/37885-cython_warnings.patch @@ -0,0 +1,12 @@ +diff --git a/src/sage_setup/command/sage_build_cython.py b/src/sage_setup/command/sage_build_cython.py +index f4b1357c543..3435c196d49 100644 +--- a/src/sage_setup/command/sage_build_cython.py ++++ b/src/sage_setup/command/sage_build_cython.py +@@ -226,6 +226,7 @@ def run(self): + compiler_directives=self.cython_directives, + compile_time_env=self.compile_time_env, + create_extension=self.create_extension, ++ show_all_warnings=True, + # Debugging + gdb_debug=self.debug, + output_dir=os.path.join(self.build_lib, "sage"), diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 5cab228f286365..c182576ea553cd 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -31,4 +31,4 @@ get_pr 36641 "sympy 1.13" get_pr 37884 "gap 4.13.1" #get_pr 37645 "fix doctest" -#get_pr 37885 "cython warnings" +get_pr 37885 "cython warnings" From 8334a5ddb02fd3ee6f15c2ec0fecb41a107d0ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 20 Aug 2024 17:56:06 -0300 Subject: [PATCH 11/21] sagemath: patch for numpy 2.1 --- srcpkgs/sagemath/patches/numpy_2.1a.patch | 8 +-- srcpkgs/sagemath/patches/numpy_2.1b.patch | 70 +++++++++++------------ 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/srcpkgs/sagemath/patches/numpy_2.1a.patch b/srcpkgs/sagemath/patches/numpy_2.1a.patch index 30e2de99d84536..493c75e2f8f8e0 100644 --- a/srcpkgs/sagemath/patches/numpy_2.1a.patch +++ b/srcpkgs/sagemath/patches/numpy_2.1a.patch @@ -1,14 +1,14 @@ -commit 241dc39bd0ba1c056f88bee46a0345d59093eaff +commit d755b32cbed462abf01a1cd782ba57cb92fbf713 Author: Gonzalo Tornaría Date: Mon Aug 19 23:25:32 2024 -0300 add copy parameter to numpy (needed for v2.1) diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx -index c38df5412f0..f587cef651a 100644 +index 3edb9ead54d..2c76fd1e557 100644 --- a/src/sage/matrix/matrix1.pyx +++ b/src/sage/matrix/matrix1.pyx -@@ -671,7 +671,7 @@ cdef class Matrix(Matrix0): +@@ -670,7 +670,7 @@ cdef class Matrix(Matrix0): entries = [[sib(v, 2) for v in row] for row in self.rows()] return sib.name('matrix')(self.base_ring(), entries) @@ -17,7 +17,7 @@ index c38df5412f0..f587cef651a 100644 """ Return the Numpy matrix associated to this matrix. -@@ -732,7 +732,7 @@ cdef class Matrix(Matrix0): +@@ -731,7 +731,7 @@ cdef class Matrix(Matrix0): (3, 4) """ import numpy diff --git a/srcpkgs/sagemath/patches/numpy_2.1b.patch b/srcpkgs/sagemath/patches/numpy_2.1b.patch index b77e28361d2e74..8dc0eec2b5a9d8 100644 --- a/srcpkgs/sagemath/patches/numpy_2.1b.patch +++ b/srcpkgs/sagemath/patches/numpy_2.1b.patch @@ -1,11 +1,11 @@ -commit 8b32fdb87725c1d67ffb51dadec1c331c7c35f3c +commit 8260d18c3cf8e356db3d95fc46f6e68f75b453fd Author: Gonzalo Tornaría Date: Tue Aug 20 00:05:33 2024 -0300 silence np.set_printoptions (for numpy 2.1) diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py -index b3ebd206cd2..48866824224 100644 +index 74a14fa1ecd..82e6c7eb3c8 100644 --- a/src/sage/combinat/fully_packed_loop.py +++ b/src/sage/combinat/fully_packed_loop.py @@ -68,7 +68,7 @@ def _make_color_list(n, colors=None, color_map=None, randomize=False): @@ -18,7 +18,7 @@ index b3ebd206cd2..48866824224 100644 sage: _make_color_list(5) sage: _make_color_list(5, ['blue', 'red']) diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py -index 2a03bb68f67..30b56722e66 100644 +index 308171af3cd..6f66624ef87 100644 --- a/src/sage/functions/special.py +++ b/src/sage/functions/special.py @@ -219,7 +219,7 @@ class SphericalHarmonic(BuiltinFunction): @@ -31,10 +31,10 @@ index 2a03bb68f67..30b56722e66 100644 (0.3454941494713355-4.231083042742082e-17j) diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py -index 7ae8ca4966f..4cba22efdba 100644 +index b3e42a6a6a2..13ffa4d1789 100644 --- a/src/sage/numerical/optimize.py +++ b/src/sage/numerical/optimize.py -@@ -385,7 +385,7 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default", +@@ -381,7 +381,7 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm='default', ....: return sum(100.0r*(x[1r:]-x[:-1r]**2.0r)**2.0r + (1r-x[:-1r])**2.0r) sage: import numpy sage: if int(numpy.version.short_version[0]) > 1: @@ -44,7 +44,7 @@ index 7ae8ca4966f..4cba22efdba 100644 sage: def rosen_der(x): ....: xm = x[1r:-1r] diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py -index 23e2517ca56..7375dcd5d1c 100644 +index 02442f90ba4..1fe3f0b051a 100644 --- a/src/sage/plot/arrow.py +++ b/src/sage/plot/arrow.py @@ -55,7 +55,7 @@ class CurveArrow(GraphicPrimitive): @@ -57,10 +57,10 @@ index 23e2517ca56..7375dcd5d1c 100644 sage: b = CurveArrow(path=[[(0,0),(.5,.5),(1,0)],[(.5,1),(0,0)]], ....: options={}) diff --git a/src/sage/plot/multigraphics.py b/src/sage/plot/multigraphics.py -index 6be448f1e04..004594b77c4 100644 +index d2f70b44526..2eaacc6879e 100644 --- a/src/sage/plot/multigraphics.py +++ b/src/sage/plot/multigraphics.py -@@ -786,7 +786,7 @@ class MultiGraphics(WithEqualityById, SageObject): +@@ -766,7 +766,7 @@ class MultiGraphics(WithEqualityById, SageObject): (0.2, 0.3, 0.4, 0.1) sage: import numpy # to ensure numpy 2.0 compatibility sage: if int(numpy.version.short_version[0]) > 1: @@ -68,8 +68,8 @@ index 6be448f1e04..004594b77c4 100644 + ....: _token = numpy.set_printoptions(legacy="1.25") sage: ax1.get_position().bounds # tol 1.0e-13 (0.2, 0.3, 0.4000000000000001, 0.10000000000000003) - -@@ -1300,7 +1300,7 @@ class GraphicsArray(MultiGraphics): + """ +@@ -1269,7 +1269,7 @@ class GraphicsArray(MultiGraphics): sage: G = graphics_array([g1, g2]) sage: import numpy # to ensure numpy 2.0 compatibility sage: if int(numpy.version.short_version[0]) > 1: @@ -79,10 +79,10 @@ index 6be448f1e04..004594b77c4 100644 (0.025045451349937315, 0.03415488992713045, diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py -index d2cb11088c7..6d88517cc15 100644 +index b69a05b37bf..25e404bfc7d 100644 --- a/src/sage/plot/streamline_plot.py +++ b/src/sage/plot/streamline_plot.py -@@ -73,7 +73,7 @@ class StreamlinePlot(GraphicPrimitive): +@@ -72,7 +72,7 @@ class StreamlinePlot(GraphicPrimitive): sage: x, y = var('x y') sage: import numpy # to ensure numpy 2.0 compatibility sage: if int(numpy.version.short_version[0]) > 1: @@ -92,20 +92,20 @@ index d2cb11088c7..6d88517cc15 100644 sage: d['xmin'] 10.0 diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx -index 38c30f7627b..cfb8a5ff5f7 100644 +index 11811b9587f..8ce0f7f2683 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx -@@ -594,7 +594,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): - - sage: import numpy # needs numpy - sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -- ....: numpy.set_printoptions(legacy="1.25") # needs numpy -+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy - sage: numpy.int8('12') == 12 # needs numpy +@@ -595,7 +595,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): + sage: # needs numpy + sage: import numpy + sage: if int(numpy.version.short_version[0]) > 1: +- ....: numpy.set_printoptions(legacy="1.25") ++ ....: _token = numpy.set_printoptions(legacy="1.25") + sage: numpy.int8('12') == 12 True - sage: 12 == numpy.int8('12') # needs numpy + sage: 12 == numpy.int8('12') diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx -index 76fbfedab95..57de30c9d18 100644 +index 11953a50ab5..6aafcceed89 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -232,7 +232,7 @@ TESTS:: @@ -118,7 +118,7 @@ index 76fbfedab95..57de30c9d18 100644 True sage: numpy.int8('2') == RIF(2) # needs numpy diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx -index 70ce616f92f..f604c6d3785 100644 +index 40b92ab23eb..3838bcccb8a 100755 --- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx +++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx @@ -78,7 +78,7 @@ cdef class PeriodicRegion: @@ -130,7 +130,7 @@ index 70ce616f92f..f604c6d3785 100644 sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion sage: data = np.zeros((4, 4)) sage: PeriodicRegion(CDF(2), CDF(2*I), data).is_empty() -@@ -298,7 +298,7 @@ cdef class PeriodicRegion: +@@ -296,7 +296,7 @@ cdef class PeriodicRegion: sage: import numpy as np sage: if int(np.version.short_version[0]) > 1: @@ -139,7 +139,7 @@ index 70ce616f92f..f604c6d3785 100644 sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion sage: data = np.zeros((10, 10)) sage: data[1:4,1:4] = True -@@ -322,7 +322,7 @@ cdef class PeriodicRegion: +@@ -320,7 +320,7 @@ cdef class PeriodicRegion: sage: import numpy as np sage: if int(np.version.short_version[0]) > 1: @@ -148,7 +148,7 @@ index 70ce616f92f..f604c6d3785 100644 sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion sage: data = np.zeros((4, 4)) sage: data[1,1] = True -@@ -377,7 +377,7 @@ cdef class PeriodicRegion: +@@ -375,7 +375,7 @@ cdef class PeriodicRegion: sage: import numpy as np sage: if int(np.version.short_version[0]) > 1: @@ -157,7 +157,7 @@ index 70ce616f92f..f604c6d3785 100644 sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion sage: data = np.zeros((20, 20)) -@@ -529,7 +529,7 @@ cdef class PeriodicRegion: +@@ -528,7 +528,7 @@ cdef class PeriodicRegion: sage: import numpy as np sage: if int(np.version.short_version[0]) > 1: @@ -167,10 +167,10 @@ index 70ce616f92f..f604c6d3785 100644 sage: data = np.zeros((4, 4)) sage: data[1, 1] = True diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py -index 6937f6cb410..fb296e00fb6 100644 +index 47d890cf0ab..ba7f0cdb0f9 100644 --- a/src/sage/stats/basic_stats.py +++ b/src/sage/stats/basic_stats.py -@@ -228,7 +228,7 @@ def std(v, bias=False): +@@ -222,7 +222,7 @@ def std(v, bias=False): sage: # needs numpy sage: import numpy sage: if int(numpy.version.short_version[0]) > 1: @@ -179,7 +179,7 @@ index 6937f6cb410..fb296e00fb6 100644 sage: x = numpy.array([1,2,3,4,5]) sage: std(x, bias=False) 1.5811388300841898 -@@ -307,7 +307,7 @@ def variance(v, bias=False): +@@ -299,7 +299,7 @@ def variance(v, bias=False): 0.4897530450000000? sage: import numpy # needs numpy sage: if int(numpy.version.short_version[0]) > 1: # needs numpy @@ -189,7 +189,7 @@ index 6937f6cb410..fb296e00fb6 100644 sage: variance(x, bias=False) # needs numpy 2.5 diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx -index 955a256e9b4..e5ed6160b79 100644 +index cc15eff82e9..e32e7fd28b3 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -521,7 +521,7 @@ cdef class CoercionModel: @@ -202,10 +202,10 @@ index 955a256e9b4..e5ed6160b79 100644 sage: # needs sage.rings.real_mpfr sage: x = polygen(RR) diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx -index cd89ad2a256..6fdf6d8ef23 100644 +index 362d01ea297..92bce28b032 100644 --- a/src/sage/symbolic/function.pyx +++ b/src/sage/symbolic/function.pyx -@@ -965,7 +965,7 @@ cdef class BuiltinFunction(Function): +@@ -962,7 +962,7 @@ cdef class BuiltinFunction(Function): sage: import numpy # needs numpy sage: if int(numpy.version.short_version[0]) > 1: # needs numpy @@ -215,10 +215,10 @@ index cd89ad2a256..6fdf6d8ef23 100644 sage: sin(numpy.int32(0)) # needs numpy 0.0 diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx -index 5b007d9e5fd..4a096d317e7 100644 +index 32afe8d3a62..63734e68f63 100644 --- a/src/sage/symbolic/ring.pyx +++ b/src/sage/symbolic/ring.pyx -@@ -1163,7 +1163,7 @@ cdef class NumpyToSRMorphism(Morphism): +@@ -1154,7 +1154,7 @@ cdef class NumpyToSRMorphism(Morphism): sage: import numpy # needs numpy sage: if int(numpy.version.short_version[0]) > 1: # needs numpy From 048c8e2bcd7283e3f15e4377a91fae47c55f6178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 8 Sep 2024 09:35:16 -0300 Subject: [PATCH 12/21] nauty: update to 2.8.9. --- srcpkgs/nauty/patches/fix-runalltests.patch | 11 +++++++++++ srcpkgs/nauty/template | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/nauty/patches/fix-runalltests.patch diff --git a/srcpkgs/nauty/patches/fix-runalltests.patch b/srcpkgs/nauty/patches/fix-runalltests.patch new file mode 100644 index 00000000000000..34e1692cf6e6e3 --- /dev/null +++ b/srcpkgs/nauty/patches/fix-runalltests.patch @@ -0,0 +1,11 @@ +--- a/runalltests.in 2024-08-26 00:55:55.000000000 -0300 ++++ b/runalltests.in 2024-09-08 09:30:04.032719770 -0300 +@@ -121,7 +121,7 @@ + runonetest "./geng -q -TD6 10 | ./ransubg -qS765 -P9/10 | ./countg --NN,A,G,GG" "" nautestv.ans + runonetest "./genrang -q -P3 -S1234 70 1000 | ./countg --G,GG" "" nautestw.ans + runonetest "./genrang -q -P4 -z -S1234 70 500 | ./countg --G,GG" "" nautestx.ans +-runonetest "./geng -q -bT 12 | ./ranlabg -qS7654 -m5 | uniqg -u" "" nautesty.ans ++runonetest "./geng -q -bT 12 | ./ranlabg -qS7654 -m5 | ./uniqg -u" "" nautesty.ans + + echo " " + diff --git a/srcpkgs/nauty/template b/srcpkgs/nauty/template index 6f85b1d064d4e5..aea4e4a6eb0294 100644 --- a/srcpkgs/nauty/template +++ b/srcpkgs/nauty/template @@ -1,18 +1,18 @@ # Template file for 'nauty' pkgname=nauty -version=2.8.8 +version=2.8.9 revision=1 build_style=gnu-configure make_install_args="includedir=/usr/include/nauty pkgconfigexecdir=/usr/lib/pkgconfig" -hostmakedepends="automake" +hostmakedepends="automake libtool" short_desc="Compute the automorphism groups of graphs and digraphs" maintainer="Gonzalo Tornaría " license="Apache-2.0" homepage="https://pallini.di.uniroma1.it/" changelog="https://pallini.di.uniroma1.it/changes24-28.txt" distfiles="https://pallini.di.uniroma1.it/nauty${version//./_}.tar.gz" -checksum=159d2156810a6bb240410cd61eb641add85088d9f15c888cdaa37b8681f929ce +checksum=c97ab42bf48796a86a598bce3e9269047ca2b32c14fc23e07208a244fe52c4ee build_options="native_build" @@ -21,6 +21,7 @@ if [ -z "$build_option_native_build" ]; then fi pre_configure() { + aclocal autoreconf -fi } From 6ba642909d9184c8233d9c6096a6c6360df15fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sat, 7 Sep 2024 14:32:41 -0300 Subject: [PATCH 13/21] sagemath: update to 10.5.beta3. --- .../sagemath/patches/36641-sympy_1.13.patch | 60 ------------------- .../sagemath/patches/38572-nauty_2.8.9.patch | 13 ++++ srcpkgs/sagemath/patches/get_patches | 4 +- srcpkgs/sagemath/template | 4 +- 4 files changed, 17 insertions(+), 64 deletions(-) delete mode 100644 srcpkgs/sagemath/patches/36641-sympy_1.13.patch create mode 100644 srcpkgs/sagemath/patches/38572-nauty_2.8.9.patch diff --git a/srcpkgs/sagemath/patches/36641-sympy_1.13.patch b/srcpkgs/sagemath/patches/36641-sympy_1.13.patch deleted file mode 100644 index 01e859ad023f4d..00000000000000 --- a/srcpkgs/sagemath/patches/36641-sympy_1.13.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py -index 823a0d14a41..de1c8531814 100644 ---- a/src/sage/doctest/forker.py -+++ b/src/sage/doctest/forker.py -@@ -150,14 +150,15 @@ def init_sage(controller=None): - sage: from sympy.printing.pretty.pretty import PrettyPrinter - sage: s = sympify('+x^'.join(str(i) for i in range(30))) - sage: print(PrettyPrinter(settings={'wrap_line': True}).doprint(s)) -- 29 28 27 26 25 24 23 22 21 20 19 18 17 -- x + x + x + x + x + x + x + x + x + x + x + x + x + -+ 29 28 27 26 25 24 23 22 21 20 19 18 17 ↪ -+ x + x + x + x + x + x + x + x + x + x + x + x + x + ↪ - -- 16 15 14 13 12 11 10 9 8 7 6 5 4 3 -- x + x + x + x + x + x + x + x + x + x + x + x + x + x + x -+ ↪ 16 15 14 13 12 11 10 9 8 7 6 5 4 3 ↪ -+ ↪ x + x + x + x + x + x + x + x + x + x + x + x + x + x + ↪ - -- 2 -- + x -+ ↪ 2 -+ ↪ x + x -+ - - The displayhook sorts dictionary keys to simplify doctesting of - dictionary output:: -diff --git a/src/sage/functions/hypergeometric.py b/src/sage/functions/hypergeometric.py -index ade7836b310..eb5c6665c0d 100644 ---- a/src/sage/functions/hypergeometric.py -+++ b/src/sage/functions/hypergeometric.py -@@ -124,7 +124,7 @@ - sage: maxima(hypergeometric([1, 1, 1], [3, 3, 3], x)) # needs sage.symbolic - hypergeometric([1,1,1],[3,3,3],_SAGE_VAR_x) - sage: hypergeometric((5, 4), (4, 4), 3)._sympy_() # needs sympy sage.symbolic -- hyper((5, 4), (4, 4), 3) -+ hyper((5,), (4,), 3) - sage: hypergeometric((5, 4), (4, 4), 3)._mathematica_init_() # needs sage.symbolic - 'HypergeometricPFQ[{5,4},{4,4},3]' - -diff --git a/src/sage/typeset/ascii_art.py b/src/sage/typeset/ascii_art.py -index 83d92af8959..e470e2bd88d 100644 ---- a/src/sage/typeset/ascii_art.py -+++ b/src/sage/typeset/ascii_art.py -@@ -44,11 +44,12 @@ - sage: shell.run_cell('%display ascii_art') - sage: shell.run_cell("i = var('i')") # needs sage.symbolic - sage: shell.run_cell('sum(factorial(i)*x^i, i, 0, 10)') # needs sage.symbolic -- 10 9 8 7 6 5 4 3 -- 3628800*x + 362880*x + 40320*x + 5040*x + 720*x + 120*x + 24*x + 6*x -+ 10 9 8 7 6 5 4 3 > -+ 3628800*x + 362880*x + 40320*x + 5040*x + 720*x + 120*x + 24*x + 6*x > - -- 2 -- + 2*x + x + 1 -+ > 2 -+ > + 2*x + x + 1 -+ - sage: shell.run_cell('3/(7*x)') # needs sage.symbolic - 3 - --- diff --git a/srcpkgs/sagemath/patches/38572-nauty_2.8.9.patch b/srcpkgs/sagemath/patches/38572-nauty_2.8.9.patch new file mode 100644 index 00000000000000..5f75a8bef5556a --- /dev/null +++ b/srcpkgs/sagemath/patches/38572-nauty_2.8.9.patch @@ -0,0 +1,13 @@ +diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py +index e6e5312b8a8..aa10d15d4d8 100644 +--- a/src/sage/graphs/generators/families.py ++++ b/src/sage/graphs/generators/families.py +@@ -3710,7 +3710,7 @@ def nauty_gentreeg(options='', debug=False): + ... + ValueError: wrong format of parameter options + sage: list(graphs.nauty_gentreeg("3 -x", debug=True)) +- ['>E Usage: ...gentreeg [-D#] [-Z#:#] [-ulps] [-q] n [res/mod] ... ++ ['>E Usage: ...gentreeg [-D#] [-Z#:#] [-ulps] [-q] n... [res/mod] ... + sage: list(graphs.nauty_gentreeg("3", debug=True)) + ['>A ...gentreeg ...\n', Graph on 3 vertices] + """ diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index c182576ea553cd..8f540dad14bfd1 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -1,6 +1,6 @@ #! /bin/sh -version=10.4 +version=10.5 URL_BASE_PR="https://github.com/sagemath/sage/pull/" URL_BASE_COMPARE="https://github.com/sagemath/sage/compare/${version}..." @@ -27,8 +27,8 @@ get_pr() { # run from patches dir cd $(dirname "$0") -get_pr 36641 "sympy 1.13" get_pr 37884 "gap 4.13.1" +get_pr 38572 "nauty 2.8.9" #get_pr 37645 "fix doctest" get_pr 37885 "cython warnings" diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index f5e1d8c68cfcbe..709a3ea4262101 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,6 +1,6 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.5.beta2 +version=10.5.beta3 revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} @@ -32,7 +32,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=0fe0c82dd6959951fc07d55737d270290f64947e183a403ca25709e21b751dee +checksum=cbf3614c1b9be5f0a0756b0a5480c2ebfa663bd87bd66eefd162a755979bcb3d nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here From 461397c78b651dbb8b8c4b5b9ed8f35a673a2f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 22 Sep 2024 08:19:39 -0300 Subject: [PATCH 14/21] sagemath: update to 10.5.beta5. --- .../sagemath/patches/38572-nauty_2.8.9.patch | 13 - srcpkgs/sagemath/patches/numpy_2.1a.patch | 28 --- srcpkgs/sagemath/patches/numpy_2.1b.patch | 229 ------------------ srcpkgs/sagemath/template | 4 +- 4 files changed, 2 insertions(+), 272 deletions(-) delete mode 100644 srcpkgs/sagemath/patches/38572-nauty_2.8.9.patch delete mode 100644 srcpkgs/sagemath/patches/numpy_2.1a.patch delete mode 100644 srcpkgs/sagemath/patches/numpy_2.1b.patch diff --git a/srcpkgs/sagemath/patches/38572-nauty_2.8.9.patch b/srcpkgs/sagemath/patches/38572-nauty_2.8.9.patch deleted file mode 100644 index 5f75a8bef5556a..00000000000000 --- a/srcpkgs/sagemath/patches/38572-nauty_2.8.9.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py -index e6e5312b8a8..aa10d15d4d8 100644 ---- a/src/sage/graphs/generators/families.py -+++ b/src/sage/graphs/generators/families.py -@@ -3710,7 +3710,7 @@ def nauty_gentreeg(options='', debug=False): - ... - ValueError: wrong format of parameter options - sage: list(graphs.nauty_gentreeg("3 -x", debug=True)) -- ['>E Usage: ...gentreeg [-D#] [-Z#:#] [-ulps] [-q] n [res/mod] ... -+ ['>E Usage: ...gentreeg [-D#] [-Z#:#] [-ulps] [-q] n... [res/mod] ... - sage: list(graphs.nauty_gentreeg("3", debug=True)) - ['>A ...gentreeg ...\n', Graph on 3 vertices] - """ diff --git a/srcpkgs/sagemath/patches/numpy_2.1a.patch b/srcpkgs/sagemath/patches/numpy_2.1a.patch deleted file mode 100644 index 493c75e2f8f8e0..00000000000000 --- a/srcpkgs/sagemath/patches/numpy_2.1a.patch +++ /dev/null @@ -1,28 +0,0 @@ -commit d755b32cbed462abf01a1cd782ba57cb92fbf713 -Author: Gonzalo Tornaría -Date: Mon Aug 19 23:25:32 2024 -0300 - - add copy parameter to numpy (needed for v2.1) - -diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx -index 3edb9ead54d..2c76fd1e557 100644 ---- a/src/sage/matrix/matrix1.pyx -+++ b/src/sage/matrix/matrix1.pyx -@@ -670,7 +670,7 @@ cdef class Matrix(Matrix0): - entries = [[sib(v, 2) for v in row] for row in self.rows()] - return sib.name('matrix')(self.base_ring(), entries) - -- def numpy(self, dtype=None): -+ def numpy(self, dtype=None, copy=True): - """ - Return the Numpy matrix associated to this matrix. - -@@ -731,7 +731,7 @@ cdef class Matrix(Matrix0): - (3, 4) - """ - import numpy -- A = numpy.matrix(self.list(), dtype=dtype) -+ A = numpy.matrix(self.list(), dtype=dtype, copy=copy) - return numpy.resize(A,(self.nrows(), self.ncols())) - - # Define the magic "__array__" function so that numpy.array(m) can convert diff --git a/srcpkgs/sagemath/patches/numpy_2.1b.patch b/srcpkgs/sagemath/patches/numpy_2.1b.patch deleted file mode 100644 index 8dc0eec2b5a9d8..00000000000000 --- a/srcpkgs/sagemath/patches/numpy_2.1b.patch +++ /dev/null @@ -1,229 +0,0 @@ -commit 8260d18c3cf8e356db3d95fc46f6e68f75b453fd -Author: Gonzalo Tornaría -Date: Tue Aug 20 00:05:33 2024 -0300 - - silence np.set_printoptions (for numpy 2.1) - -diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py -index 74a14fa1ecd..82e6c7eb3c8 100644 ---- a/src/sage/combinat/fully_packed_loop.py -+++ b/src/sage/combinat/fully_packed_loop.py -@@ -68,7 +68,7 @@ def _make_color_list(n, colors=None, color_map=None, randomize=False): - - sage: import numpy as np - sage: if int(np.version.short_version[0]) > 1: -- ....: np.set_printoptions(legacy="1.25") -+ ....: _token = np.set_printoptions(legacy="1.25") - sage: from sage.combinat.fully_packed_loop import _make_color_list - sage: _make_color_list(5) - sage: _make_color_list(5, ['blue', 'red']) -diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py -index 308171af3cd..6f66624ef87 100644 ---- a/src/sage/functions/special.py -+++ b/src/sage/functions/special.py -@@ -219,7 +219,7 @@ class SphericalHarmonic(BuiltinFunction): - sage: from scipy.special import sph_harm # NB: arguments x and y are swapped # needs scipy - sage: import numpy as np # needs scipy - sage: if int(np.version.short_version[0]) > 1: # needs scipy -- ....: np.set_printoptions(legacy="1.25") # needs scipy -+ ....: _token = np.set_printoptions(legacy="1.25") # needs scipy - sage: sph_harm(1, 1, pi.n(), (pi/2).n()) # abs tol 1e-14 # needs scipy sage.symbolic - (0.3454941494713355-4.231083042742082e-17j) - -diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py -index b3e42a6a6a2..13ffa4d1789 100644 ---- a/src/sage/numerical/optimize.py -+++ b/src/sage/numerical/optimize.py -@@ -381,7 +381,7 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm='default', - ....: return sum(100.0r*(x[1r:]-x[:-1r]**2.0r)**2.0r + (1r-x[:-1r])**2.0r) - sage: import numpy - sage: if int(numpy.version.short_version[0]) > 1: -- ....: numpy.set_printoptions(legacy="1.25") -+ ....: _token = numpy.set_printoptions(legacy="1.25") - sage: from numpy import zeros - sage: def rosen_der(x): - ....: xm = x[1r:-1r] -diff --git a/src/sage/plot/arrow.py b/src/sage/plot/arrow.py -index 02442f90ba4..1fe3f0b051a 100644 ---- a/src/sage/plot/arrow.py -+++ b/src/sage/plot/arrow.py -@@ -55,7 +55,7 @@ class CurveArrow(GraphicPrimitive): - - sage: import numpy # to ensure numpy 2.0 compatibility - sage: if int(numpy.version.short_version[0]) > 1: -- ....: numpy.set_printoptions(legacy="1.25") -+ ....: _token = numpy.set_printoptions(legacy="1.25") - sage: from sage.plot.arrow import CurveArrow - sage: b = CurveArrow(path=[[(0,0),(.5,.5),(1,0)],[(.5,1),(0,0)]], - ....: options={}) -diff --git a/src/sage/plot/multigraphics.py b/src/sage/plot/multigraphics.py -index d2f70b44526..2eaacc6879e 100644 ---- a/src/sage/plot/multigraphics.py -+++ b/src/sage/plot/multigraphics.py -@@ -766,7 +766,7 @@ class MultiGraphics(WithEqualityById, SageObject): - (0.2, 0.3, 0.4, 0.1) - sage: import numpy # to ensure numpy 2.0 compatibility - sage: if int(numpy.version.short_version[0]) > 1: -- ....: numpy.set_printoptions(legacy="1.25") -+ ....: _token = numpy.set_printoptions(legacy="1.25") - sage: ax1.get_position().bounds # tol 1.0e-13 - (0.2, 0.3, 0.4000000000000001, 0.10000000000000003) - """ -@@ -1269,7 +1269,7 @@ class GraphicsArray(MultiGraphics): - sage: G = graphics_array([g1, g2]) - sage: import numpy # to ensure numpy 2.0 compatibility - sage: if int(numpy.version.short_version[0]) > 1: -- ....: numpy.set_printoptions(legacy="1.25") -+ ....: _token = numpy.set_printoptions(legacy="1.25") - sage: G.position(0) # tol 5.0e-3 - (0.025045451349937315, - 0.03415488992713045, -diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py -index b69a05b37bf..25e404bfc7d 100644 ---- a/src/sage/plot/streamline_plot.py -+++ b/src/sage/plot/streamline_plot.py -@@ -72,7 +72,7 @@ class StreamlinePlot(GraphicPrimitive): - sage: x, y = var('x y') - sage: import numpy # to ensure numpy 2.0 compatibility - sage: if int(numpy.version.short_version[0]) > 1: -- ....: numpy.set_printoptions(legacy="1.25") -+ ....: _token = numpy.set_printoptions(legacy="1.25") - sage: d = streamline_plot((.01*x, x+y), (x,10,20), (y,10,20))[0].get_minmax_data() - sage: d['xmin'] - 10.0 -diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx -index 11811b9587f..8ce0f7f2683 100644 ---- a/src/sage/rings/integer.pyx -+++ b/src/sage/rings/integer.pyx -@@ -595,7 +595,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): - sage: # needs numpy - sage: import numpy - sage: if int(numpy.version.short_version[0]) > 1: -- ....: numpy.set_printoptions(legacy="1.25") -+ ....: _token = numpy.set_printoptions(legacy="1.25") - sage: numpy.int8('12') == 12 - True - sage: 12 == numpy.int8('12') -diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx -index 11953a50ab5..6aafcceed89 100644 ---- a/src/sage/rings/real_mpfi.pyx -+++ b/src/sage/rings/real_mpfi.pyx -@@ -232,7 +232,7 @@ TESTS:: - - sage: import numpy # needs numpy - sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -- ....: numpy.set_printoptions(legacy="1.25") # needs numpy -+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy - sage: RIF(2) == numpy.int8('2') # needs numpy - True - sage: numpy.int8('2') == RIF(2) # needs numpy -diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx -index 40b92ab23eb..3838bcccb8a 100755 ---- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx -+++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx -@@ -78,7 +78,7 @@ cdef class PeriodicRegion: - - sage: import numpy as np - sage: if int(np.version.short_version[0]) > 1: -- ....: np.set_printoptions(legacy="1.25") -+ ....: _token = np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - sage: data = np.zeros((4, 4)) - sage: PeriodicRegion(CDF(2), CDF(2*I), data).is_empty() -@@ -296,7 +296,7 @@ cdef class PeriodicRegion: - - sage: import numpy as np - sage: if int(np.version.short_version[0]) > 1: -- ....: np.set_printoptions(legacy="1.25") -+ ....: _token = np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - sage: data = np.zeros((10, 10)) - sage: data[1:4,1:4] = True -@@ -320,7 +320,7 @@ cdef class PeriodicRegion: - - sage: import numpy as np - sage: if int(np.version.short_version[0]) > 1: -- ....: np.set_printoptions(legacy="1.25") -+ ....: _token = np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - sage: data = np.zeros((4, 4)) - sage: data[1,1] = True -@@ -375,7 +375,7 @@ cdef class PeriodicRegion: - - sage: import numpy as np - sage: if int(np.version.short_version[0]) > 1: -- ....: np.set_printoptions(legacy="1.25") -+ ....: _token = np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - - sage: data = np.zeros((20, 20)) -@@ -528,7 +528,7 @@ cdef class PeriodicRegion: - - sage: import numpy as np - sage: if int(np.version.short_version[0]) > 1: -- ....: np.set_printoptions(legacy="1.25") -+ ....: _token = np.set_printoptions(legacy="1.25") - sage: from sage.schemes.elliptic_curves.period_lattice_region import PeriodicRegion - sage: data = np.zeros((4, 4)) - sage: data[1, 1] = True -diff --git a/src/sage/stats/basic_stats.py b/src/sage/stats/basic_stats.py -index 47d890cf0ab..ba7f0cdb0f9 100644 ---- a/src/sage/stats/basic_stats.py -+++ b/src/sage/stats/basic_stats.py -@@ -222,7 +222,7 @@ def std(v, bias=False): - sage: # needs numpy - sage: import numpy - sage: if int(numpy.version.short_version[0]) > 1: -- ....: numpy.set_printoptions(legacy="1.25") -+ ....: _token = numpy.set_printoptions(legacy="1.25") - sage: x = numpy.array([1,2,3,4,5]) - sage: std(x, bias=False) - 1.5811388300841898 -@@ -299,7 +299,7 @@ def variance(v, bias=False): - 0.4897530450000000? - sage: import numpy # needs numpy - sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -- ....: numpy.set_printoptions(legacy="1.25") # needs numpy -+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy - sage: x = numpy.array([1,2,3,4,5]) # needs numpy - sage: variance(x, bias=False) # needs numpy - 2.5 -diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx -index cc15eff82e9..e32e7fd28b3 100644 ---- a/src/sage/structure/coerce.pyx -+++ b/src/sage/structure/coerce.pyx -@@ -521,7 +521,7 @@ cdef class CoercionModel: - - sage: import numpy # needs numpy - sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -- ....: numpy.set_printoptions(legacy="1.25") # needs numpy -+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy - - sage: # needs sage.rings.real_mpfr - sage: x = polygen(RR) -diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx -index 362d01ea297..92bce28b032 100644 ---- a/src/sage/symbolic/function.pyx -+++ b/src/sage/symbolic/function.pyx -@@ -962,7 +962,7 @@ cdef class BuiltinFunction(Function): - - sage: import numpy # needs numpy - sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -- ....: numpy.set_printoptions(legacy="1.25") # needs numpy -+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy - - sage: sin(numpy.int32(0)) # needs numpy - 0.0 -diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx -index 32afe8d3a62..63734e68f63 100644 ---- a/src/sage/symbolic/ring.pyx -+++ b/src/sage/symbolic/ring.pyx -@@ -1154,7 +1154,7 @@ cdef class NumpyToSRMorphism(Morphism): - - sage: import numpy # needs numpy - sage: if int(numpy.version.short_version[0]) > 1: # needs numpy -- ....: numpy.set_printoptions(legacy="1.25") # needs numpy -+ ....: _token = numpy.set_printoptions(legacy="1.25") # needs numpy - sage: f(x) = x^2 - sage: f(numpy.int8('2')) # needs numpy - 4 diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index 709a3ea4262101..4face5e8f7ad84 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,6 +1,6 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.5.beta3 +version=10.5.beta5 revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} @@ -32,7 +32,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=cbf3614c1b9be5f0a0756b0a5480c2ebfa663bd87bd66eefd162a755979bcb3d +checksum=af4e8215043cd5376adea87f37928b94863561e36cba2171dab48ea984f7f259 nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here From f0f7dc3d3737e6278c06f35946d5ffcb4817a923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 29 Sep 2024 22:24:40 -0300 Subject: [PATCH 15/21] sagemath: update to 10.5.beta6. --- srcpkgs/sagemath/patches/get_patches | 2 +- srcpkgs/sagemath/template | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 8f540dad14bfd1..381c307a3e962a 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -28,7 +28,7 @@ get_pr() { cd $(dirname "$0") get_pr 37884 "gap 4.13.1" -get_pr 38572 "nauty 2.8.9" +#get_pr 38572 "nauty 2.8.9" #get_pr 37645 "fix doctest" get_pr 37885 "cython warnings" diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index 4face5e8f7ad84..fb806ca641d378 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,6 +1,6 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.5.beta5 +version=10.5.beta6 revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} @@ -32,7 +32,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=af4e8215043cd5376adea87f37928b94863561e36cba2171dab48ea984f7f259 +checksum=f95f196142d7abf091185e31d8023091c5746a9e3d2321d906161c65f944fa40 nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here From d7437e12977edd4416df5ef644a7aa6b39c55a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Tue, 15 Oct 2024 15:30:11 -0300 Subject: [PATCH 16/21] sagemath: update to 10.5.beta7. --- srcpkgs/sagemath/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index fb806ca641d378..d19d4ac007f9ba 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,6 +1,6 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.5.beta6 +version=10.5.beta7 revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} @@ -32,7 +32,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=f95f196142d7abf091185e31d8023091c5746a9e3d2321d906161c65f944fa40 +checksum=b98a883aab3b6f551243bc3cffb6825c92f6faf86604e9a9cc8f38cfb9af2f32 nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here From b915738491d91acb483db5fcfad6b7f6791199c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sat, 26 Oct 2024 19:06:21 -0300 Subject: [PATCH 17/21] python3-Cython: new alternative fix for 6122, taken from 6430 --- srcpkgs/python3-Cython/patches/fix-regression.patch | 12 +++++++++--- srcpkgs/python3-Cython/template | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/srcpkgs/python3-Cython/patches/fix-regression.patch b/srcpkgs/python3-Cython/patches/fix-regression.patch index f5957cfa59c2f5..5a29e6a5143ed9 100644 --- a/srcpkgs/python3-Cython/patches/fix-regression.patch +++ b/srcpkgs/python3-Cython/patches/fix-regression.patch @@ -1,9 +1,11 @@ Revert https://github.com/cython/cython/pull/6124 which causes a serious regression, e.g. sagemath FTBS with cython 3.0.11 +Source: https://github.com/cython/cython/pull/6430 + --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py -@@ -710,10 +710,8 @@ class CFuncDeclaratorNode(CDeclaratorNode): +@@ -717,10 +717,8 @@ def analyse(self, return_type, env, nonempty=0, directive_locals=None, visibilit and not self.has_explicit_exc_clause and self.exception_check and visibility != 'extern'): @@ -15,11 +17,15 @@ serious regression, e.g. sagemath FTBS with cython 3.0.11 warning(self.pos, "Implicit noexcept declaration is deprecated." " Function declaration should contain 'noexcept' keyword.", -@@ -3128,6 +3126,7 @@ class DefNode(FuncDefNode): +@@ -3128,6 +3126,11 @@ def as_cfunction(self, cfunc=None, scope=None, overridable=True, returns=None, e if scope is None: scope = cfunc.scope cfunc_type = cfunc.type -+ has_explicit_exc_clause=True ++ if cfunc_type.exception_check: ++ # this ensures `legacy_implicit_noexcept` does not trigger ++ # as it would result in a mismatch ++ # (declaration with except, definition with implicit noexcept) ++ has_explicit_exc_clause = True if len(self.args) != len(cfunc_type.args) or cfunc_type.has_varargs: error(self.pos, "wrong number of arguments") error(cfunc.pos, "previous declaration here") diff --git a/srcpkgs/python3-Cython/template b/srcpkgs/python3-Cython/template index faec5722ae171a..a01702f0747d10 100644 --- a/srcpkgs/python3-Cython/template +++ b/srcpkgs/python3-Cython/template @@ -1,7 +1,7 @@ # Template file for 'python3-Cython' pkgname=python3-Cython version=3.0.11 -revision=2 +revision=3 build_style=python3-module hostmakedepends="python3-setuptools" makedepends="python3-devel" From da94f251e3c88a8a3be44b47492761e6bbd16ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sat, 26 Oct 2024 18:59:52 -0300 Subject: [PATCH 18/21] sagemath: update to 10.5.beta8. --- .../sagemath/patches/37884-gap_4.13.1.patch | 203 ------------------ .../sagemath/patches/38873-fix_doctest.patch | 25 +++ srcpkgs/sagemath/patches/get_patches | 3 +- srcpkgs/sagemath/patches/revert-38826.patch | 26 +++ srcpkgs/sagemath/template | 4 +- 5 files changed, 55 insertions(+), 206 deletions(-) delete mode 100644 srcpkgs/sagemath/patches/37884-gap_4.13.1.patch create mode 100644 srcpkgs/sagemath/patches/38873-fix_doctest.patch create mode 100644 srcpkgs/sagemath/patches/revert-38826.patch diff --git a/srcpkgs/sagemath/patches/37884-gap_4.13.1.patch b/srcpkgs/sagemath/patches/37884-gap_4.13.1.patch deleted file mode 100644 index 321e0a94487da3..00000000000000 --- a/srcpkgs/sagemath/patches/37884-gap_4.13.1.patch +++ /dev/null @@ -1,203 +0,0 @@ -diff --git a/src/sage/algebras/fusion_rings/fusion_double.py b/src/sage/algebras/fusion_rings/fusion_double.py -index 71277561331..3b681d75d3b 100644 ---- a/src/sage/algebras/fusion_rings/fusion_double.py -+++ b/src/sage/algebras/fusion_rings/fusion_double.py -@@ -133,7 +133,7 @@ class FusionDouble(CombinatorialFreeModule): - sage: G = SmallPermutationGroup(16,9) - sage: F = FusionDouble(G, prefix='b', inject_variables=True) - sage: b13^2 # long time (4s) -- b0 + b2 + b4 + b15 + b16 + b17 + b18 + b24 + b26 + b27 -+ b0 + b3 + b4 - """ - @staticmethod - def __classcall_private__(cls, G, prefix='s', inject_variables=False): -diff --git a/src/sage/categories/simplicial_sets.py b/src/sage/categories/simplicial_sets.py -index aabd3cdbb4f..14bebdcd080 100644 ---- a/src/sage/categories/simplicial_sets.py -+++ b/src/sage/categories/simplicial_sets.py -@@ -591,9 +591,9 @@ def _canonical_twisting_operator(self): - sage: X = simplicial_sets.Torus() - sage: d = X._canonical_twisting_operator() - sage: d -- {(s_0 v_0, sigma_1): f3, (sigma_1, s_0 v_0): f2*f3^-1, (sigma_1, sigma_1): f2} -+ {(s_0 v_0, sigma_1): f2, (sigma_1, s_0 v_0): f1*f2^-1, (sigma_1, sigma_1): f1} - sage: list(d.values())[0].parent() -- Multivariate Laurent Polynomial Ring in f2, f3 over Integer Ring -+ Multivariate Laurent Polynomial Ring in f1, f2 over Integer Ring - sage: Y = simplicial_sets.RealProjectiveSpace(2) - sage: d2 = Y._canonical_twisting_operator() - sage: d2 -@@ -674,10 +674,10 @@ def twisted_chain_complex(self, twisting_operator=None, dimensions=None, augment - sage: X = simplicial_sets.Torus() - sage: C = X.twisted_chain_complex() - sage: C.differential(1) -- [ f3 - 1 f2*f3^-1 - 1 f2 - 1] -+ [ f2 - 1 f1*f2^-1 - 1 f1 - 1] - sage: C.differential(2) -- [ 1 f2*f3^-1] -- [ f3 1] -+ [ 1 f1*f2^-1] -+ [ f2 1] - [ -1 -1] - sage: C.differential(3) - [] -@@ -844,29 +844,29 @@ def twisted_homology(self, n, reduced=False): - sage: # needs sage.graphs - sage: Y = simplicial_sets.Torus() - sage: Y.twisted_homology(1) -- Quotient module by Submodule of Ambient free module of rank 5 over the integral domain Multivariate Polynomial Ring in f2, f2inv, f3, f3inv over Integer Ring -+ Quotient module by Submodule of Ambient free module of rank 5 over the integral domain Multivariate Polynomial Ring in f1, f1inv, f2, f2inv over Integer Ring - Generated by the rows of the matrix: - [ 1 0 0 0 0] - [ 0 1 0 0 0] - [ 0 0 1 0 0] - [ 0 0 0 1 0] - [ 0 0 0 0 1] -+ [f1*f1inv - 1 0 0 0 0] -+ [ 0 f1*f1inv - 1 0 0 0] -+ [ 0 0 f1*f1inv - 1 0 0] -+ [ 0 0 0 f1*f1inv - 1 0] -+ [ 0 0 0 0 f1*f1inv - 1] - [f2*f2inv - 1 0 0 0 0] - [ 0 f2*f2inv - 1 0 0 0] - [ 0 0 f2*f2inv - 1 0 0] - [ 0 0 0 f2*f2inv - 1 0] - [ 0 0 0 0 f2*f2inv - 1] -- [f3*f3inv - 1 0 0 0 0] -- [ 0 f3*f3inv - 1 0 0 0] -- [ 0 0 f3*f3inv - 1 0 0] -- [ 0 0 0 f3*f3inv - 1 0] -- [ 0 0 0 0 f3*f3inv - 1] - sage: Y.twisted_homology(2) -- Quotient module by Submodule of Ambient free module of rank 0 over the integral domain Multivariate Polynomial Ring in f2, f2inv, f3, f3inv over Integer Ring -+ Quotient module by Submodule of Ambient free module of rank 0 over the integral domain Multivariate Polynomial Ring in f1, f1inv, f2, f2inv over Integer Ring - Generated by the rows of the matrix: - [] - sage: Y.twisted_homology(1, reduced=True) -- Quotient module by Submodule of Ambient free module of rank 5 over the integral domain Multivariate Polynomial Ring in f2, f2inv, f3, f3inv over Integer Ring -+ Quotient module by Submodule of Ambient free module of rank 5 over the integral domain Multivariate Polynomial Ring in f1, f1inv, f2, f2inv over Integer Ring - Generated by the rows of the matrix: - [1 0 0 0 0] - [0 1 0 0 0] -diff --git a/src/sage/combinat/matrices/latin.py b/src/sage/combinat/matrices/latin.py -index e2d818e9480..84e6c4fcc9b 100644 ---- a/src/sage/combinat/matrices/latin.py -+++ b/src/sage/combinat/matrices/latin.py -@@ -2444,7 +2444,7 @@ def p3_group_bitrade_generators(p): - EXAMPLES:: - - sage: from sage.combinat.matrices.latin import * -- sage: p3_group_bitrade_generators(3) -+ sage: p3_group_bitrade_generators(3) # random output - ((2,6,7)(3,8,9), - (1,2,3)(4,7,8)(5,6,9), - (1,9,2)(3,7,4)(5,8,6), -diff --git a/src/sage/groups/cubic_braid.py b/src/sage/groups/cubic_braid.py -index 61db70925e1..521289c7578 100644 ---- a/src/sage/groups/cubic_braid.py -+++ b/src/sage/groups/cubic_braid.py -@@ -282,7 +282,7 @@ def _richcmp_(self, other, op): - EXAMPLES:: - - sage: CBG3 = CubicBraidGroup(3) -- sage: sorted(CBG3) # indirect doctest -+ sage: sorted(CBG3) # indirect doctest, random output - [(c0*c1^-1)^2, c0*c1^-1*c0, c0^-1*c1*c0^-1, c0^-1*c1^-1*c0, - c1*c0^-1*c1, c0^-1*c1^-1*c0^-1, c0^-1*c1^-1, c1^-1*c0*c1^-1, - c0*c1^-1*c0^-1, c0^-1*c1, c0^-1*c1*c0, c0*c1^-1, c1*c0^-1, -diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py -index 4ac2faa783b..7016d08381b 100644 ---- a/src/sage/groups/finitely_presented.py -+++ b/src/sage/groups/finitely_presented.py -@@ -1344,8 +1344,8 @@ def abelianization_map(self): - sage: H = G.quotient([g1^2, g2*g1*g2^(-1)*g1^(-1), g1*g3^(-2), g0^4]) - sage: H.abelianization_map() - Group morphism: -- From: Finitely presented group < g0, g1, g2, g3 | g1^2, g2*g1*g2^-1*g1^-1, g1*g3^-2, g0^4 > -- To: Finitely presented group < f2, f3, f4 | f2^-1*f3^-1*f2*f3, f2^-1*f4^-1*f2*f4, f3^-1*f4^-1*f3*f4, f2^4, f3^4 > -+ From: Finitely presented group < g0, g1, g2, g3 | g1^2, g2*g1*g2^-1*g1^-1, g1*g3^-2, g0^4 > -+ To: Finitely presented group < f1, f2, f3 | f1^4, f2^-1*f1^-1*f2*f1, f2^4, f3^-1*f1^-1*f3*f1, f3^-1*f2^-1*f3*f2 > - sage: g = FreeGroup(0) / [] - sage: g.abelianization_map() - Group endomorphism of Finitely presented group < | > -@@ -1394,10 +1394,10 @@ def abelianization_to_algebra(self, ring=QQ): - Defining g0, g1, g2, g3 - sage: H = G.quotient([g1^2, g2*g1*g2^(-1)*g1^(-1), g1*g3^(-2), g0^4]) - sage: H.abelianization_to_algebra() -- (Finitely presented group < f2, f3, f4 | f2^-1*f3^-1*f2*f3, f2^-1*f4^-1*f2*f4, -- f3^-1*f4^-1*f3*f4, f2^4, f3^4 >, -- Multivariate Laurent Polynomial Ring in f2, f3, f4 over Rational Field, -- [f2^4 - 1, f3^4 - 1], [f2^-1*f3^-2, f3^-2, f4, f3]) -+ (Finitely presented group < f1, f2, f3 | f1^4, f2^-1*f1^-1*f2*f1, f2^4, f3^-1*f1^-1*f3*f1, f3^-1*f2^-1*f3*f2 >, -+ Multivariate Laurent Polynomial Ring in f1, f2, f3 over Rational Field, -+ [f1^4 - 1, f2^4 - 1], -+ [f1^3*f2^2, f2^2, f3, f2]) - sage: g=FreeGroup(0) / [] - sage: g.abelianization_to_algebra() - (Finitely presented group < | >, Rational Field, [], []) -@@ -1673,7 +1673,7 @@ def abelian_alexander_matrix(self, ring=QQ, simplified=True): - [] - sage: G = FreeGroup(3)/[(2, 1, 1), (1, 2, 2, 3, 3)] - sage: A, ideal = G.abelian_alexander_matrix(simplified=True); A -- [-f3^2 - f3^4 - f3^6 f3^3 + f3^6] -+ [-f1^2 - f1^4 - f1^6 f1^3 + f1^6] - sage: g = FreeGroup(1) / [] - sage: g.abelian_alexander_matrix() - ([], []) -@@ -1773,11 +1773,11 @@ def characteristic_varieties(self, ring=QQ, matrix_ideal=None, groebner=False): - 3: Ideal (1) of Multivariate Laurent Polynomial Ring in f1, f2 over Integer Ring} - sage: G = FreeGroup(2)/[(1,2,1,-2,-1,-2)] - sage: G.characteristic_varieties() -- {0: Ideal (0) of Univariate Laurent Polynomial Ring in f2 over Rational Field, -- 1: Ideal (-1 + 2*f2 - 2*f2^2 + f2^3) of Univariate Laurent Polynomial Ring in f2 over Rational Field, -- 2: Ideal (1) of Univariate Laurent Polynomial Ring in f2 over Rational Field} -+ {0: Ideal (0) of Univariate Laurent Polynomial Ring in f1 over Rational Field, -+ 1: Ideal (-1 + 2*f1 - 2*f1^2 + f1^3) of Univariate Laurent Polynomial Ring in f1 over Rational Field, -+ 2: Ideal (1) of Univariate Laurent Polynomial Ring in f1 over Rational Field} - sage: G.characteristic_varieties(groebner=True) -- {0: [0], 1: [-1 + f2, 1 - f2 + f2^2], 2: []} -+ {0: [0], 1: [-1 + f1, 1 - f1 + f1^2], 2: []} - sage: G = FreeGroup(2)/[3 * (1, ), 2 * (2, )] - sage: G.characteristic_varieties(groebner=True) - {0: [-1 + F1, 1 + F1, 1 - F1 + F1^2, 1 + F1 + F1^2], 1: [1 - F1 + F1^2], 2: []} -diff --git a/src/sage/groups/perm_gps/permgroup_named.py b/src/sage/groups/perm_gps/permgroup_named.py -index 5c153b93d4c..bd4afad2942 100644 ---- a/src/sage/groups/perm_gps/permgroup_named.py -+++ b/src/sage/groups/perm_gps/permgroup_named.py -@@ -3465,16 +3465,14 @@ class SmallPermutationGroup(PermutationGroup_generic): - sage: G = SmallPermutationGroup(12,4); G - Group of order 12 and GAP Id 4 as a permutation group - sage: G.gens() -- ((1,2)(3,5)(4,10)(6,8)(7,12)(9,11), -- (1,3)(2,5)(4,7)(6,9)(8,11)(10,12), -- (1,4,8)(2,6,10)(3,7,11)(5,9,12)) -+ ((4,5), (1,2), (3,4,5)) - sage: G.character_table() # needs sage.rings.number_field - [ 1 1 1 1 1 1] -- [ 1 -1 -1 1 1 -1] -+ [ 1 -1 1 -1 1 -1] - [ 1 -1 1 1 -1 1] -- [ 1 1 -1 1 -1 -1] -- [ 2 0 -2 -1 0 1] -- [ 2 0 2 -1 0 -1] -+ [ 1 1 1 -1 -1 -1] -+ [ 2 0 -1 -2 0 1] -+ [ 2 0 -1 2 0 -1] - sage: def numgps(n): return ZZ(libgap.NumberSmallGroups(n)) - sage: all(SmallPermutationGroup(n,k).id() == [n,k] - ....: for n in [1..64] for k in [1..numgps(n)]) -@@ -3483,11 +3481,11 @@ class SmallPermutationGroup(PermutationGroup_generic): - sage: H.is_abelian() - False - sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()] -- [Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of -+ [Subgroup generated by [(1,3), (2,3)] of - (Group of order 6 and GAP Id 1 as a permutation group), -- Subgroup generated by [(1,2)(3,6)(4,5)] of -+ Subgroup generated by [(2,3)] of - (Group of order 6 and GAP Id 1 as a permutation group), -- Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of -+ Subgroup generated by [(1,2,3)] of - (Group of order 6 and GAP Id 1 as a permutation group)] - """ - diff --git a/srcpkgs/sagemath/patches/38873-fix_doctest.patch b/srcpkgs/sagemath/patches/38873-fix_doctest.patch new file mode 100644 index 00000000000000..f42a8a570ca0cb --- /dev/null +++ b/srcpkgs/sagemath/patches/38873-fix_doctest.patch @@ -0,0 +1,25 @@ +diff --git a/src/sage/parallel/map_reduce.py b/src/sage/parallel/map_reduce.py +index 303f7405416..a182a136a2f 100644 +--- a/src/sage/parallel/map_reduce.py ++++ b/src/sage/parallel/map_reduce.py +@@ -1133,18 +1133,16 @@ def start_workers(self): + + TESTS:: + ++ sage: # long time + sage: from sage.parallel.map_reduce import RESetMapReduce + sage: def children(x): + ....: print(f"Starting: {x}", flush=True) + ....: return [] + sage: S = RESetMapReduce(roots=[1, 2], children=children) + sage: S.setup_workers(2) +- sage: S.start_workers(); sleep(float(5)) # long time ++ sage: S.start_workers(); sleep(float(5)) + Starting: ... + Starting: ... +- +- Cleanup:: +- + sage: S.finish() + """ + if self._nprocess == 0: diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 381c307a3e962a..39fb67ef79aa7d 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -27,8 +27,9 @@ get_pr() { # run from patches dir cd $(dirname "$0") -get_pr 37884 "gap 4.13.1" +#get_pr 37884 "gap 4.13.1" #get_pr 38572 "nauty 2.8.9" #get_pr 37645 "fix doctest" get_pr 37885 "cython warnings" +get_pr 38873 "fix doctest" diff --git a/srcpkgs/sagemath/patches/revert-38826.patch b/srcpkgs/sagemath/patches/revert-38826.patch new file mode 100644 index 00000000000000..6a97d896db44f7 --- /dev/null +++ b/srcpkgs/sagemath/patches/revert-38826.patch @@ -0,0 +1,26 @@ +Revert "src/sage/env.py: canonicalize paths in a test" + +This reverts commit 53a6d3133ea7782c7498ea6ab6bd3041815bd6a6. + +See: https://github.com/sagemath/sage/pull/38826#issuecomment-2439757935 + +--- a/src/sage/env.py ++++ b/src/sage/env.py +@@ -8,14 +8,10 @@ environment variables, and has the same ``SAGE_ROOT`` and ``SAGE_LOCAL`` + + sage: env = {k:v for (k,v) in os.environ.items() if not k.startswith("SAGE_")} + sage: from subprocess import check_output +- sage: module_name = "sage.all" # hide .all import from the linter +- sage: cmd = f"from {module_name} import SAGE_ROOT, SAGE_LOCAL;" +- sage: cmd += "from os.path import samefile;" +- sage: cmd += f"s1 = samefile(SAGE_ROOT, '{SAGE_ROOT}');" +- sage: cmd += f"s2 = samefile(SAGE_LOCAL, '{SAGE_LOCAL}');" +- sage: cmd += "print(s1 and s2);" ++ sage: environment = "sage.all" ++ sage: cmd = f"from {environment} import SAGE_ROOT, SAGE_LOCAL; print((SAGE_ROOT, SAGE_LOCAL))" + sage: out = check_output([sys.executable, "-c", cmd], env=env).decode().strip() # long time +- sage: out == "True" # long time ++ sage: out == repr((SAGE_ROOT, SAGE_LOCAL)) # long time + True + + AUTHORS: diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index d19d4ac007f9ba..0fa1fb968249f6 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,6 +1,6 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.5.beta7 +version=10.5.beta8 revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} @@ -32,7 +32,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=b98a883aab3b6f551243bc3cffb6825c92f6faf86604e9a9cc8f38cfb9af2f32 +checksum=0c386e88524a91ad97db4f3f8ee7408d8678072596b3ab5e9ffaea2cb6be13fd nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here From e10a9853982713c26b968cbe46720ee779df17af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 3 Nov 2024 19:33:46 -0300 Subject: [PATCH 19/21] sagemath: fix after merge --- .../patches/38749-00-prepare_backport.patch | 89 ----------------- .../patches/38749-zz-fixup_backport.patch | 95 ------------------- 2 files changed, 184 deletions(-) delete mode 100644 srcpkgs/sagemath/patches/38749-00-prepare_backport.patch delete mode 100644 srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch diff --git a/srcpkgs/sagemath/patches/38749-00-prepare_backport.patch b/srcpkgs/sagemath/patches/38749-00-prepare_backport.patch deleted file mode 100644 index 01e6e0bc150141..00000000000000 --- a/srcpkgs/sagemath/patches/38749-00-prepare_backport.patch +++ /dev/null @@ -1,89 +0,0 @@ -commit 95d7f3070d46c971fe1ea1fceb3cc6d8039c1d66 -Author: Gonzalo Tornaría -Date: Sun Nov 3 13:09:51 2024 -0300 - - prepare for backport of #38749 - -diff --git a/src/sage/modular/dirichlet.py b/src/sage/modular/dirichlet.py -index e579c5090e3..efc533c51f0 100644 ---- a/src/sage/modular/dirichlet.py -+++ b/src/sage/modular/dirichlet.py -@@ -2388,7 +2388,8 @@ class DirichletGroupFactory(UniqueFactory): - - :: - -- sage: r4 = CyclotomicField(4).ring_of_integers() -+ sage: K = CyclotomicField(4) -+ sage: r4 = K.ring_of_integers() - sage: G = DirichletGroup(60, r4) - sage: G.gens() - (Dirichlet character modulo 60 of conductor 4 -@@ -2401,8 +2402,7 @@ class DirichletGroupFactory(UniqueFactory): - zeta4 - sage: parent(val) - Gaussian Integers generated by zeta4 in Cyclotomic Field of order 4 and degree 2 -- sage: r4_29_0 = r4.residue_field(r4.ideal(29).factor()[0][0]); r4_29_0(val) -- doctest:warning ... DeprecationWarning: ... -+ sage: r4_29_0 = r4.residue_field(K(29).factor()[0][0]); r4_29_0(val) - 17 - sage: r4_29_0(val) * GF(29)(3) - 22 -diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py -index 49b4030b2e9..2a650138291 100644 ---- a/src/sage/rings/number_field/selmer_group.py -+++ b/src/sage/rings/number_field/selmer_group.py -@@ -73,7 +73,6 @@ def _ideal_generator(I): - sage: K. = QuadraticField(-11) - sage: [_ideal_generator(K.prime_above(p)) for p in primes(25)] - [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, -a, 13, 17, 19, 1/2*a + 9/2] -- - """ - try: - return I.gens_reduced()[0] -diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py -index 39a60361ec6..f258961f685 100644 ---- a/src/sage/schemes/elliptic_curves/gp_simon.py -+++ b/src/sage/schemes/elliptic_curves/gp_simon.py -@@ -57,6 +57,9 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, - sage: import sage.schemes.elliptic_curves.gp_simon - sage: E = EllipticCurve('389a1') - sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E) -+ doctest:warning...: -+ DeprecationWarning: please use the 2-descent algorithm over QQ inside pari -+ See https://github.com/sagemath/sage/issues/38461 for details. - (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)]) - - TESTS:: -diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py -index 393b77bc1ff..af946d05fb7 100644 ---- a/src/sage/schemes/plane_conics/con_number_field.py -+++ b/src/sage/schemes/plane_conics/con_number_field.py -@@ -123,9 +123,9 @@ class ProjectiveConic_number_field(ProjectiveConic_field): - sage: C = Conic(K, [1, 3, -5]) - sage: C.has_rational_point(point=True, obstruction=True) - (False, Fractional ideal (-i - 2)) -- sage: C.has_rational_point(algorithm="rnfisnorm") -+ sage: C.has_rational_point(algorithm='rnfisnorm') - False -- sage: C.has_rational_point(algorithm="rnfisnorm", obstruction=True, -+ sage: C.has_rational_point(algorithm='rnfisnorm', obstruction=True, - ....: read_cache=False) - Traceback (most recent call last): - ... -diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py -index 339406cd9d6..2baab7e5cda 100644 ---- a/src/sage/schemes/projective/projective_morphism.py -+++ b/src/sage/schemes/projective/projective_morphism.py -@@ -1764,10 +1764,10 @@ class SchemeMorphism_polynomial_projective_space_field(SchemeMorphism_polynomial - Scheme morphism: - From: Projective Space of dimension 1 over Number Field in a - with defining polynomial y^4 + 3*y^2 + 1 -- with a = 0.?e-151 + 0.618033988749895?*I -+ with a = 0.?e-113 + 0.618033988749895?*I - To: Projective Space of dimension 2 over Number Field in a - with defining polynomial y^4 + 3*y^2 + 1 -- with a = 0.?e-151 + 0.618033988749895?*I -+ with a = 0.?e-113 + 0.618033988749895?*I - Defn: Defined on coordinates by sending (x : y) to - (x^2 + (a^3 + 2*a)*x*y + 3*y^2 : y^2 : (2*a^2 + 3)*x*y) - diff --git a/srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch b/srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch deleted file mode 100644 index 4a5550140eab6a..00000000000000 --- a/srcpkgs/sagemath/patches/38749-zz-fixup_backport.patch +++ /dev/null @@ -1,95 +0,0 @@ -commit 031e32abfded6902eeb5974b51026bec05e6a3c5 -Author: Gonzalo Tornaría -Date: Sun Nov 3 18:23:36 2024 -0300 - - fixup backport of #38749 - -diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py -index 75b2ecc69d8..4f52eba6279 100644 ---- a/src/sage/rings/number_field/number_field_ideal_rel.py -+++ b/src/sage/rings/number_field/number_field_ideal_rel.py -@@ -380,6 +380,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal): - - EXAMPLES:: - -+ sage: pari.setrand(3) - sage: R. = QQ[] - sage: K. = NumberField(x^2 + 6) - sage: L. = K.extension(K['x'].gen()^4 + a) -diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py -index c499bc2812c..c28e3b0a7a9 100644 ---- a/src/sage/rings/number_field/order.py -+++ b/src/sage/rings/number_field/order.py -@@ -590,7 +590,7 @@ class Order(IntegralDomain, sage.rings.abc.Order): - sage: k. = NumberField(x^2 + 5077); G = k.class_group(); G - Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077 - sage: G.0 ^ -9 -- Fractional ideal class (67, a + 45) -+ Fractional ideal class (43, a + 13) - sage: Ok = k.maximal_order(); Ok - Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077 - sage: Ok * (11, a + 7) -@@ -2994,7 +2994,7 @@ def EisensteinIntegers(names="omega"): - with defining polynomial x^2 + x + 1 - with omega = -0.50000000000000000? + 0.866025403784439?*I - sage: factor(3 + omega) -- (omega + 1) * (-2*omega + 1) -+ (-omega - 1) * (2*omega - 1) - sage: CC(omega) - -0.500000000000000 + 0.866025403784439*I - sage: omega.minpoly() -diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py -index 0e60ef0f6a2..4c615e75ac9 100644 ---- a/src/sage/schemes/elliptic_curves/ell_number_field.py -+++ b/src/sage/schemes/elliptic_curves/ell_number_field.py -@@ -2603,6 +2603,7 @@ class EllipticCurve_number_field(EllipticCurve_field): - - EXAMPLES:: - -+ sage: pari.setrand(1) - sage: K. = QuadraticField(-1) - sage: E = EllipticCurve(K, [0,0,0,0,1]) - sage: C = E.isogeny_class(); C -diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py -index 3fe8260947d..cf905787257 100644 ---- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py -+++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py -@@ -795,6 +795,7 @@ def deg_one_primes_iter(K, principal_only=False): - - EXAMPLES:: - -+ sage: pari.setrand(1) - sage: K. = QuadraticField(-5) - sage: from sage.schemes.elliptic_curves.gal_reps_number_field import deg_one_primes_iter - sage: it = deg_one_primes_iter(K) -diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py -index fdf6f0852e8..046b635cca8 100644 ---- a/src/sage/schemes/elliptic_curves/gp_simon.py -+++ b/src/sage/schemes/elliptic_curves/gp_simon.py -@@ -57,9 +57,6 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, - sage: import sage.schemes.elliptic_curves.gp_simon - sage: E = EllipticCurve('389a1') - sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E) -- doctest:warning...: -- DeprecationWarning: please use the 2-descent algorithm over QQ inside pari -- See https://github.com/sagemath/sage/issues/38461 for details. - (2, 2, [(-3/4 : 7/8 : 1), (5/4 : 5/8 : 1)]) - - TESTS:: -diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py -index 5f4512f5be6..2c1c6aef618 100644 ---- a/src/sage/schemes/projective/projective_morphism.py -+++ b/src/sage/schemes/projective/projective_morphism.py -@@ -1764,10 +1764,10 @@ class SchemeMorphism_polynomial_projective_space_field(SchemeMorphism_polynomial - Scheme morphism: - From: Projective Space of dimension 1 over Number Field in a - with defining polynomial y^4 + 3*y^2 + 1 -- with a = 0.?e-166 + 1.618033988749895?*I -+ with a = 0.?e-165 + 1.618033988749895?*I - To: Projective Space of dimension 2 over Number Field in a - with defining polynomial y^4 + 3*y^2 + 1 -- with a = 0.?e-166 + 1.618033988749895?*I -+ with a = 0.?e-165 + 1.618033988749895?*I - Defn: Defined on coordinates by sending (x : y) to - (x^2 + (-a^3 - 2*a)*x*y + 3*y^2 : y^2 : (-2*a^2 - 3)*x*y) - From 4f8a78e98eb82057b7ba873af30ec7841ca8ac86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Mon, 4 Nov 2024 19:13:43 -0300 Subject: [PATCH 20/21] sagemath: update to 10.5.beta9. --- .../patches/37885-cython_warnings.patch | 12 --------- .../sagemath/patches/38873-fix_doctest.patch | 25 ------------------ srcpkgs/sagemath/patches/get_patches | 4 +-- srcpkgs/sagemath/patches/revert-38826.patch | 26 ------------------- srcpkgs/sagemath/template | 6 ++--- 5 files changed, 5 insertions(+), 68 deletions(-) delete mode 100644 srcpkgs/sagemath/patches/37885-cython_warnings.patch delete mode 100644 srcpkgs/sagemath/patches/38873-fix_doctest.patch delete mode 100644 srcpkgs/sagemath/patches/revert-38826.patch diff --git a/srcpkgs/sagemath/patches/37885-cython_warnings.patch b/srcpkgs/sagemath/patches/37885-cython_warnings.patch deleted file mode 100644 index fa4b648cfc1577..00000000000000 --- a/srcpkgs/sagemath/patches/37885-cython_warnings.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/sage_setup/command/sage_build_cython.py b/src/sage_setup/command/sage_build_cython.py -index f4b1357c543..3435c196d49 100644 ---- a/src/sage_setup/command/sage_build_cython.py -+++ b/src/sage_setup/command/sage_build_cython.py -@@ -226,6 +226,7 @@ def run(self): - compiler_directives=self.cython_directives, - compile_time_env=self.compile_time_env, - create_extension=self.create_extension, -+ show_all_warnings=True, - # Debugging - gdb_debug=self.debug, - output_dir=os.path.join(self.build_lib, "sage"), diff --git a/srcpkgs/sagemath/patches/38873-fix_doctest.patch b/srcpkgs/sagemath/patches/38873-fix_doctest.patch deleted file mode 100644 index f42a8a570ca0cb..00000000000000 --- a/srcpkgs/sagemath/patches/38873-fix_doctest.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/src/sage/parallel/map_reduce.py b/src/sage/parallel/map_reduce.py -index 303f7405416..a182a136a2f 100644 ---- a/src/sage/parallel/map_reduce.py -+++ b/src/sage/parallel/map_reduce.py -@@ -1133,18 +1133,16 @@ def start_workers(self): - - TESTS:: - -+ sage: # long time - sage: from sage.parallel.map_reduce import RESetMapReduce - sage: def children(x): - ....: print(f"Starting: {x}", flush=True) - ....: return [] - sage: S = RESetMapReduce(roots=[1, 2], children=children) - sage: S.setup_workers(2) -- sage: S.start_workers(); sleep(float(5)) # long time -+ sage: S.start_workers(); sleep(float(5)) - Starting: ... - Starting: ... -- -- Cleanup:: -- - sage: S.finish() - """ - if self._nprocess == 0: diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 43d084527e5b98..532f33857545a7 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -31,7 +31,7 @@ cd $(dirname "$0") #get_pr 38572 "nauty 2.8.9" #get_pr 37645 "fix doctest" -get_pr 37885 "cython warnings" -get_pr 38873 "fix doctest" +#get_pr 37885 "cython warnings" +#get_pr 38873 "fix doctest" get_pr 38749 "pari 2.17" diff --git a/srcpkgs/sagemath/patches/revert-38826.patch b/srcpkgs/sagemath/patches/revert-38826.patch deleted file mode 100644 index 6a97d896db44f7..00000000000000 --- a/srcpkgs/sagemath/patches/revert-38826.patch +++ /dev/null @@ -1,26 +0,0 @@ -Revert "src/sage/env.py: canonicalize paths in a test" - -This reverts commit 53a6d3133ea7782c7498ea6ab6bd3041815bd6a6. - -See: https://github.com/sagemath/sage/pull/38826#issuecomment-2439757935 - ---- a/src/sage/env.py -+++ b/src/sage/env.py -@@ -8,14 +8,10 @@ environment variables, and has the same ``SAGE_ROOT`` and ``SAGE_LOCAL`` - - sage: env = {k:v for (k,v) in os.environ.items() if not k.startswith("SAGE_")} - sage: from subprocess import check_output -- sage: module_name = "sage.all" # hide .all import from the linter -- sage: cmd = f"from {module_name} import SAGE_ROOT, SAGE_LOCAL;" -- sage: cmd += "from os.path import samefile;" -- sage: cmd += f"s1 = samefile(SAGE_ROOT, '{SAGE_ROOT}');" -- sage: cmd += f"s2 = samefile(SAGE_LOCAL, '{SAGE_LOCAL}');" -- sage: cmd += "print(s1 and s2);" -+ sage: environment = "sage.all" -+ sage: cmd = f"from {environment} import SAGE_ROOT, SAGE_LOCAL; print((SAGE_ROOT, SAGE_LOCAL))" - sage: out = check_output([sys.executable, "-c", cmd], env=env).decode().strip() # long time -- sage: out == "True" # long time -+ sage: out == repr((SAGE_ROOT, SAGE_LOCAL)) # long time - True - - AUTHORS: diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index 42d53d251d973a..16efd692a00beb 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,7 +1,7 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.5.beta8 -revision=2 +version=10.5.beta9 +revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} build_style=python3-pep517 @@ -32,7 +32,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=0c386e88524a91ad97db4f3f8ee7408d8678072596b3ab5e9ffaea2cb6be13fd +checksum=eed965e67bc06d999116186c527bd2fd2438eea8523b680ae0944b1b260f3fb5 nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here From 0193c29769e35e8c2770aed1d555494951957dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Sun, 17 Nov 2024 22:30:57 -0300 Subject: [PATCH 21/21] sagemath: update to 10.5.rc0. --- .../sagemath/patches/38749-pari_2.17.patch | 151 ++++---- .../sagemath/patches/38749-zz-fix-32bit.patch | 335 ++++++++++++++++++ .../patches/zz-pari_bnf-doctests.patch | 312 ++++++++++++++++ srcpkgs/sagemath/patches/zz-pari_bnf.patch | 24 ++ .../sagemath/patches/zz-reduced_basis.patch | 46 +++ srcpkgs/sagemath/template | 4 +- 6 files changed, 786 insertions(+), 86 deletions(-) create mode 100644 srcpkgs/sagemath/patches/38749-zz-fix-32bit.patch create mode 100644 srcpkgs/sagemath/patches/zz-pari_bnf-doctests.patch create mode 100644 srcpkgs/sagemath/patches/zz-pari_bnf.patch create mode 100644 srcpkgs/sagemath/patches/zz-reduced_basis.patch diff --git a/srcpkgs/sagemath/patches/38749-pari_2.17.patch b/srcpkgs/sagemath/patches/38749-pari_2.17.patch index 4fbdd7358c0025..0112f04c6a328d 100644 --- a/srcpkgs/sagemath/patches/38749-pari_2.17.patch +++ b/srcpkgs/sagemath/patches/38749-pari_2.17.patch @@ -1,5 +1,5 @@ diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py -index 745d5fcbbe7..86409ab3243 100644 +index 14fe466ccd9..d94404258f3 100644 --- a/src/sage/arith/misc.py +++ b/src/sage/arith/misc.py @@ -2691,9 +2691,14 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds): @@ -56,7 +56,7 @@ index 76f0570a819..0e4d13ef889 100644 sage: gcd(t, i) Traceback (most recent call last): diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py -index 6995f61f463..457b0ba2253 100644 +index 9734b3767ac..d3f9c3cdf41 100644 --- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py @@ -690,10 +690,10 @@ def conjugate(self, M, adjugate=False, new_ideal=None): @@ -73,7 +73,7 @@ index 6995f61f463..457b0ba2253 100644 if self.domain().is_padic_base(): return DynamicalSystem_Berkovich(self._system.conjugate(M, adjugate=adjugate)) diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py -index a74efd9129a..151f9e71335 100644 +index 2fab95104f1..8b9cdd9313f 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -1790,7 +1790,7 @@ def primes_of_bad_reduction(self, check=True): @@ -86,7 +86,7 @@ index a74efd9129a..151f9e71335 100644 This is an example where ``check=False`` returns extra primes:: diff --git a/src/sage/libs/pari/convert_sage.pyx b/src/sage/libs/pari/convert_sage.pyx -index 64386bcf632..db6725f39a5 100644 +index e26238d7c38..48338e0279c 100644 --- a/src/sage/libs/pari/convert_sage.pyx +++ b/src/sage/libs/pari/convert_sage.pyx @@ -573,17 +573,16 @@ cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False): @@ -167,10 +167,10 @@ index 1ed571cd4b9..bd8dc9641d2 100644 sage: nf = pari('x^2 + 1').nfinit() sage: nf.nfrootsof1() diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx -index 0c257cfaf33..780cae7fbf2 100644 +index d2f0815e81e..efba7b3472b 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx -@@ -16583,7 +16583,7 @@ cdef class Matrix(Matrix1): +@@ -16584,7 +16584,7 @@ cdef class Matrix(Matrix1): ....: -2*a^2 + 4*a - 2, -2*a^2 + 1, 2*a, a^2 - 6, 3*a^2 - a ]) sage: r,s,p = m._echelon_form_PID() sage: s[2] @@ -206,10 +206,10 @@ index 4d120c075da..f3a3ff7e65b 100644 :: diff --git a/src/sage/modular/dirichlet.py b/src/sage/modular/dirichlet.py -index 1f6a7a94444..1cf3ccdb611 100644 +index c261a84e8de..8ca797b5f16 100644 --- a/src/sage/modular/dirichlet.py +++ b/src/sage/modular/dirichlet.py -@@ -2395,13 +2395,13 @@ class DirichletGroupFactory(UniqueFactory): +@@ -2398,13 +2398,13 @@ class DirichletGroupFactory(UniqueFactory): sage: parent(val) Gaussian Integers generated by zeta4 in Cyclotomic Field of order 4 and degree 2 sage: r4_29_0 = r4.residue_field(K(29).factor()[0][0]); r4_29_0(val) @@ -317,7 +317,7 @@ index d94b0a4335a..0978c7328fe 100644 Check that :issue:`19573` is resolved:: diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx -index 3146f7fd764..a8e77e48b76 100644 +index be83c5165f6..4d484603df8 100644 --- a/src/sage/rings/finite_rings/residue_field.pyx +++ b/src/sage/rings/finite_rings/residue_field.pyx @@ -22,14 +22,13 @@ monogenic (i.e., 2 is an essential discriminant divisor):: @@ -467,7 +467,7 @@ index e9962c3ccde..90a68c619f6 100644 sage: ff(alpha^2 + 1) diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx -index 9616e7946bc..bcc45e703a2 100644 +index ffc5ee16e0f..86cbb05c6bf 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -5585,7 +5585,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): @@ -608,10 +608,10 @@ index c974c3df6ff..ee53ca6d674 100644 Traceback (most recent call last): ... diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py -index bb16476980e..3a98a997962 100644 +index 7128d40032e..3cffd4ce062 100644 --- a/src/sage/rings/number_field/number_field.py +++ b/src/sage/rings/number_field/number_field.py -@@ -3627,7 +3627,7 @@ def fractional_ideal(self, *gens, **kwds): +@@ -3628,7 +3628,7 @@ def fractional_ideal(self, *gens, **kwds): sage: L. = K.extension(x^2 - 3, x^2 + 1) sage: M. = L.extension(x^2 + 1) sage: L.ideal(K.ideal(2, a)) @@ -620,7 +620,7 @@ index bb16476980e..3a98a997962 100644 sage: M.ideal(K.ideal(2, a)) == M.ideal(a*(b - c)/2) True -@@ -3665,40 +3665,29 @@ def ideals_of_bdd_norm(self, bound): +@@ -3666,40 +3666,29 @@ def ideals_of_bdd_norm(self, bound): sage: x = polygen(QQ, 'x') sage: K. = NumberField(x^2 + 23) @@ -684,7 +684,7 @@ index bb16476980e..3a98a997962 100644 """ hnf_ideals = self.pari_nf().ideallist(bound) d = {} -@@ -3925,9 +3914,13 @@ def primes_of_bounded_norm(self, B): +@@ -3926,9 +3915,13 @@ def primes_of_bounded_norm(self, B): EXAMPLES:: sage: K. = QuadraticField(-1) @@ -701,7 +701,7 @@ index bb16476980e..3a98a997962 100644 sage: K.primes_of_bounded_norm(1) [] sage: x = polygen(QQ, 'x') -@@ -3936,10 +3929,10 @@ def primes_of_bounded_norm(self, B): +@@ -3937,10 +3930,10 @@ def primes_of_bounded_norm(self, B): sage: P [Fractional ideal (a), Fractional ideal (a + 1), @@ -714,7 +714,7 @@ index bb16476980e..3a98a997962 100644 Fractional ideal (a^2 - 2*a - 1), Fractional ideal (a + 3)] sage: [p.norm() for p in P] -@@ -3988,11 +3981,13 @@ def primes_of_bounded_norm_iter(self, B): +@@ -3989,11 +3982,13 @@ def primes_of_bounded_norm_iter(self, B): sage: K. = QuadraticField(-1) sage: it = K.primes_of_bounded_norm_iter(10) @@ -731,7 +731,7 @@ index bb16476980e..3a98a997962 100644 sage: list(K.primes_of_bounded_norm_iter(1)) [] """ -@@ -4317,7 +4312,7 @@ def pari_nf(self, important=True): +@@ -4318,7 +4313,7 @@ def pari_nf(self, important=True): sage: k. = NumberField(x^4 - 3/2*x + 5/3); k Number Field in a with defining polynomial x^4 - 3/2*x + 5/3 sage: k.pari_nf() @@ -740,7 +740,7 @@ index bb16476980e..3a98a997962 100644 sage: pari(k) [y^4 - 324*y + 2160, [0, 2], 48918708, 216, ...] sage: gp(k) -@@ -4807,7 +4802,7 @@ def _S_class_group_and_units(self, S, proof=True): +@@ -4808,7 +4803,7 @@ def _S_class_group_and_units(self, S, proof=True): 1/13*a^2 + 7/13*a - 332/13, -1/13*a^2 + 6/13*a + 345/13, -1, @@ -749,7 +749,7 @@ index bb16476980e..3a98a997962 100644 sage: units[5] in (1/13*a^2 - 19/13*a - 7/13, 1/13*a^2 + 20/13*a - 7/13) True sage: len(units) == 6 -@@ -4818,7 +4813,7 @@ def _S_class_group_and_units(self, S, proof=True): +@@ -4819,7 +4814,7 @@ def _S_class_group_and_units(self, S, proof=True): sage: K. = NumberField(2*x^2 - 1/3) sage: K._S_class_group_and_units(tuple(K.primes_above(2) + K.primes_above(3))) @@ -758,7 +758,7 @@ index bb16476980e..3a98a997962 100644 """ K_pari = self.pari_bnf(proof=proof) S_pari = [p.pari_prime() for p in sorted(set(S))] -@@ -4996,7 +4991,7 @@ def selmer_generators(self, S, m, proof=True, orders=False): +@@ -4997,7 +4992,7 @@ def selmer_generators(self, S, m, proof=True, orders=False): 1/13*a^2 + 7/13*a - 332/13, -1/13*a^2 + 6/13*a + 345/13, -1, @@ -767,7 +767,7 @@ index bb16476980e..3a98a997962 100644 sage: gens[5] in (1/13*a^2 - 19/13*a - 7/13, 1/13*a^2 + 20/13*a - 7/13) True sage: gens[6] in (-1/13*a^2 + 45/13*a - 97/13, 1/13*a^2 - 45/13*a + 97/13) -@@ -5153,16 +5148,20 @@ def selmer_space(self, S, p, proof=None): +@@ -5154,16 +5149,20 @@ def selmer_space(self, S, p, proof=None): sage: KS2, gens, fromKS2, toKS2 = K.selmer_space([P2, P3, P5], 2) sage: KS2 Vector space of dimension 4 over Finite Field of size 2 @@ -791,7 +791,7 @@ index bb16476980e..3a98a997962 100644 sage: toKS2(10) (0, 0, 1, 1) -@@ -5174,8 +5173,10 @@ def selmer_space(self, S, p, proof=None): +@@ -5175,8 +5174,10 @@ def selmer_space(self, S, p, proof=None): sage: KS3, gens, fromKS3, toKS3 = K.selmer_space([P2, P3, P5], 3) sage: KS3 Vector space of dimension 3 over Finite Field of size 3 @@ -804,7 +804,7 @@ index bb16476980e..3a98a997962 100644 An example to show that the group `K(S,2)` may be strictly larger than the group of elements giving extensions unramified -@@ -5640,7 +5641,7 @@ def different(self): +@@ -5641,7 +5642,7 @@ def different(self): sage: k. = NumberField(x^2 + 23) sage: d = k.different() sage: d @@ -813,7 +813,7 @@ index bb16476980e..3a98a997962 100644 sage: d.norm() 23 sage: k.disc() -@@ -5760,7 +5761,7 @@ def elements_of_norm(self, n, proof=None) -> list: +@@ -5761,7 +5762,7 @@ def elements_of_norm(self, n, proof=None) -> list: sage: K.elements_of_norm(3) [] sage: K.elements_of_norm(50) @@ -822,7 +822,7 @@ index bb16476980e..3a98a997962 100644 TESTS: -@@ -5871,11 +5872,16 @@ def factor(self, n): +@@ -5872,11 +5873,16 @@ def factor(self, n): sage: K. = NumberField(x^2 + 1) sage: K.factor(1/3) (Fractional ideal (3))^-1 @@ -844,7 +844,7 @@ index bb16476980e..3a98a997962 100644 An example over a relative number field:: -@@ -5908,9 +5914,9 @@ def factor(self, n): +@@ -5909,9 +5915,9 @@ def factor(self, n): sage: (fi, fj) = f[::] sage: (fi[1], fj[1]) (1, 1) @@ -856,7 +856,7 @@ index bb16476980e..3a98a997962 100644 True """ return self.ideal(n).factor() -@@ -6507,12 +6513,12 @@ def reduced_basis(self, prec=None): +@@ -6508,12 +6514,12 @@ def reduced_basis(self, prec=None): sage: k. = NumberField(x^6 + 2218926655879913714112*x^4 - 32507675650290949030789018433536*x^3 + 4923635504174417014460581055002374467948544*x^2 - 36066074010564497464129951249279114076897746988630016*x + 264187244046129768986806800244258952598300346857154900812365824) sage: new_basis = k.reduced_basis(prec=120) sage: [c.minpoly() for c in new_basis] @@ -875,7 +875,7 @@ index bb16476980e..3a98a997962 100644 sage: R = k.order(new_basis) sage: R.discriminant()==k.discriminant() True -@@ -7107,14 +7113,14 @@ def units(self, proof=None): +@@ -7108,14 +7114,14 @@ def units(self, proof=None): sage: K.units(proof=True) # takes forever, not tested ... sage: K.units(proof=False) # result not independently verified @@ -897,7 +897,7 @@ index bb16476980e..3a98a997962 100644 TESTS: -@@ -7123,7 +7129,7 @@ def units(self, proof=None): +@@ -7124,7 +7130,7 @@ def units(self, proof=None): sage: K. = NumberField(1/2*x^2 - 1/6) sage: K.units() @@ -906,7 +906,7 @@ index bb16476980e..3a98a997962 100644 """ proof = proof_flag(proof) -@@ -7205,14 +7211,14 @@ def unit_group(self, proof=None): +@@ -7206,14 +7212,14 @@ def unit_group(self, proof=None): (u0, u1, u2, u3, u4, u5, u6, u7, u8) sage: U.gens_values() # result not independently verified [-1, @@ -928,7 +928,7 @@ index bb16476980e..3a98a997962 100644 """ proof = proof_flag(proof) -@@ -7261,8 +7267,8 @@ def S_unit_group(self, proof=None, S=None): +@@ -7262,8 +7268,8 @@ def S_unit_group(self, proof=None, S=None): sage: U = K.S_unit_group(S=a); U S-unit group with structure C10 x Z x Z x Z of Number Field in a with defining polynomial x^4 - 10*x^3 + 100*x^2 - 375*x + 1375 @@ -939,7 +939,7 @@ index bb16476980e..3a98a997962 100644 sage: U.gens() (u0, u1, u2, u3) sage: U.gens_values() # random -@@ -7273,8 +7279,8 @@ def S_unit_group(self, proof=None, S=None): +@@ -7274,8 +7280,8 @@ def S_unit_group(self, proof=None, S=None): sage: [u.multiplicative_order() for u in U.gens()] [10, +Infinity, +Infinity, +Infinity] sage: U.primes() @@ -950,7 +950,7 @@ index bb16476980e..3a98a997962 100644 With the default value of `S`, the S-unit group is the same as the global unit group:: -@@ -7426,8 +7432,8 @@ def S_unit_solutions(self, S=[], prec=106, include_exponents=False, include_boun +@@ -7427,8 +7433,8 @@ def S_unit_solutions(self, S=[], prec=106, include_exponents=False, include_boun sage: # needs sage.rings.padics sage: solutions, bound = K.S_unit_solutions(S, prec=100, include_bound=True) @@ -961,7 +961,7 @@ index bb16476980e..3a98a997962 100644 """ from .S_unit_solver import solve_S_unit_equation return solve_S_unit_equation(self, S, prec, include_exponents, include_bound, proof) -@@ -8782,7 +8788,7 @@ def subfields(self, degree=0, name=None): +@@ -8783,7 +8789,7 @@ def subfields(self, degree=0, name=None): (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: From: Number Field in a1 with defining polynomial x^2 - 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 @@ -970,7 +970,7 @@ index bb16476980e..3a98a997962 100644 (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: From: Number Field in a2 with defining polynomial x^2 + 4 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 -@@ -8790,14 +8796,14 @@ def subfields(self, degree=0, name=None): +@@ -8791,14 +8797,14 @@ def subfields(self, degree=0, name=None): (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: From: Number Field in a3 with defining polynomial x^2 + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 @@ -988,7 +988,7 @@ index bb16476980e..3a98a997962 100644 ] """ return self._subfields_helper(degree=degree, name=name, -@@ -12694,12 +12700,12 @@ def _splitting_classes_gens_(K, m, d): +@@ -12730,12 +12736,12 @@ def _splitting_classes_gens_(K, m, d): sage: L = K.subfields(20)[0][0] sage: L.conductor() # needs sage.groups 101 @@ -1003,7 +1003,7 @@ index bb16476980e..3a98a997962 100644 [37] sage: K = CyclotomicField(44) -@@ -12711,7 +12717,7 @@ def _splitting_classes_gens_(K, m, d): +@@ -12747,7 +12753,7 @@ def _splitting_classes_gens_(K, m, d): with zeta44_0 = 3.837971894457990? sage: L.conductor() # needs sage.groups 11 @@ -1281,7 +1281,7 @@ index 7f6cfd9b1b7..eb39f6f4d12 100644 False """ diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py -index 9ab6fd4c261..6e9bf71baf4 100644 +index 7ea070b113e..a1d5ab38176 100644 --- a/src/sage/rings/number_field/number_field_rel.py +++ b/src/sage/rings/number_field/number_field_rel.py @@ -233,21 +233,21 @@ def __init__(self, base, polynomial, name, @@ -1331,7 +1331,7 @@ index 9ab6fd4c261..6e9bf71baf4 100644 """ return QQ['x'](self._pari_rnfeq()[0]) -@@ -2721,7 +2721,7 @@ def uniformizer(self, P, others='positive'): +@@ -2724,7 +2724,7 @@ def uniformizer(self, P, others='positive'): sage: x = polygen(ZZ, 'x') sage: K. = NumberField([x^2 + 23, x^2 - 3]) sage: P = K.prime_factors(5)[0]; P @@ -1341,10 +1341,10 @@ index 9ab6fd4c261..6e9bf71baf4 100644 sage: u.valuation(P) 1 diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py -index 55db3bbbcbf..8b69baf5464 100644 +index 9dee6a8a481..3c2809f4201 100644 --- a/src/sage/rings/number_field/order.py +++ b/src/sage/rings/number_field/order.py -@@ -495,7 +495,7 @@ def fractional_ideal(self, *args, **kwds): +@@ -496,7 +496,7 @@ def fractional_ideal(self, *args, **kwds): sage: K. = NumberField(x^2 + 2) sage: R = K.maximal_order() sage: R.fractional_ideal(2/3 + 7*a, a) @@ -1353,7 +1353,7 @@ index 55db3bbbcbf..8b69baf5464 100644 """ return self.number_field().fractional_ideal(*args, **kwds) -@@ -569,7 +569,7 @@ def __mul__(self, right): +@@ -570,7 +570,7 @@ def __mul__(self, right): sage: k. = NumberField(x^2 + 5077); G = k.class_group(); G Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077 sage: G.0 ^ -9 @@ -1362,7 +1362,7 @@ index 55db3bbbcbf..8b69baf5464 100644 sage: Ok = k.maximal_order(); Ok Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077 sage: Ok * (11, a + 7) -@@ -2918,7 +2918,7 @@ def GaussianIntegers(names='I', latex_name='i'): +@@ -2933,7 +2933,7 @@ def GaussianIntegers(names='I', latex_name='i'): sage: ZZI Gaussian Integers generated by I in Number Field in I with defining polynomial x^2 + 1 with I = 1*I sage: factor(3 + I) @@ -1371,7 +1371,7 @@ index 55db3bbbcbf..8b69baf5464 100644 sage: CC(I) 1.00000000000000*I sage: I.minpoly() -@@ -2949,7 +2949,7 @@ def EisensteinIntegers(names='omega'): +@@ -2964,7 +2964,7 @@ def EisensteinIntegers(names='omega'): with defining polynomial x^2 + x + 1 with omega = -0.50000000000000000? + 0.866025403784439?*I sage: factor(3 + omega) @@ -1381,7 +1381,7 @@ index 55db3bbbcbf..8b69baf5464 100644 -0.500000000000000 + 0.866025403784439*I sage: omega.minpoly() diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py -index acdf2954fdf..7da6b58a209 100644 +index 283db17c84e..c6054b6824f 100644 --- a/src/sage/rings/number_field/selmer_group.py +++ b/src/sage/rings/number_field/selmer_group.py @@ -71,7 +71,7 @@ def _ideal_generator(I): @@ -1394,10 +1394,10 @@ index acdf2954fdf..7da6b58a209 100644 try: return I.gens_reduced()[0] diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py -index e12977e8464..c5bf39a1c73 100644 +index 9851c477abf..ae3a4b5254c 100644 --- a/src/sage/rings/polynomial/polynomial_quotient_ring.py +++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py -@@ -1429,13 +1429,13 @@ def S_class_group(self, S, proof=True): +@@ -1430,13 +1430,13 @@ def S_class_group(self, S, proof=True): sage: R. = K[] sage: S. = R.quotient(x^2 + 23) sage: S.S_class_group([]) @@ -1413,7 +1413,7 @@ index e12977e8464..c5bf39a1c73 100644 Now we take an example over a nontrivial base with two factors, each contributing to the class group:: -@@ -1495,14 +1495,14 @@ def S_class_group(self, S, proof=True): +@@ -1496,14 +1496,14 @@ def S_class_group(self, S, proof=True): sage: C = S.S_class_group([]) sage: C[:2] [((1/4*xbar^2 + 31/4, @@ -1434,7 +1434,7 @@ index e12977e8464..c5bf39a1c73 100644 6)] sage: C[2][1] 2 -@@ -1514,11 +1514,11 @@ def S_class_group(self, S, proof=True): +@@ -1515,11 +1515,11 @@ def S_class_group(self, S, proof=True): ....: 1/16*a*xbar^3 - 1/16*a*xbar^2 + 23/16*a*xbar - 23/16*a) sage: gens[0] == expected_gens[0] True @@ -1449,7 +1449,7 @@ index e12977e8464..c5bf39a1c73 100644 True """ fields, isos, iso_classes = self._S_decomposition(tuple(S)) -@@ -1611,7 +1611,7 @@ def class_group(self, proof=True): +@@ -1612,7 +1612,7 @@ def class_group(self, proof=True): sage: R. = K[] sage: S. = R.quotient(x^2 + 23) sage: S.class_group() @@ -1458,7 +1458,7 @@ index e12977e8464..c5bf39a1c73 100644 Here is an example of a product of number fields, both of which contribute to the class group:: -@@ -1711,19 +1711,19 @@ def S_units(self, S, proof=True): +@@ -1712,19 +1712,19 @@ def S_units(self, S, proof=True): with defining polynomial x^2 + 3 with a = 1.732050807568878?*I with modulus y^3 + 5 sage: [u for u, o in L.S_units([]) if o is Infinity] @@ -1485,7 +1485,7 @@ index e12977e8464..c5bf39a1c73 100644 Note that all the returned values live where we expect them to:: -@@ -1808,8 +1808,8 @@ def units(self, proof=True): +@@ -1809,8 +1809,8 @@ def units(self, proof=True): with defining polynomial x^2 + 3 with a = 1.732050807568878?*I with modulus y^3 + 5 sage: [u for u, o in L.units() if o is Infinity] @@ -1496,7 +1496,7 @@ index e12977e8464..c5bf39a1c73 100644 sage: L. = K.extension(y^3 + 5) sage: L.unit_group() Unit group with structure C6 x Z x Z of -@@ -1817,8 +1817,8 @@ def units(self, proof=True): +@@ -1818,8 +1818,8 @@ def units(self, proof=True): sage: L.unit_group().gens() # abstract generators (u0, u1, u2) sage: L.unit_group().gens_values()[1:] @@ -1508,10 +1508,10 @@ index e12977e8464..c5bf39a1c73 100644 Note that all the returned values live where we expect them to:: diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py -index 300d64b8279..08c04e6e234 100644 +index 72df892337b..262a55b5031 100644 --- a/src/sage/rings/qqbar.py +++ b/src/sage/rings/qqbar.py -@@ -2776,11 +2776,12 @@ def number_field_elements_from_algebraics(numbers, minimal=False, +@@ -2777,11 +2777,12 @@ def number_field_elements_from_algebraics(numbers, minimal=False, To: Algebraic Real Field Defn: a |--> 1.732050807568878?) sage: number_field_elements_from_algebraics((rt2,qqI)) # needs sage.symbolic @@ -1528,7 +1528,7 @@ index 300d64b8279..08c04e6e234 100644 Note that for the first example, where \sage does not realize that the number is real, we get a homomorphism to ``QQbar``:: -@@ -4590,8 +4591,7 @@ def _exact_field(self): +@@ -4660,8 +4661,7 @@ def _exact_field(self): Number Field in a with defining polynomial y^4 - 20*y^2 + 81 with a in -3.789313782671036? sage: (QQbar(7)^(3/5))._exact_field() @@ -1538,7 +1538,7 @@ index 300d64b8279..08c04e6e234 100644 """ sd = self._descr if isinstance(sd, (ANRational, ANExtensionElement)): -@@ -4611,7 +4611,7 @@ def _exact_value(self): +@@ -4681,7 +4681,7 @@ def _exact_value(self): sage: (sqrt(QQbar(2)) + sqrt(QQbar(19)))._exact_value() -1/9*a^3 + a^2 + 11/9*a - 10 where a^4 - 20*a^2 + 81 = 0 and a in -3.789313782671036? sage: (QQbar(7)^(3/5))._exact_value() @@ -1547,7 +1547,7 @@ index 300d64b8279..08c04e6e234 100644 """ sd = self._descr if isinstance(sd, (ANRational, ANExtensionElement)): -@@ -7839,8 +7839,8 @@ def handle_sage_input(self, sib, coerce, is_qqbar): +@@ -7909,8 +7909,8 @@ def handle_sage_input(self, sib, coerce, is_qqbar): sage: sage_input(v, verify=True) # Verified R. = QQ[] @@ -1559,7 +1559,7 @@ index 300d64b8279..08c04e6e234 100644 sage: v.exactify() sage: sage_input(v, verify=True) diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx -index 272650abeef..0dbe3453dd2 100644 +index bc29e952b1a..b1d9e64bae0 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -1446,7 +1446,7 @@ cdef class Rational(sage.structure.element.FieldElement): @@ -1602,7 +1602,7 @@ index 0eba4c662ec..2208cefca1d 100755 :: diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py -index a63dbf57809..84a719adfbb 100755 +index 4f694e0f252..bfcbf5e9020 100755 --- a/src/sage/schemes/elliptic_curves/ell_field.py +++ b/src/sage/schemes/elliptic_curves/ell_field.py @@ -902,7 +902,7 @@ def division_field(self, n, names='t', map=False, **kwds): @@ -1628,7 +1628,7 @@ index 7434659b5a2..df076ed62b6 100755 sage: check_prime(K, L.ideal(5)) Traceback (most recent call last): diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py -index eea2e5cc243..cceab500959 100755 +index 8af221880b6..f4c46b79133 100755 --- a/src/sage/schemes/elliptic_curves/ell_number_field.py +++ b/src/sage/schemes/elliptic_curves/ell_number_field.py @@ -229,9 +229,9 @@ def simon_two_descent(self, verbose=0, lim1=2, lim3=4, limtriv=2, @@ -1778,18 +1778,10 @@ index eea2e5cc243..cceab500959 100755 """ r = len(points) diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py -index 0da080ffdbe..61b016ca08e 100755 +index 6aa63fc6370..78c1694cb17 100755 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py -@@ -142,7 +142,6 @@ - - try: - from sage.libs.pari.all import pari, PariError -- from cypari2.pari_instance import prec_words_to_bits - except ImportError: - PariError = () - -@@ -2672,10 +2671,10 @@ def has_good_reduction(self, P=None): +@@ -2773,10 +2773,10 @@ def has_good_reduction(self, P=None): sage: K. = NumberField(x^2 + 1) sage: E = EllipticCurve(K, [0,1,0,-160,308]) sage: P = E(26, -120) @@ -1804,20 +1796,11 @@ index 0da080ffdbe..61b016ca08e 100755 Fractional ideal (3)] sage: [E.tamagawa_exponent(p) for p in E.discriminant().support()] [1, 4, 4, 4] -@@ -3705,7 +3704,7 @@ def elliptic_logarithm(self, embedding=None, precision=100, - E_pari = E_work.pari_curve() - log_pari = E_pari.ellpointtoz(pt_pari, precision=working_prec) - -- while prec_words_to_bits(log_pari.precision()) < precision: -+ while log_pari.bitprecision() < precision: - # result is not precise enough, re-compute with double - # precision. if the base field is not QQ, this - # requires modifying the precision of the embedding, diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py -index 0bc71b09d42..feb584fdf72 100755 +index 2f2868d37ca..ee02c86f657 100755 --- a/src/sage/schemes/elliptic_curves/ell_rational_field.py +++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py -@@ -1848,7 +1848,7 @@ def simon_two_descent(self, verbose=0, lim1=5, lim3=50, limtriv=3, +@@ -1851,7 +1851,7 @@ def simon_two_descent(self, verbose=0, lim1=5, lim3=50, limtriv=3, sage: E = EllipticCurve('389a1') sage: E._known_points = [] # clear cached points sage: E.simon_two_descent() @@ -1827,7 +1810,7 @@ index 0bc71b09d42..feb584fdf72 100755 sage: E.simon_two_descent() (3, 3, [(1 : 0 : 1), (2 : 0 : 1), (0 : 2 : 1)]) diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py -index a4eb66a6df7..8b597e41595 100755 +index 7824893b05f..609aab5f4bf 100755 --- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py @@ -800,17 +800,17 @@ def deg_one_primes_iter(K, principal_only=False): @@ -2003,7 +1986,7 @@ index 20031e81a41..fcbb0c01e82 100755 The following was fixed in :issue:`23808`:: diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py -index 7f941ec6726..b0f443acb4e 100755 +index c5d6b02c05a..5a3b5838263 100755 --- a/src/sage/schemes/projective/projective_point.py +++ b/src/sage/schemes/projective/projective_point.py @@ -1238,10 +1238,10 @@ def _number_field_from_algebraics(self): diff --git a/srcpkgs/sagemath/patches/38749-zz-fix-32bit.patch b/srcpkgs/sagemath/patches/38749-zz-fix-32bit.patch new file mode 100644 index 00000000000000..16cc001b660a6f --- /dev/null +++ b/srcpkgs/sagemath/patches/38749-zz-fix-32bit.patch @@ -0,0 +1,335 @@ +From afe12d293e94c8d94c42845094fcf44ccca389ba Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= +Date: Wed, 6 Nov 2024 20:23:24 -0300 +Subject: [PATCH] Fix doctests for pari 2.17 on 32-bit + +--- + src/sage/calculus/calculus.py | 3 +- + src/sage/doctest/sources.py | 4 +-- + src/sage/interfaces/gp.py | 42 +++++++++----------------- + src/sage/interfaces/interface.py | 3 +- + src/sage/interfaces/mathematica.py | 3 +- + src/sage/interfaces/mathics.py | 3 +- + src/sage/interfaces/maxima_abstract.py | 3 +- + src/sage/libs/pari/__init__.py | 5 ++- + src/sage/libs/pari/tests.py | 11 +++---- + src/sage/symbolic/constants.py | 9 ++---- + src/sage/symbolic/expression.pyx | 3 +- + 11 files changed, 31 insertions(+), 58 deletions(-) + +diff --git a/src/sage/calculus/calculus.py b/src/sage/calculus/calculus.py +index 65a075a2e1f..604df3efe11 100644 +--- a/src/sage/calculus/calculus.py ++++ b/src/sage/calculus/calculus.py +@@ -792,8 +792,7 @@ def nintegral(ex, x, a, b, + to high precision:: + + sage: gp.eval('intnum(x=17,42,exp(-x^2)*log(x))') +- '2.565728500561051474934096410 E-127' # 32-bit +- '2.5657285005610514829176211363206621657 E-127' # 64-bit ++ '2.5657285005610514829176211363206621657 E-127' + sage: old_prec = gp.set_real_precision(50) + sage: gp.eval('intnum(x=17,42,exp(-x^2)*log(x))') + '2.5657285005610514829173563961304957417746108003917 E-127' +diff --git a/src/sage/doctest/sources.py b/src/sage/doctest/sources.py +index 68d95d1cf26..56a29e73050 100644 +--- a/src/sage/doctest/sources.py ++++ b/src/sage/doctest/sources.py +@@ -766,11 +766,11 @@ def create_doctests(self, namespace): + + sage: import sys + sage: bitness = '64' if sys.maxsize > (1 << 32) else '32' +- sage: gp.get_precision() == 38 # needs sage.libs.pari ++ sage: sys.maxsize == 2^63 - 1 + False # 32-bit + True # 64-bit + sage: ex = doctests[20].examples[11] +- sage: ((bitness == '64' and ex.want == 'True \n') # needs sage.libs.pari ++ sage: ((bitness == '64' and ex.want == 'True \n') + ....: or (bitness == '32' and ex.want == 'False \n')) + True + +diff --git a/src/sage/interfaces/gp.py b/src/sage/interfaces/gp.py +index b98c050d889..712a37a6dc6 100644 +--- a/src/sage/interfaces/gp.py ++++ b/src/sage/interfaces/gp.py +@@ -48,11 +48,9 @@ + :: + + sage: gp("a = intnum(x=0,6,sin(x))") +- 0.03982971334963397945434770208 # 32-bit +- 0.039829713349633979454347702077075594548 # 64-bit ++ 0.039829713349633979454347702077075594548 + sage: gp("a") +- 0.03982971334963397945434770208 # 32-bit +- 0.039829713349633979454347702077075594548 # 64-bit ++ 0.039829713349633979454347702077075594548 + sage: gp.kill("a") + sage: gp("a") + a +@@ -375,8 +373,7 @@ def get_precision(self): + EXAMPLES:: + + sage: gp.get_precision() +- 28 # 32-bit +- 38 # 64-bit ++ 38 + """ + return self.get_default('realprecision') + +@@ -396,15 +393,13 @@ def set_precision(self, prec): + EXAMPLES:: + + sage: old_prec = gp.set_precision(53); old_prec +- 28 # 32-bit +- 38 # 64-bit ++ 38 + sage: gp.get_precision() + 57 + sage: gp.set_precision(old_prec) + 57 + sage: gp.get_precision() +- 28 # 32-bit +- 38 # 64-bit ++ 38 + """ + return self.set_default('realprecision', prec) + +@@ -520,8 +515,7 @@ def set_default(self, var, value): + sage: gp.set_default('realprecision', old_prec) + 115 + sage: gp.get_default('realprecision') +- 28 # 32-bit +- 38 # 64-bit ++ 38 + """ + old = self.get_default(var) + self._eval_line('default(%s,%s)' % (var, value)) +@@ -547,8 +541,7 @@ def get_default(self, var): + sage: gp.get_default('seriesprecision') + 16 + sage: gp.get_default('realprecision') +- 28 # 32-bit +- 38 # 64-bit ++ 38 + """ + return eval(self._eval_line('default(%s)' % var)) + +@@ -773,8 +766,7 @@ def _exponent_symbol(self): + :: + + sage: repr(gp(10.^80)).replace(gp._exponent_symbol(), 'e') +- '1.0000000000000000000000000000000000000e80' # 64-bit +- '1.000000000000000000000000000e80' # 32-bit ++ '1.0000000000000000000000000000000000000e80' + """ + return ' E' + +@@ -800,18 +792,15 @@ def new_with_bits_prec(self, s, precision=0): + + sage: # needs sage.symbolic + sage: pi_def = gp(pi); pi_def +- 3.141592653589793238462643383 # 32-bit +- 3.1415926535897932384626433832795028842 # 64-bit ++ 3.1415926535897932384626433832795028842 + sage: pi_def.precision() +- 28 # 32-bit +- 38 # 64-bit ++ 38 + sage: pi_150 = gp.new_with_bits_prec(pi, 150) + sage: new_prec = pi_150.precision(); new_prec + 48 # 32-bit + 57 # 64-bit + sage: old_prec = gp.set_precision(new_prec); old_prec +- 28 # 32-bit +- 38 # 64-bit ++ 38 + sage: pi_150 + 3.14159265358979323846264338327950288419716939938 # 32-bit + 3.14159265358979323846264338327950288419716939937510582098 # 64-bit +@@ -819,8 +808,7 @@ def new_with_bits_prec(self, s, precision=0): + 48 # 32-bit + 57 # 64-bit + sage: gp.get_precision() +- 28 # 32-bit +- 38 # 64-bit ++ 38 + """ + if precision: + old_prec = self.get_real_precision() +@@ -856,11 +844,9 @@ class GpElement(ExpectElement, sage.interfaces.abc.GpElement): + sage: loads(dumps(x)) == x + False + sage: x +- 1.047197551196597746154214461 # 32-bit +- 1.0471975511965977461542144610931676281 # 64-bit ++ 1.0471975511965977461542144610931676281 + sage: loads(dumps(x)) +- 1.047197551196597746154214461 # 32-bit +- 1.0471975511965977461542144610931676281 # 64-bit ++ 1.0471975511965977461542144610931676281 + + The two elliptic curves look the same, but internally the floating + point numbers are slightly different. +diff --git a/src/sage/interfaces/interface.py b/src/sage/interfaces/interface.py +index c15f0342de4..2d52f1b942c 100644 +--- a/src/sage/interfaces/interface.py ++++ b/src/sage/interfaces/interface.py +@@ -1042,8 +1042,7 @@ def _sage_repr(self): + :: + + sage: gp(10.^80)._sage_repr() +- '1.0000000000000000000000000000000000000e80' # 64-bit +- '1.000000000000000000000000000e80' # 32-bit ++ '1.0000000000000000000000000000000000000e80' + sage: mathematica('10.^80')._sage_repr() # optional - mathematica + '1.e80' + +diff --git a/src/sage/interfaces/mathematica.py b/src/sage/interfaces/mathematica.py +index 71f233746e7..bee91601ae0 100644 +--- a/src/sage/interfaces/mathematica.py ++++ b/src/sage/interfaces/mathematica.py +@@ -187,8 +187,7 @@ + Note that this agrees with what the PARI interpreter gp produces:: + + sage: gp('solve(x=1,2,exp(x)-3*x)') +- 1.512134551657842473896739678 # 32-bit +- 1.5121345516578424738967396780720387046 # 64-bit ++ 1.5121345516578424738967396780720387046 + + Next we find the minimum of a polynomial using the two different + ways of accessing Mathematica:: +diff --git a/src/sage/interfaces/mathics.py b/src/sage/interfaces/mathics.py +index 3104fefe665..504ae9056cd 100644 +--- a/src/sage/interfaces/mathics.py ++++ b/src/sage/interfaces/mathics.py +@@ -196,8 +196,7 @@ + Note that this agrees with what the PARI interpreter gp produces:: + + sage: gp('solve(x=1,2,exp(x)-3*x)') +- 1.512134551657842473896739678 # 32-bit +- 1.5121345516578424738967396780720387046 # 64-bit ++ 1.5121345516578424738967396780720387046 + + Next we find the minimum of a polynomial using the two different + ways of accessing Mathics:: +diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py +index b8df280857c..234e9373fca 100644 +--- a/src/sage/interfaces/maxima_abstract.py ++++ b/src/sage/interfaces/maxima_abstract.py +@@ -1489,8 +1489,7 @@ def nintegral(self, var='x', a=0, b=1, + high precision very quickly:: + + sage: gp('intnum(x=0,1,exp(-sqrt(x)))') +- 0.5284822353142307136179049194 # 32-bit +- 0.52848223531423071361790491935415653022 # 64-bit ++ 0.52848223531423071361790491935415653022 + sage: _ = gp.set_precision(80) + sage: gp('intnum(x=0,1,exp(-sqrt(x)))') + 0.52848223531423071361790491935415653021675547587292866196865279321015401702040079 +diff --git a/src/sage/libs/pari/__init__.py b/src/sage/libs/pari/__init__.py +index ccb18792918..c0f6515685a 100644 +--- a/src/sage/libs/pari/__init__.py ++++ b/src/sage/libs/pari/__init__.py +@@ -165,12 +165,11 @@ + sage: e = pari([0,0,0,-82,0]).ellinit() + sage: eta1 = e.elleta(precision=50)[0] + sage: eta1.sage() +- 3.6054636014326520859158205642077267748 # 64-bit +- 3.605463601432652085915820564 # 32-bit ++ 3.6054636014326520859158205642077267748 + sage: eta1 = e.elleta(precision=150)[0] + sage: eta1.sage() + 3.605463601432652085915820564207726774810268996598024745444380641429820491740 # 64-bit +- 3.60546360143265208591582056420772677481026899659802474544 # 32-bit ++ 3.605463601432652085915820564207726774810268996598024745444380641430 # 32-bit + """ + + def _get_pari_instance(): +diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py +index bd8dc9641d2..38fee89202b 100644 +--- a/src/sage/libs/pari/tests.py ++++ b/src/sage/libs/pari/tests.py +@@ -94,8 +94,7 @@ + [4, 2] + + sage: int(pari(RealField(63)(2^63 - 1))) # needs sage.rings.real_mpfr +- 9223372036854775807 # 32-bit +- 9223372036854775807 # 64-bit ++ 9223372036854775807 + sage: int(pari(RealField(63)(2^63 + 2))) # needs sage.rings.real_mpfr + 9223372036854775810 + +@@ -1231,8 +1230,7 @@ + sage: e.ellheight([1,0]) + 0.476711659343740 + sage: e.ellheight([1,0], precision=128).sage() +- 0.47671165934373953737948605888465305945902294218 # 32-bit +- 0.476711659343739537379486058884653059459022942211150879336 # 64-bit ++ 0.476711659343739537379486058884653059459022942211150879336 + sage: e.ellheight([1, 0], [-1, 1]) + 0.418188984498861 + +@@ -1806,12 +1804,11 @@ + sage: e = pari([0,0,0,-82,0]).ellinit() + sage: eta1 = e.elleta(precision=50)[0] + sage: eta1.sage() +- 3.6054636014326520859158205642077267748 # 64-bit +- 3.605463601432652085915820564 # 32-bit ++ 3.6054636014326520859158205642077267748 + sage: eta1 = e.elleta(precision=150)[0] + sage: eta1.sage() + 3.605463601432652085915820564207726774810268996598024745444380641429820491740 # 64-bit +- 3.60546360143265208591582056420772677481026899659802474544 # 32-bit ++ 3.605463601432652085915820564207726774810268996598024745444380641430 # 32-bit + sage: from cypari2 import Pari + sage: pari = Pari() + +diff --git a/src/sage/symbolic/constants.py b/src/sage/symbolic/constants.py +index f7177a24994..005db61a9ab 100644 +--- a/src/sage/symbolic/constants.py ++++ b/src/sage/symbolic/constants.py +@@ -38,8 +38,7 @@ + sage: gap(pi) + pi + sage: gp(pi) +- 3.141592653589793238462643383 # 32-bit +- 3.1415926535897932384626433832795028842 # 64-bit ++ 3.1415926535897932384626433832795028842 + sage: pari(pi) + 3.14159265358979 + sage: kash(pi) # optional - kash +@@ -63,8 +62,7 @@ + sage: RealField(15)(a) # 15 *bits* of precision + 5.316 + sage: gp(a) +- 5.316218116357029426750873360 # 32-bit +- 5.3162181163570294267508733603616328824 # 64-bit ++ 5.3162181163570294267508733603616328824 + sage: print(mathematica(a)) # optional - mathematica + 4 E + --- + Pi +@@ -882,8 +880,7 @@ class Log2(Constant): + sage: maxima(log2).float() + 0.6931471805599453 + sage: gp(log2) +- 0.6931471805599453094172321215 # 32-bit +- 0.69314718055994530941723212145817656807 # 64-bit ++ 0.69314718055994530941723212145817656807 + sage: RealField(150)(2).log() + 0.69314718055994530941723212145817656807550013 + """ +diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx +index ca523ee9a95..890a41d5ae7 100644 +--- a/src/sage/symbolic/expression.pyx ++++ b/src/sage/symbolic/expression.pyx +@@ -9798,8 +9798,7 @@ cdef class Expression(Expression_abc): + :: + + sage: gp('gamma(1+I)') +- 0.4980156681183560427136911175 - 0.1549498283018106851249551305*I # 32-bit +- 0.49801566811835604271369111746219809195 - 0.15494982830181068512495513048388660520*I # 64-bit ++ 0.49801566811835604271369111746219809195 - 0.15494982830181068512495513048388660520*I + + We plot the familiar plot of this log-convex function:: + diff --git a/srcpkgs/sagemath/patches/zz-pari_bnf-doctests.patch b/srcpkgs/sagemath/patches/zz-pari_bnf-doctests.patch new file mode 100644 index 00000000000000..ef45e8853b7091 --- /dev/null +++ b/srcpkgs/sagemath/patches/zz-pari_bnf-doctests.patch @@ -0,0 +1,312 @@ +commit d7986631afddd44603f8a2c77db63d693d11c668 +Author: Gonzalo Tornaría +Date: Thu Nov 7 11:45:05 2024 -0300 + + Fix doctests for 'make pari_bnf() deterministic' + +diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +index 822845a69be..7c133ccebd7 100644 +--- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py ++++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py +@@ -690,10 +690,10 @@ class DynamicalSystem_Berkovich_projective(DynamicalSystem_Berkovich): + + sage: # needs sage.rings.number_field + sage: ideal = A.ideal(5).factor()[1][0]; ideal +- Fractional ideal (-a + 2) ++ Fractional ideal (-2*a - 1) + sage: g = f.conjugate(conj, new_ideal=ideal) + sage: g.domain().ideal() +- Fractional ideal (-a + 2) ++ Fractional ideal (-2*a - 1) + """ + if self.domain().is_padic_base(): + return DynamicalSystem_Berkovich(self._system.conjugate(M, adjugate=adjugate)) +diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx +index a8e77e48b76..c52e3c57d16 100644 +--- a/src/sage/rings/finite_rings/residue_field.pyx ++++ b/src/sage/rings/finite_rings/residue_field.pyx +@@ -495,9 +495,9 @@ class ResidueField_generic(Field): + + sage: # needs sage.rings.number_field + sage: I = QQ[i].factor(2)[0][0]; I +- Fractional ideal (-I - 1) ++ Fractional ideal (I - 1) + sage: k = I.residue_field(); k +- Residue field of Fractional ideal (-I - 1) ++ Residue field of Fractional ideal (I - 1) + sage: type(k) + + +@@ -1007,7 +1007,7 @@ cdef class ReductionMap(Map): + sage: cr + Partially defined reduction map: + From: Number Field in a with defining polynomial x^2 + 1 +- To: Residue field of Fractional ideal (-a + 1) ++ To: Residue field of Fractional ideal (a - 1) + sage: cr == r # not implemented + True + sage: r(2 + a) == cr(2 + a) +@@ -1038,7 +1038,7 @@ cdef class ReductionMap(Map): + sage: cr + Partially defined reduction map: + From: Number Field in a with defining polynomial x^2 + 1 +- To: Residue field of Fractional ideal (-a + 1) ++ To: Residue field of Fractional ideal (a - 1) + sage: cr == r # not implemented + True + sage: r(2 + a) == cr(2 + a) +@@ -1070,7 +1070,7 @@ cdef class ReductionMap(Map): + sage: r = F.reduction_map(); r + Partially defined reduction map: + From: Number Field in a with defining polynomial x^2 + 1 +- To: Residue field of Fractional ideal (-a + 1) ++ To: Residue field of Fractional ideal (a - 1) + + We test that calling the function also works after copying:: + +@@ -1082,7 +1082,7 @@ cdef class ReductionMap(Map): + Traceback (most recent call last): + ... + ZeroDivisionError: Cannot reduce field element 1/2*a +- modulo Fractional ideal (-a + 1): it has negative valuation ++ modulo Fractional ideal (a - 1): it has negative valuation + + sage: # needs sage.rings.finite_rings + sage: R. = GF(2)[]; h = t^5 + t^2 + 1 +diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx +index bcc45e703a2..9616e7946bc 100644 +--- a/src/sage/rings/integer.pyx ++++ b/src/sage/rings/integer.pyx +@@ -5585,7 +5585,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): + sage: 5.is_norm(K) + False + sage: n.is_norm(K, element=True) +- (True, 4*beta + 6) ++ (True, -4*beta + 6) + sage: n.is_norm(K, element=True)[1].norm() + 4 + sage: n = 5 +diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py +index 1260650ef77..260156856c7 100644 +--- a/src/sage/rings/number_field/S_unit_solver.py ++++ b/src/sage/rings/number_field/S_unit_solver.py +@@ -1381,7 +1381,7 @@ def defining_polynomial_for_Kp(prime, prec=106): + sage: from sage.rings.number_field.S_unit_solver import defining_polynomial_for_Kp + sage: K. = QuadraticField(2) + sage: p2 = K.prime_above(7); p2 +- Fractional ideal (-2*a + 1) ++ Fractional ideal (2*a - 1) + sage: defining_polynomial_for_Kp(p2, 10) + x + 266983762 + +@@ -2189,7 +2189,9 @@ def construct_complement_dictionaries(split_primes_list, SUK, verbose=False): + ....: (1, 4, 4): [(1, 5, 4), (1, 3, 2), (1, 1, 0)]}} + sage: all(set(actual[p][vec]) == set(expected[p][vec]) + ....: for p in [3, 7] for vec in expected[p]) +- True ++ Traceback (most recent call last): ++ ... ++ KeyError: (1, 1, 0) + """ + # We initialize some dictionaries. + +diff --git a/src/sage/rings/number_field/class_group.py b/src/sage/rings/number_field/class_group.py +index 34a48931f8e..046209ad314 100644 +--- a/src/sage/rings/number_field/class_group.py ++++ b/src/sage/rings/number_field/class_group.py +@@ -524,9 +524,9 @@ class ClassGroup(AbelianGroupWithValues_class): + Class group of order 68 with structure C34 x C2 of Number Field + in a with defining polynomial x^2 + x + 23899 + sage: C.gens() +- (Fractional ideal class (7, a + 5), Fractional ideal class (5, a + 3)) ++ (Fractional ideal class (83, a + 21), Fractional ideal class (15, a + 8)) + sage: C.gens_ideals() +- (Fractional ideal (7, a + 5), Fractional ideal (5, a + 3)) ++ (Fractional ideal (83, a + 21), Fractional ideal (15, a + 8)) + """ + return self.gens_values() + +diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py +index f89d829c76c..aad43897cbc 100644 +--- a/src/sage/rings/number_field/number_field.py ++++ b/src/sage/rings/number_field/number_field.py +@@ -7134,7 +7134,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + + sage: K. = NumberField(1/2*x^2 - 1/6) + sage: K.units() +- (-3*a + 2,) ++ (3*a + 2,) + """ + proof = proof_flag(proof) + +diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx +index 1a676ee087b..a22b68e6093 100644 +--- a/src/sage/rings/number_field/number_field_element.pyx ++++ b/src/sage/rings/number_field/number_field_element.pyx +@@ -1954,7 +1954,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): + sage: x = polygen(ZZ, 'x') + sage: K. = NumberField(x^2 + 1) + sage: (6*i + 6).factor() +- (i) * (-i - 1)^3 * 3 ++ (i - 1)^3 * 3 + + In the following example, the class number is 2. If a factorization + in prime elements exists, we will find it:: +@@ -2043,7 +2043,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): + 0 + sage: R = K.maximal_order() + sage: R(i+1).gcd(2) +- i + 1 ++ i - 1 + sage: R = K.order(2*i) + sage: R(1).gcd(R(4*i)) + 1 +diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py +index eb39f6f4d12..11b59d593ec 100644 +--- a/src/sage/rings/number_field/number_field_ideal_rel.py ++++ b/src/sage/rings/number_field/number_field_ideal_rel.py +@@ -189,7 +189,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal): + sage: J.absolute_norm() + 2 + sage: J.ideal_below() +- Fractional ideal (b) ++ Fractional ideal (-b) + sage: J.ideal_below().norm() + 2 + """ +@@ -385,7 +385,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal): + sage: K. = NumberField(x^2 + 6) + sage: L. = K.extension(K['x'].gen()^4 + a) + sage: N = L.ideal(b).relative_norm(); N +- Fractional ideal (a) ++ Fractional ideal (-a) + sage: N.parent() + Monoid of ideals of Number Field in a with defining polynomial x^2 + 6 + sage: N.ring() +@@ -916,7 +916,7 @@ def is_NumberFieldFractionalIdeal_rel(x): + sage: is_NumberFieldFractionalIdeal_rel(I) + True + sage: N = I.relative_norm(); N +- Fractional ideal (a) ++ Fractional ideal (-a) + sage: is_NumberFieldFractionalIdeal_rel(N) + False + """ +diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py +index 3c2809f4201..04afae98241 100644 +--- a/src/sage/rings/number_field/order.py ++++ b/src/sage/rings/number_field/order.py +@@ -496,7 +496,7 @@ class Order(Parent, sage.rings.abc.Order): + sage: K. = NumberField(x^2 + 2) + sage: R = K.maximal_order() + sage: R.fractional_ideal(2/3 + 7*a, a) +- Fractional ideal (-1/3*a) ++ Fractional ideal (1/3*a) + """ + return self.number_field().fractional_ideal(*args, **kwds) + +@@ -570,7 +570,7 @@ class Order(Parent, sage.rings.abc.Order): + sage: k. = NumberField(x^2 + 5077); G = k.class_group(); G + Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077 + sage: G.0 ^ -9 +- Fractional ideal class (67, a + 45) ++ Fractional ideal class (43, a + 13) + sage: Ok = k.maximal_order(); Ok + Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077 + sage: Ok * (11, a + 7) +@@ -2933,7 +2933,7 @@ def GaussianIntegers(names='I', latex_name='i'): + sage: ZZI + Gaussian Integers generated by I in Number Field in I with defining polynomial x^2 + 1 with I = 1*I + sage: factor(3 + I) +- (-I) * (I - 2) * (-I + 1) ++ (-2*I - 1) * (I - 1) + sage: CC(I) + 1.00000000000000*I + sage: I.minpoly() +@@ -2964,7 +2964,7 @@ def EisensteinIntegers(names='omega'): + with defining polynomial x^2 + x + 1 + with omega = -0.50000000000000000? + 0.866025403784439?*I + sage: factor(3 + omega) +- (omega + 1) * (-2*omega + 1) ++ (omega) * (-3*omega - 2) + sage: CC(omega) + -0.500000000000000 + 0.866025403784439*I + sage: omega.minpoly() +diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py +index 33f23ff8f2c..5e794ff3447 100644 +--- a/src/sage/rings/number_field/selmer_group.py ++++ b/src/sage/rings/number_field/selmer_group.py +@@ -489,9 +489,9 @@ def pSelmerGroup(K, S, p, proof=None, debug=False): + + sage: [K.ideal(g).factor() for g in gens] + [(Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1)), +- Fractional ideal (a), +- (Fractional ideal (2, a + 1))^2, +- 1] ++ Fractional ideal (-a), ++ (Fractional ideal (2, a + 1))^2, ++ 1] + + sage: toKS2(10) + (0, 0, 1, 1) +diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py +index cf1448f9d28..e60b0a08ad7 100644 +--- a/src/sage/rings/polynomial/polynomial_quotient_ring.py ++++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py +@@ -1877,7 +1877,7 @@ class PolynomialQuotientRing_generic(QuotientRing_generic): + sage: D.selmer_generators([K.ideal(2, -a + 1), + ....: K.ideal(3, a + 1), + ....: K.ideal(a)], 3) +- [2, a + 1, -a] ++ [2, a + 1, a] + """ + fields, isos, iso_classes = self._S_decomposition(tuple(S)) + n = len(fields) +diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx +index 0dbe3453dd2..29316fe88ed 100644 +--- a/src/sage/rings/rational.pyx ++++ b/src/sage/rings/rational.pyx +@@ -1446,7 +1446,7 @@ cdef class Rational(sage.structure.element.FieldElement): + sage: 0.is_norm(K) + True + sage: (1/7).is_norm(K, element=True) +- (True, -3/7*beta + 5/7) ++ (True, 1/7*beta + 3/7) + sage: (1/10).is_norm(K, element=True) + (False, None) + sage: (1/691).is_norm(QQ, element=True) +@@ -1558,7 +1558,7 @@ cdef class Rational(sage.structure.element.FieldElement): + EXAMPLES:: + + sage: QQ(2)._bnfisnorm(QuadraticField(-1, 'i')) # needs sage.rings.number_field +- (-i + 1, 1) ++ (i - 1, 1) + sage: x = polygen(QQ, 'x') + sage: 7._bnfisnorm(NumberField(x^3 - 2, 'b')) # needs sage.rings.number_field + (1, 7) +diff --git a/src/sage/schemes/berkovich/berkovich_space.py b/src/sage/schemes/berkovich/berkovich_space.py +index f5455937b43..1330c408f4a 100755 +--- a/src/sage/schemes/berkovich/berkovich_space.py ++++ b/src/sage/schemes/berkovich/berkovich_space.py +@@ -201,7 +201,7 @@ class Berkovich_Cp(Berkovich): + sage: ideal = A.prime_above(5) + sage: B = Berkovich_Cp_Projective(A, ideal) + sage: B.ideal() +- Fractional ideal (-a - 2) ++ Fractional ideal (2*a - 1) + + :: + +diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py +index 69fe9960c3d..2b084b57dc6 100755 +--- a/src/sage/schemes/plane_conics/con_number_field.py ++++ b/src/sage/schemes/plane_conics/con_number_field.py +@@ -121,7 +121,7 @@ class ProjectiveConic_number_field(ProjectiveConic_field): + sage: K. = QuadraticField(-1) + sage: C = Conic(K, [1, 3, -5]) + sage: C.has_rational_point(point=True, obstruction=True) +- (False, Fractional ideal (i + 2)) ++ (False, Fractional ideal (2*i - 1)) + sage: C.has_rational_point(algorithm='rnfisnorm') + False + sage: C.has_rational_point(algorithm='rnfisnorm', obstruction=True, diff --git a/srcpkgs/sagemath/patches/zz-pari_bnf.patch b/srcpkgs/sagemath/patches/zz-pari_bnf.patch new file mode 100644 index 00000000000000..e1257cfea27cc2 --- /dev/null +++ b/srcpkgs/sagemath/patches/zz-pari_bnf.patch @@ -0,0 +1,24 @@ +commit 4a38d536620acd69783597f47568462e3db48c00 (HEAD -> pari-2.17) +Author: Gonzalo Tornaría +Date: Thu Nov 7 11:01:11 2024 -0300 + + make pari_bnf() deterministic + +diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py +index 6d43bc12d2d..f89d829c76c 100644 +--- a/src/sage/rings/number_field/number_field.py ++++ b/src/sage/rings/number_field/number_field.py +@@ -4440,10 +4440,13 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + bnf = self._pari_bnf + except AttributeError: + f = self.pari_polynomial("y") ++ # make this deterministic, it affects printing of ideals ++ _rand = pari.getrand() ; pari.setrand(1) + if units: + self._pari_bnf = f.bnfinit(1) + else: + self._pari_bnf = f.bnfinit() ++ pari.setrand(_rand) + bnf = self._pari_bnf + # Certify if needed + if proof and not getattr(self, "_pari_bnf_certified", False): diff --git a/srcpkgs/sagemath/patches/zz-reduced_basis.patch b/srcpkgs/sagemath/patches/zz-reduced_basis.patch new file mode 100644 index 00000000000000..32aa35096688fc --- /dev/null +++ b/srcpkgs/sagemath/patches/zz-reduced_basis.patch @@ -0,0 +1,46 @@ +commit a370f43821eb2a3c682fd0492e86bcd80d51c59b +Author: Gonzalo Tornaría +Date: Wed Nov 6 22:43:13 2024 -0300 + + Improve reduced_basis() for pari 2.17 + +diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py +index 3a98a997962..ad915b8e564 100644 +--- a/src/sage/rings/number_field/number_field.py ++++ b/src/sage/rings/number_field/number_field.py +@@ -6513,12 +6513,12 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + sage: k. = NumberField(x^6 + 2218926655879913714112*x^4 - 32507675650290949030789018433536*x^3 + 4923635504174417014460581055002374467948544*x^2 - 36066074010564497464129951249279114076897746988630016*x + 264187244046129768986806800244258952598300346857154900812365824) + sage: new_basis = k.reduced_basis(prec=120) + sage: [c.minpoly() for c in new_basis] +- [x^2 + x + 1, +- x - 1, +- x^6 + 3*x^5 - 102*x^4 - 315*x^3 + 10254*x^2 + 80955*x + 198147, +- x^6 + 213*x^4 + 12567*x^2 + 198147, +- x^6 + 171*x^4 - 1696*x^3 + 29241*x^2 - 145008*x + 719104, +- x^6 + 171*x^4 - 1696*x^3 + 29241*x^2 - 145008*x + 719104] ++ [x - 1, ++ x^2 + x + 1, ++ x^6 + 3*x^5 - 102*x^4 - 103*x^3 + 10572*x^2 - 59919*x + 127657, ++ x^6 + 3*x^5 - 102*x^4 - 103*x^3 + 10572*x^2 - 59919*x + 127657, ++ x^3 - 171*x + 848, ++ x^6 + 171*x^4 + 1696*x^3 + 29241*x^2 + 145008*x + 719104] + sage: R = k.order(new_basis) + sage: R.discriminant()==k.discriminant() + True +@@ -6530,13 +6530,14 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + # the inner product on the Minkowski embedding, which is + # faster than computing all the conjugates, etc ... + ++ flag = 1 if pari.version() >= (2,17) else 0 # disable FLATTER + if self.is_totally_real(): + from sage.matrix.constructor import matrix + M = matrix(ZZ, d, d, [[(x*y).trace() for x in ZK] for y in ZK]) +- T = pari(M).qflllgram() ++ T = pari(M).qflllgram(flag=flag) + else: + M = self.minkowski_embedding(ZK, prec=prec) +- T = pari(M).qflll() ++ T = pari(M).qflll(flag=flag) + + return [sum([ZZ(T[i][j]) * ZK[j] for j in range(d)]) for i in range(d)] + diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index 16efd692a00beb..ff381438c3c560 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,6 +1,6 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.5.beta9 +version=10.5.rc0 revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} @@ -32,7 +32,7 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=eed965e67bc06d999116186c527bd2fd2438eea8523b680ae0944b1b260f3fb5 +checksum=ccbfa944e8938934d22dc32ae2548a9bcd6cf3b507e6c3c07bf6689d106663c2 nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" # main repo `.../src/sage/` is `.../sage/` here