Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] Sagemath
@ 2023-02-02 22:54 tornaria
  2023-02-02 23:07 ` sagemath: rebuild for dep updates and fixes tornaria
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: tornaria @ 2023-02-02 22:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]

There is a new pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

Sagemath
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 14819 bytes --]

From 4950a4b1af717fd7889fb615437397fdc50d0144 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From 9a3c730c67b4c30c3ec470c66b7129281ae0ead2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fix an edge case of python 3.11 integer conversion on 32 bit
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch | 75 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       | 76 +++++++++++++++++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch | 65 ++++++++++++++++
 .../zz-fix_edge_case_of_integer_check.patch   | 38 ++++++++++
 srcpkgs/sagemath/template                     |  2 +-
 srcpkgs/sagemath/update                       |  2 +
 6 files changed, 257 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..2bbced6290e0 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
@ 2023-02-02 23:07 ` tornaria
  2023-02-02 23:16 ` [PR PATCH] [Updated] " tornaria
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-02 23:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1414491864

Comment:
I'm doing system testing of this PR together with #40222, #41210, #41572, #41972, #41973, #42016, #42043, #42044.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
  2023-02-02 23:07 ` sagemath: rebuild for dep updates and fixes tornaria
@ 2023-02-02 23:16 ` tornaria
  2023-02-03  1:29 ` tornaria
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-02 23:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 15451 bytes --]

From 4950a4b1af717fd7889fb615437397fdc50d0144 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From 679fc510689f744a977ecb3c9a761f456684beb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fix an edge case of python 3.11 integer conversion on 32 bit
 - tarball was moved; sha256 changed only b/c of main dirname change
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch | 75 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       | 76 +++++++++++++++++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch | 65 ++++++++++++++++
 .../zz-fix_edge_case_of_integer_check.patch   | 38 ++++++++++
 srcpkgs/sagemath/template                     |  6 +-
 srcpkgs/sagemath/update                       |  2 +
 6 files changed, 259 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..c5af07ee73a9 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -31,8 +31,8 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+distfiles="https://github.com/sagemath/sage-archive-2023-02-01/archive/refs/tags/$version.tar.gz"
+checksum=7c09f0ab84fa44380146cf1305b9c0e8ec7aea86d975259ca264be6798202bde
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
  2023-02-02 23:07 ` sagemath: rebuild for dep updates and fixes tornaria
  2023-02-02 23:16 ` [PR PATCH] [Updated] " tornaria
@ 2023-02-03  1:29 ` tornaria
  2023-02-03  1:33 ` [PR PATCH] [Updated] " tornaria
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-03  1:29 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1414588622

Comment:
So `x86_64` (both glibc and musl) failed with this:
```
sage -t --warn-long 30.0 --random-seed=0 /builddir/sagemath-9.7/pkgs/sagemath-standard/build/lib.linux-x86_64-cpython-311/sage/interfaces/expect.py
**********************************************************************
File "/builddir/sagemath-9.7/pkgs/sagemath-standard/build/lib.linux-x86_64-cpython-311/sage/interfaces/expect.py", line 937, in sage.interfaces.expect.Expect._eval_line
Failed example:
    singular.interrupt()
Expected:
    True
Got:
    False
**********************************************************************
File "/builddir/sagemath-9.7/pkgs/sagemath-standard/build/lib.linux-x86_64-cpython-311/sage/interfaces/expect.py", line 943, in sage.interfaces.expect.Expect._eval_line
Failed example:
    singular('2+3')
Expected:
    Singular crashed -- automatically restarting.
    5
Got:
    5
**********************************************************************
1 item had failures:
   2 of  16 in sage.interfaces.expect.Expect._eval_line
    [101 tests, 2 failures, 23.40 s]
```

It has already happened before (https://github.com/void-linux/void-packages/pull/39876#issuecomment-1274649461, https://github.com/void-linux/void-packages/pull/41085#issuecomment-1351712588).

This was already known upstream (https://trac.sagemath.org/ticket/33907) and it turns out I already fixed this (it's even merged upstream for 9.8!) but I forgot. This only happens under very heavy load (as here in CI, but not in my box even if I run 16 threads on 8 cores, it has to be way more loaded to trigger)

I'll push a new PR with the patch from https://git.sagemath.org/sage.git/commit?id=6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.

Meanwhile my local tests with all the above PR together are successful.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (2 preceding siblings ...)
  2023-02-03  1:29 ` tornaria
@ 2023-02-03  1:33 ` tornaria
  2023-02-03 23:42 ` tornaria
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-03  1:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 19712 bytes --]

From 4950a4b1af717fd7889fb615437397fdc50d0144 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From 164216e23eb34a4f116daa6d3114008770d00c97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fix an edge case of python 3.11 integer conversion on 32 bit
 - fix singular interface bug that triggers under very heavy load (e.g. on CI)
 - tarball was moved; sha256 changed only b/c of main dirname change
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch |  75 +++++++++++++
 ...1c2fc8bcfb5e6555716d05ce70511795ffa1.patch | 106 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       |  76 +++++++++++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch |  65 +++++++++++
 .../zz-fix_edge_case_of_integer_check.patch   |  38 +++++++
 srcpkgs/sagemath/template                     |   6 +-
 srcpkgs/sagemath/update                       |   2 +
 7 files changed, 365 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
new file mode 100644
index 000000000000..3db3bb94cdcf
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
@@ -0,0 +1,106 @@
+From 6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Fri, 16 Dec 2022 15:25:38 -0300
+Subject: Trac 33907: fix singular interface
+
+This essentially reverts 85f65bf and a10d19d from trac #31846.
+It turns out this was originaly written for #30945, but that issue was
+fixed by upgrading cysignals.
+
+Singular really needs a custom `_send_interrupt()` method, because the
+default one will quit singular. Moreover, this handles two quirks of
+singular:
+
+ - a small delay before sending `chr(3)` works around a bug in singular.
+ - sometimes one needs to send `;` a few times after interrupt to get
+   back a prompt.
+
+The original author of the custom `_send_interrupt()` is Jeroen Demeyer
+in commit 17d23e9 (trac #10476). I changed the timeout for a smaller
+one, and rewrote the doctest to call `interrupt()` explicitly instead of
+using `alarm()` which introduces more noise.
+---
+ src/sage/interfaces/expect.py   |  1 -
+ src/sage/interfaces/singular.py | 47 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py
+index c4dc2d4..eb25daf 100644
+--- a/src/sage/interfaces/expect.py
++++ b/src/sage/interfaces/expect.py
+@@ -941,7 +941,6 @@ If this all works, you can then make calls like:
+         The interface still works after this interrupt::
+ 
+             sage: singular('2+3')
+-            Singular crashed -- automatically restarting.
+             5
+ 
+         Last, we demonstrate that by default the execution of a command
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 9c9586d..2c377f0 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -341,6 +341,7 @@ import re
+ import sys
+ import pexpect
+ import shlex
++import time
+ 
+ from .expect import Expect, ExpectElement, FunctionElement, ExpectFunction
+ 
+@@ -508,6 +509,52 @@ class Singular(ExtraTabCompletion, Expect):
+         """
+         return 'quit;'
+ 
++    def _send_interrupt(self):
++        """
++        Send an interrupt to Singular. If needed, additional
++        semi-colons are sent until we get back at the prompt.
++
++        TESTS:
++
++        The following works without restarting Singular::
++
++            sage: a = singular(1)
++            sage: _ = singular._expect.sendline('while(1){};')
++            sage: singular.interrupt()
++            True
++
++        We can still access a::
++
++            sage: 2*a
++            2
++
++        Interrupting nothing or unfinished input also works::
++
++            sage: singular.interrupt()
++            True
++            sage: _ = singular._expect.sendline('1+')
++            sage: singular.interrupt()
++            True
++            sage: 3*a
++            3
++
++        """
++        # Work around for Singular bug
++        # http://www.singular.uni-kl.de:8002/trac/ticket/727
++        time.sleep(0.1)
++
++        E = self._expect
++        E.sendline(chr(3))
++        # The following is needed so interrupt() works even when
++        # there is no computation going on.
++        for i in range(5):
++            try:
++                E.expect_upto(self._prompt, timeout=0.1)
++                return
++            except pexpect.TIMEOUT:
++                pass
++            E.sendline(";")
++
+     def _read_in_file_command(self, filename):
+         r"""
+         EXAMPLES::
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..c5af07ee73a9 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -31,8 +31,8 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+distfiles="https://github.com/sagemath/sage-archive-2023-02-01/archive/refs/tags/$version.tar.gz"
+checksum=7c09f0ab84fa44380146cf1305b9c0e8ec7aea86d975259ca264be6798202bde
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (3 preceding siblings ...)
  2023-02-03  1:33 ` [PR PATCH] [Updated] " tornaria
@ 2023-02-03 23:42 ` tornaria
  2023-02-04  1:04 ` tornaria
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-03 23:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 38281 bytes --]

From 33b8879b835e47ae87068ea47ae3b1ec94fc9668 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From d8a48a5510dd138d43f00462a25a797364fe78bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fixes to doctest failures in 32 bit after upgrade of pari to 2.15.2
 - fix an edge case of python 3.11 integer conversion on 32 bit
 - fix singular interface bug that triggers under very heavy load (e.g. on CI)
 - tarball was moved; sha256 changed only b/c of main dirname change
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch |  75 ++++
 ...1c2fc8bcfb5e6555716d05ce70511795ffa1.patch | 106 +++++
 .../trac-34537-sagemath-pari-2.15c.patch      | 372 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       |  76 ++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch |  65 +++
 .../zz-fix_edge_case_of_integer_check.patch   |  38 ++
 srcpkgs/sagemath/template                     |   6 +-
 srcpkgs/sagemath/update                       |   2 +
 8 files changed, 737 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
new file mode 100644
index 000000000000..3db3bb94cdcf
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
@@ -0,0 +1,106 @@
+From 6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Fri, 16 Dec 2022 15:25:38 -0300
+Subject: Trac 33907: fix singular interface
+
+This essentially reverts 85f65bf and a10d19d from trac #31846.
+It turns out this was originaly written for #30945, but that issue was
+fixed by upgrading cysignals.
+
+Singular really needs a custom `_send_interrupt()` method, because the
+default one will quit singular. Moreover, this handles two quirks of
+singular:
+
+ - a small delay before sending `chr(3)` works around a bug in singular.
+ - sometimes one needs to send `;` a few times after interrupt to get
+   back a prompt.
+
+The original author of the custom `_send_interrupt()` is Jeroen Demeyer
+in commit 17d23e9 (trac #10476). I changed the timeout for a smaller
+one, and rewrote the doctest to call `interrupt()` explicitly instead of
+using `alarm()` which introduces more noise.
+---
+ src/sage/interfaces/expect.py   |  1 -
+ src/sage/interfaces/singular.py | 47 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py
+index c4dc2d4..eb25daf 100644
+--- a/src/sage/interfaces/expect.py
++++ b/src/sage/interfaces/expect.py
+@@ -941,7 +941,6 @@ If this all works, you can then make calls like:
+         The interface still works after this interrupt::
+ 
+             sage: singular('2+3')
+-            Singular crashed -- automatically restarting.
+             5
+ 
+         Last, we demonstrate that by default the execution of a command
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 9c9586d..2c377f0 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -341,6 +341,7 @@ import re
+ import sys
+ import pexpect
+ import shlex
++import time
+ 
+ from .expect import Expect, ExpectElement, FunctionElement, ExpectFunction
+ 
+@@ -508,6 +509,52 @@ class Singular(ExtraTabCompletion, Expect):
+         """
+         return 'quit;'
+ 
++    def _send_interrupt(self):
++        """
++        Send an interrupt to Singular. If needed, additional
++        semi-colons are sent until we get back at the prompt.
++
++        TESTS:
++
++        The following works without restarting Singular::
++
++            sage: a = singular(1)
++            sage: _ = singular._expect.sendline('while(1){};')
++            sage: singular.interrupt()
++            True
++
++        We can still access a::
++
++            sage: 2*a
++            2
++
++        Interrupting nothing or unfinished input also works::
++
++            sage: singular.interrupt()
++            True
++            sage: _ = singular._expect.sendline('1+')
++            sage: singular.interrupt()
++            True
++            sage: 3*a
++            3
++
++        """
++        # Work around for Singular bug
++        # http://www.singular.uni-kl.de:8002/trac/ticket/727
++        time.sleep(0.1)
++
++        E = self._expect
++        E.sendline(chr(3))
++        # The following is needed so interrupt() works even when
++        # there is no computation going on.
++        for i in range(5):
++            try:
++                E.expect_upto(self._prompt, timeout=0.1)
++                return
++            except pexpect.TIMEOUT:
++                pass
++            E.sendline(";")
++
+     def _read_in_file_command(self, filename):
+         r"""
+         EXAMPLES::
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
new file mode 100644
index 000000000000..2769d8575fe9
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
@@ -0,0 +1,372 @@
+commit c7654e85a763eb42e4c547c4a4627112b850f8c2
+Author: Dima Pasechnik <dima@pasechnik.info>
+Date:   Fri Jan 20 14:12:05 2023 +0000
+
+    rename the gen, and do basic tests on the found generator
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index 656ccbf86bc..b9787c1fd6b 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2290,15 +2290,22 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         It can happen that no points are found if the height bounds
+         used in the search are too small (see :trac:`10745`)::
+ 
+-            sage: K.<y> = NumberField(x^4 + x^2 - 7)
+-            sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
++            sage: K.<t> = NumberField(x^4 + x^2 - 7)
++            sage: E = EllipticCurve(K, [1, 0, 5*t^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+             sage: E.rank()
+             1
+-            sage: E.gens(lim3=13)  # long time (about 4s)
++            sage: gg=E.gens(lim3=13); gg  # long time (about 4s)
+             [(... : 1)]
+ 
++        Check that the the point found has infinite order, and that it is on the curve::
++
++            sage: P=gg[0]; P.order()
++            +Infinity
++            sage: E.defining_polynomial()(*P)
++            0
++
+         Here is a curve of rank 2::
+ 
+             sage: K.<t> = NumberField(x^2-17)
+
+commit 238f4de34714989b866757523f2a46088dbfb720
+Author: Dima Pasechnik <dima@pasechnik.info>
+Date:   Fri Jan 20 01:25:39 2023 +0000
+
+    fixed doctests for elliptic curves on 32-bit
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index c44c803aa82..656ccbf86bc 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2294,9 +2294,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+-            sage: E.rank(), E.gens(lim3=12)  # long time (about 4s)
+-            (1,
+-             [(369/25*y^3 + 539/25*y^2 + 1178/25*y + 1718/25 : -29038/125*y^3 - 43003/125*y^2 - 92706/125*y - 137286/125 : 1)])
++            sage: E.rank()
++            1
++            sage: E.gens(lim3=13)  # long time (about 4s)
++            [(... : 1)]
+ 
+         Here is a curve of rank 2::
+ 
+@@ -2644,7 +2645,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: [phi.codomain().cm_discriminant() for phi in E.isogenies_prime_degree()]  # long time
+             [-92, -23, -23]
+ 
+-            sage: C.matrix()  # long time
++            sage: C.matrix()  # long time # random
+             [1 2 2 4 4 2]
+             [2 1 2 4 2 4]
+             [2 2 1 2 4 4]
+@@ -2676,13 +2677,15 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         determined::
+ 
+             sage: G = C.graph()  # long time
+-            sage: G.adjacency_matrix()  # long time
++            sage: G.adjacency_matrix()  # long time # random
+             [0 1 1 0 0 1]
+             [1 0 1 0 1 0]
+             [1 1 0 1 0 0]
+             [0 0 1 0 1 1]
+             [0 1 0 1 0 1]
+             [1 0 0 1 1 0]
++            sage: Graph(polytopes.simplex(2).prism().adjacency_matrix()).is_isomorphic(G) # long time
++            True
+ 
+         To display the graph without any edge labels::
+ 
+diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+index 11bb61c9f21..f5657f2cf19 100644
+--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
++++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+@@ -1205,17 +1205,8 @@ def isogenies_13_0(E, minimal_models=True):
+         sage: K.<a> = NumberField(f)
+         sage: E = EllipticCurve(j=K(0)); E.ainvs()
+         (0, 0, 0, 0, 1)
+-        sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
+-        [(0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
+-          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
+-         (0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
+-          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
++        sage: len([phi.codomain().ainvs() for phi in isogenies_13_0(E)])  # long time (4s)
++        2
+     """
+     if E.j_invariant()!=0:
+         raise ValueError("j-invariant must be 0.")
+
+commit 52e18fba1a4d77ddae9b27a94e736a940ab25ac3
+Author: John Cremona <john.cremona@gmail.com>
+Date:   Thu Jan 5 11:30:39 2023 +0000
+
+    #34537: make qqbar tests more robust
+
+diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
+index 31e0a721a52..18228844684 100644
+--- a/src/sage/rings/qqbar.py
++++ b/src/sage/rings/qqbar.py
+@@ -2656,9 +2656,11 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
+ 
+         sage: elems = [sqrt(5), 2^(1/3)+sqrt(3)*I, 3/4]
+         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
+-        sage: nf
++        sage: nf # random (polynomial and root not unique)
+         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
+           with a = 0.2598679? + 0.0572892?*I
++        sage: nf.is_isomorphic(NumberField(x^24 - 9*x^22 + 135*x^20 - 720*x^18 + 1821*x^16 - 3015*x^14 + 3974*x^12 - 3015*x^10 + 1821*x^8 - 720*x^6 + 135*x^4 - 9*x^2 + 1, 'a'))
++        True
+         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
+         True
+ 
+@@ -7857,16 +7859,21 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.neg(a)
+-            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.neg("ham spam and eggs")
++            sage: c = b.neg(None); c # random (not uniquely represented)
+             -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() + b.field_element_value() == 0
++            True
++
++        The parameter is ignored::
++
++            sage: b.neg("random").generator() == c.generator() and b.neg("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, -self._value)
+ 
+     def invert(self, n):
+         r"""
+-        1/self.
++        Reciprocal of self.
+ 
+         EXAMPLES::
+ 
+@@ -7875,16 +7882,20 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.invert(a)
+-            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.invert("ham spam and eggs")
++            sage: c = b.invert(None); c # random (not uniquely represented)
+             -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() * b.field_element_value() == 1
++            True
++
++        The parameter is ignored::
++
++            sage: b.invert("random").generator() == c.generator() and b.invert("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, ~self._value)
+ 
+     def conjugate(self, n):
+-        r"""
+-        Negation of self.
++        r"""Complex conjugate of self.
+ 
+         EXAMPLES::
+ 
+@@ -7893,10 +7904,23 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.conjugate(a)
+-            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
+-            sage: b.conjugate("ham spam and eggs")
++            sage: c = b.conjugate(None); c # random (not uniquely represented)
+             1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
++
++        Internally, complex conjugation is implemented by taking the
++        same abstract field element but conjugating the complex embedding of
++        the field::
++
++            sage: c.generator() == b.generator().conjugate()
++            True
++            sage: c.field_element_value() == b.field_element_value()
++            True
++
++        The parameter is ignored::
++
++            sage: b.conjugate("random").generator() == c.generator() and b.conjugate("random").field_element_value() == c.field_element_value()
++            True
++
+         """
+         if self._exactly_real:
+             return self
+
+commit 37dcd374ce2f63b38b3f3be27cc10fb5eb5256c2
+Author: John Cremona <john.cremona@gmail.com>
+Date:   Thu Jan 5 10:51:05 2023 +0000
+
+    #34537: make number_field_ideal_rel tests more robust
+
+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 f64bd5b761c..192c8f15034 100644
+--- a/src/sage/rings/number_field/number_field_ideal_rel.py
++++ b/src/sage/rings/number_field/number_field_ideal_rel.py
+@@ -204,8 +204,6 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+         r"""
+         Convert the absolute ideal id to a relative number field ideal.
+ 
+-        Assumes id.number_field() == self.absolute_field('a').
+-
+         WARNING:  This is an internal helper function.
+ 
+         TESTS::
+@@ -218,18 +216,18 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+             True
+             sage: J.absolute_norm()
+             22584817
+-            sage: J.absolute_ideal()
+-            Fractional ideal (22584817, -1473/812911*a^5 + 8695/4877466*a^4 - 1308209/4877466*a^3 + 117415/443406*a^2 - 22963264/2438733*a - 13721081784272/2438733)
+-            sage: J.absolute_ideal().norm()
++            sage: Labs.<c> = L.absolute_field(); Labs # random (polynomial not unique)
++            Number Field in c with defining polynomial x^6 + 217*x^4 - 2*x^3 + 15127*x^2 + 422*x + 338032
++            sage: Jabs = J.absolute_ideal(names='c')
++            sage: Jabs == Labs.ideal(22584817, -1473/812911*c^5 + 8695/4877466*c^4 - 1308209/4877466*c^3 + 117415/443406*c^2 - 22963264/2438733*c - 13721081784272/2438733)
++            True
++            sage: Jabs.norm()
+             22584817
+-
+-            sage: J._from_absolute_ideal(J.absolute_ideal()) == J
++            sage: J._from_absolute_ideal(Jabs) == J
+             True
+         """
+-        L = self.number_field()
+-        K = L.absolute_field('a')
+-        to_L = K.structure()[0]
+-        return L.ideal([to_L(_) for _ in id.gens()])
++        f, _ = id.number_field().structure()
++        return self.number_field().ideal([f(_) for _ in id.gens()])
+ 
+     def free_module(self):
+         r"""
+
+commit 77b7786c653d5dd3c9b3040e895643798f3f6fb2
+Author: John Cremona <john.cremona@gmail.com>
+Date:   Thu Jan 5 10:31:52 2023 +0000
+
+    #34537: make number_field_element tests more robust
+
+diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx
+index 8330dea3b35..bbe5b90fb34 100644
+--- a/src/sage/rings/number_field/number_field_element.pyx
++++ b/src/sage/rings/number_field/number_field_element.pyx
+@@ -1637,10 +1637,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a).is_norm(L, element=True); t
+-            (True, -b^3 - 1)
+-            sage: t[1].norm(K)
+-            -a
++            sage: t, u = (-a).is_norm(L, element=True); u # random (not unique)
++            b^3 + 1
++            sage: t and u.norm(K) == -a
++            True
+ 
+         Verify that :trac:`27469` has been fixed::
+ 
+@@ -1648,8 +1648,7 @@ cdef class NumberFieldElement(FieldElement):
+             Cyclotomic Field of order 24 and degree 8
+             sage: K = L.subfield(z24^3, 'z8')[0]; K
+             Number Field in z8 with defining polynomial x^4 + 1 with z8 = 0.7071067811865475? + 0.7071067811865475?*I
+-            sage: flag, c = K(-7).is_norm(K, element=True)
+-            sage: flag
++            sage: flag, c = K(-7).is_norm(K, element=True); flag
+             True
+             sage: c.norm(K)
+             -7
+@@ -1746,30 +1745,34 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: K(17)._rnfisnorm(L)  # representation depends, not tested
+-            ((a^2 - 2)*b - 4, 1)
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: q==1
++            True
++            sage: y # random (not unique)
++            (a^2 - 2)*b - 4
+ 
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a)._rnfisnorm(L); t
+-            (-b^3 - 1, 1)
+-            sage: t[0].norm(K)
+-            -a
+-            sage: t = K(3)._rnfisnorm(L); t
++            sage: y, q = (-a)._rnfisnorm(L)
++            sage: y # random (not unique)
++            b^3 + 1
++            sage: q == 1 and y.norm(K) == -a
++            True
++            sage: y, q = K(3)._rnfisnorm(L); y, q # random (not unique)
+             (b^3 + a*b^2 + a^2*b - 1, 3*a^2 - 3*a + 6)
+-            sage: t[0].norm(K)*t[1]
+-            3
++            sage: y.norm(K)*q == 3
++            True
+ 
+         An example where the base field is a relative field::
+ 
+             sage: K.<a, b> = NumberField([x^2 - 2, x^2 - 3])
+             sage: L.<c> = K.extension(x^3 + 2)
+             sage: s = 2*a + b
+-            sage: t = s._rnfisnorm(L)
+-            sage: t[1] == 1 # True iff s is a norm
++            sage: y, q = s._rnfisnorm(L)
++            sage: q == 1 # True iff s is a norm
+             False
+-            sage: s == t[0].norm(K)*t[1]
++            sage: s == y.norm(K)*q
+             True
+ 
+         TESTS:
+@@ -1779,7 +1782,9 @@ cdef class NumberFieldElement(FieldElement):
+ 
+             sage: K.<a> = NumberField(x^2 + 1/2)
+             sage: L.<b> = K.extension(x^2 - 1/2)
+-            sage: a._rnfisnorm(L)
++            sage: y, q = a._rnfisnorm(L)
++            sage: y # random (not unique)
++            q == 1 and y.norm(K) == a
+             (a*b + a + 1/2, 1)
+ 
+         We test the above doctest, which was not tested.
+@@ -1788,12 +1793,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L.<b> = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: (xbar, q) = K(17)._rnfisnorm(L)
+-            sage: q == 1
+-            1
+-            sage: xbar.norm()
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: y.norm()
+             4913
+-            sage: xbar in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
++            sage: q == 1 and y in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
+             True
+ 
+         AUTHORS:
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..c5af07ee73a9 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -31,8 +31,8 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+distfiles="https://github.com/sagemath/sage-archive-2023-02-01/archive/refs/tags/$version.tar.gz"
+checksum=7c09f0ab84fa44380146cf1305b9c0e8ec7aea86d975259ca264be6798202bde
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (4 preceding siblings ...)
  2023-02-03 23:42 ` tornaria
@ 2023-02-04  1:04 ` tornaria
  2023-02-04  1:38 ` tornaria
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-04  1:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 39263 bytes --]

From 33b8879b835e47ae87068ea47ae3b1ec94fc9668 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From bd75ad953c91f70a9c5ee6f08bc5e35ba0b1334c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fixes to doctest failures in 32 bit after upgrade of pari to 2.15.2
 - fix an edge case of python 3.11 integer conversion on 32 bit
 - fix singular interface bug that triggers under very heavy load (e.g. on CI)
 - tarball was moved; sha256 changed only b/c of main dirname change
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch |  75 ++++
 ...1c2fc8bcfb5e6555716d05ce70511795ffa1.patch | 106 +++++
 .../trac-34537-sagemath-pari-2.15c.patch      | 403 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       |  76 ++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch |  65 +++
 .../zz-fix_edge_case_of_integer_check.patch   |  38 ++
 srcpkgs/sagemath/template                     |   6 +-
 srcpkgs/sagemath/update                       |   2 +
 8 files changed, 768 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
new file mode 100644
index 000000000000..3db3bb94cdcf
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
@@ -0,0 +1,106 @@
+From 6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Fri, 16 Dec 2022 15:25:38 -0300
+Subject: Trac 33907: fix singular interface
+
+This essentially reverts 85f65bf and a10d19d from trac #31846.
+It turns out this was originaly written for #30945, but that issue was
+fixed by upgrading cysignals.
+
+Singular really needs a custom `_send_interrupt()` method, because the
+default one will quit singular. Moreover, this handles two quirks of
+singular:
+
+ - a small delay before sending `chr(3)` works around a bug in singular.
+ - sometimes one needs to send `;` a few times after interrupt to get
+   back a prompt.
+
+The original author of the custom `_send_interrupt()` is Jeroen Demeyer
+in commit 17d23e9 (trac #10476). I changed the timeout for a smaller
+one, and rewrote the doctest to call `interrupt()` explicitly instead of
+using `alarm()` which introduces more noise.
+---
+ src/sage/interfaces/expect.py   |  1 -
+ src/sage/interfaces/singular.py | 47 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py
+index c4dc2d4..eb25daf 100644
+--- a/src/sage/interfaces/expect.py
++++ b/src/sage/interfaces/expect.py
+@@ -941,7 +941,6 @@ If this all works, you can then make calls like:
+         The interface still works after this interrupt::
+ 
+             sage: singular('2+3')
+-            Singular crashed -- automatically restarting.
+             5
+ 
+         Last, we demonstrate that by default the execution of a command
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 9c9586d..2c377f0 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -341,6 +341,7 @@ import re
+ import sys
+ import pexpect
+ import shlex
++import time
+ 
+ from .expect import Expect, ExpectElement, FunctionElement, ExpectFunction
+ 
+@@ -508,6 +509,52 @@ class Singular(ExtraTabCompletion, Expect):
+         """
+         return 'quit;'
+ 
++    def _send_interrupt(self):
++        """
++        Send an interrupt to Singular. If needed, additional
++        semi-colons are sent until we get back at the prompt.
++
++        TESTS:
++
++        The following works without restarting Singular::
++
++            sage: a = singular(1)
++            sage: _ = singular._expect.sendline('while(1){};')
++            sage: singular.interrupt()
++            True
++
++        We can still access a::
++
++            sage: 2*a
++            2
++
++        Interrupting nothing or unfinished input also works::
++
++            sage: singular.interrupt()
++            True
++            sage: _ = singular._expect.sendline('1+')
++            sage: singular.interrupt()
++            True
++            sage: 3*a
++            3
++
++        """
++        # Work around for Singular bug
++        # http://www.singular.uni-kl.de:8002/trac/ticket/727
++        time.sleep(0.1)
++
++        E = self._expect
++        E.sendline(chr(3))
++        # The following is needed so interrupt() works even when
++        # there is no computation going on.
++        for i in range(5):
++            try:
++                E.expect_upto(self._prompt, timeout=0.1)
++                return
++            except pexpect.TIMEOUT:
++                pass
++            E.sendline(";")
++
+     def _read_in_file_command(self, filename):
+         r"""
+         EXAMPLES::
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
new file mode 100644
index 000000000000..9cef2ee7bf3c
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
@@ -0,0 +1,403 @@
+From 77b7786c653d5dd3c9b3040e895643798f3f6fb2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:31:52 +0000
+Subject: [PATCH 1/5] #34537: make number_field_element tests more robust
+
+---
+ .../number_field/number_field_element.pyx     | 51 ++++++++++---------
+ 1 file changed, 27 insertions(+), 24 deletions(-)
+
+diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx
+index 8330dea3b35..bbe5b90fb34 100644
+--- a/src/sage/rings/number_field/number_field_element.pyx
++++ b/src/sage/rings/number_field/number_field_element.pyx
+@@ -1637,10 +1637,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a).is_norm(L, element=True); t
+-            (True, -b^3 - 1)
+-            sage: t[1].norm(K)
+-            -a
++            sage: t, u = (-a).is_norm(L, element=True); u # random (not unique)
++            b^3 + 1
++            sage: t and u.norm(K) == -a
++            True
+ 
+         Verify that :trac:`27469` has been fixed::
+ 
+@@ -1648,8 +1648,7 @@ cdef class NumberFieldElement(FieldElement):
+             Cyclotomic Field of order 24 and degree 8
+             sage: K = L.subfield(z24^3, 'z8')[0]; K
+             Number Field in z8 with defining polynomial x^4 + 1 with z8 = 0.7071067811865475? + 0.7071067811865475?*I
+-            sage: flag, c = K(-7).is_norm(K, element=True)
+-            sage: flag
++            sage: flag, c = K(-7).is_norm(K, element=True); flag
+             True
+             sage: c.norm(K)
+             -7
+@@ -1746,30 +1745,34 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: K(17)._rnfisnorm(L)  # representation depends, not tested
+-            ((a^2 - 2)*b - 4, 1)
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: q==1
++            True
++            sage: y # random (not unique)
++            (a^2 - 2)*b - 4
+ 
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a)._rnfisnorm(L); t
+-            (-b^3 - 1, 1)
+-            sage: t[0].norm(K)
+-            -a
+-            sage: t = K(3)._rnfisnorm(L); t
++            sage: y, q = (-a)._rnfisnorm(L)
++            sage: y # random (not unique)
++            b^3 + 1
++            sage: q == 1 and y.norm(K) == -a
++            True
++            sage: y, q = K(3)._rnfisnorm(L); y, q # random (not unique)
+             (b^3 + a*b^2 + a^2*b - 1, 3*a^2 - 3*a + 6)
+-            sage: t[0].norm(K)*t[1]
+-            3
++            sage: y.norm(K)*q == 3
++            True
+ 
+         An example where the base field is a relative field::
+ 
+             sage: K.<a, b> = NumberField([x^2 - 2, x^2 - 3])
+             sage: L.<c> = K.extension(x^3 + 2)
+             sage: s = 2*a + b
+-            sage: t = s._rnfisnorm(L)
+-            sage: t[1] == 1 # True iff s is a norm
++            sage: y, q = s._rnfisnorm(L)
++            sage: q == 1 # True iff s is a norm
+             False
+-            sage: s == t[0].norm(K)*t[1]
++            sage: s == y.norm(K)*q
+             True
+ 
+         TESTS:
+@@ -1779,7 +1782,9 @@ cdef class NumberFieldElement(FieldElement):
+ 
+             sage: K.<a> = NumberField(x^2 + 1/2)
+             sage: L.<b> = K.extension(x^2 - 1/2)
+-            sage: a._rnfisnorm(L)
++            sage: y, q = a._rnfisnorm(L)
++            sage: y # random (not unique)
++            q == 1 and y.norm(K) == a
+             (a*b + a + 1/2, 1)
+ 
+         We test the above doctest, which was not tested.
+@@ -1788,12 +1793,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L.<b> = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: (xbar, q) = K(17)._rnfisnorm(L)
+-            sage: q == 1
+-            1
+-            sage: xbar.norm()
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: y.norm()
+             4913
+-            sage: xbar in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
++            sage: q == 1 and y in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
+             True
+ 
+         AUTHORS:
+-- 
+2.39.1
+
+
+From 37dcd374ce2f63b38b3f3be27cc10fb5eb5256c2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:51:05 +0000
+Subject: [PATCH 2/5] #34537: make number_field_ideal_rel tests more robust
+
+---
+ .../number_field/number_field_ideal_rel.py    | 20 +++++++++----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+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 f64bd5b761c..192c8f15034 100644
+--- a/src/sage/rings/number_field/number_field_ideal_rel.py
++++ b/src/sage/rings/number_field/number_field_ideal_rel.py
+@@ -204,8 +204,6 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+         r"""
+         Convert the absolute ideal id to a relative number field ideal.
+ 
+-        Assumes id.number_field() == self.absolute_field('a').
+-
+         WARNING:  This is an internal helper function.
+ 
+         TESTS::
+@@ -218,18 +216,18 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+             True
+             sage: J.absolute_norm()
+             22584817
+-            sage: J.absolute_ideal()
+-            Fractional ideal (22584817, -1473/812911*a^5 + 8695/4877466*a^4 - 1308209/4877466*a^3 + 117415/443406*a^2 - 22963264/2438733*a - 13721081784272/2438733)
+-            sage: J.absolute_ideal().norm()
++            sage: Labs.<c> = L.absolute_field(); Labs # random (polynomial not unique)
++            Number Field in c with defining polynomial x^6 + 217*x^4 - 2*x^3 + 15127*x^2 + 422*x + 338032
++            sage: Jabs = J.absolute_ideal(names='c')
++            sage: Jabs == Labs.ideal(22584817, -1473/812911*c^5 + 8695/4877466*c^4 - 1308209/4877466*c^3 + 117415/443406*c^2 - 22963264/2438733*c - 13721081784272/2438733)
++            True
++            sage: Jabs.norm()
+             22584817
+-
+-            sage: J._from_absolute_ideal(J.absolute_ideal()) == J
++            sage: J._from_absolute_ideal(Jabs) == J
+             True
+         """
+-        L = self.number_field()
+-        K = L.absolute_field('a')
+-        to_L = K.structure()[0]
+-        return L.ideal([to_L(_) for _ in id.gens()])
++        f, _ = id.number_field().structure()
++        return self.number_field().ideal([f(_) for _ in id.gens()])
+ 
+     def free_module(self):
+         r"""
+-- 
+2.39.1
+
+
+From 52e18fba1a4d77ddae9b27a94e736a940ab25ac3 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 11:30:39 +0000
+Subject: [PATCH 3/5] #34537: make qqbar tests more robust
+
+---
+ src/sage/rings/qqbar.py | 50 ++++++++++++++++++++++++++++++-----------
+ 1 file changed, 37 insertions(+), 13 deletions(-)
+
+diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
+index 31e0a721a52..18228844684 100644
+--- a/src/sage/rings/qqbar.py
++++ b/src/sage/rings/qqbar.py
+@@ -2656,9 +2656,11 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
+ 
+         sage: elems = [sqrt(5), 2^(1/3)+sqrt(3)*I, 3/4]
+         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
+-        sage: nf
++        sage: nf # random (polynomial and root not unique)
+         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
+           with a = 0.2598679? + 0.0572892?*I
++        sage: nf.is_isomorphic(NumberField(x^24 - 9*x^22 + 135*x^20 - 720*x^18 + 1821*x^16 - 3015*x^14 + 3974*x^12 - 3015*x^10 + 1821*x^8 - 720*x^6 + 135*x^4 - 9*x^2 + 1, 'a'))
++        True
+         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
+         True
+ 
+@@ -7857,16 +7859,21 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.neg(a)
+-            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.neg("ham spam and eggs")
++            sage: c = b.neg(None); c # random (not uniquely represented)
+             -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() + b.field_element_value() == 0
++            True
++
++        The parameter is ignored::
++
++            sage: b.neg("random").generator() == c.generator() and b.neg("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, -self._value)
+ 
+     def invert(self, n):
+         r"""
+-        1/self.
++        Reciprocal of self.
+ 
+         EXAMPLES::
+ 
+@@ -7875,16 +7882,20 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.invert(a)
+-            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.invert("ham spam and eggs")
++            sage: c = b.invert(None); c # random (not uniquely represented)
+             -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() * b.field_element_value() == 1
++            True
++
++        The parameter is ignored::
++
++            sage: b.invert("random").generator() == c.generator() and b.invert("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, ~self._value)
+ 
+     def conjugate(self, n):
+-        r"""
+-        Negation of self.
++        r"""Complex conjugate of self.
+ 
+         EXAMPLES::
+ 
+@@ -7893,10 +7904,23 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.conjugate(a)
+-            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
+-            sage: b.conjugate("ham spam and eggs")
++            sage: c = b.conjugate(None); c # random (not uniquely represented)
+             1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
++
++        Internally, complex conjugation is implemented by taking the
++        same abstract field element but conjugating the complex embedding of
++        the field::
++
++            sage: c.generator() == b.generator().conjugate()
++            True
++            sage: c.field_element_value() == b.field_element_value()
++            True
++
++        The parameter is ignored::
++
++            sage: b.conjugate("random").generator() == c.generator() and b.conjugate("random").field_element_value() == c.field_element_value()
++            True
++
+         """
+         if self._exactly_real:
+             return self
+-- 
+2.39.1
+
+
+From 238f4de34714989b866757523f2a46088dbfb720 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 01:25:39 +0000
+Subject: [PATCH 4/5] fixed doctests for elliptic curves on 32-bit
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++-----
+ .../schemes/elliptic_curves/isogeny_small_degree.py | 13 ++-----------
+ 2 files changed, 10 insertions(+), 16 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index c44c803aa82..656ccbf86bc 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2294,9 +2294,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+-            sage: E.rank(), E.gens(lim3=12)  # long time (about 4s)
+-            (1,
+-             [(369/25*y^3 + 539/25*y^2 + 1178/25*y + 1718/25 : -29038/125*y^3 - 43003/125*y^2 - 92706/125*y - 137286/125 : 1)])
++            sage: E.rank()
++            1
++            sage: E.gens(lim3=13)  # long time (about 4s)
++            [(... : 1)]
+ 
+         Here is a curve of rank 2::
+ 
+@@ -2644,7 +2645,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: [phi.codomain().cm_discriminant() for phi in E.isogenies_prime_degree()]  # long time
+             [-92, -23, -23]
+ 
+-            sage: C.matrix()  # long time
++            sage: C.matrix()  # long time # random
+             [1 2 2 4 4 2]
+             [2 1 2 4 2 4]
+             [2 2 1 2 4 4]
+@@ -2676,13 +2677,15 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         determined::
+ 
+             sage: G = C.graph()  # long time
+-            sage: G.adjacency_matrix()  # long time
++            sage: G.adjacency_matrix()  # long time # random
+             [0 1 1 0 0 1]
+             [1 0 1 0 1 0]
+             [1 1 0 1 0 0]
+             [0 0 1 0 1 1]
+             [0 1 0 1 0 1]
+             [1 0 0 1 1 0]
++            sage: Graph(polytopes.simplex(2).prism().adjacency_matrix()).is_isomorphic(G) # long time
++            True
+ 
+         To display the graph without any edge labels::
+ 
+diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+index 11bb61c9f21..f5657f2cf19 100644
+--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
++++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+@@ -1205,17 +1205,8 @@ def isogenies_13_0(E, minimal_models=True):
+         sage: K.<a> = NumberField(f)
+         sage: E = EllipticCurve(j=K(0)); E.ainvs()
+         (0, 0, 0, 0, 1)
+-        sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
+-        [(0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
+-          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
+-         (0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
+-          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
++        sage: len([phi.codomain().ainvs() for phi in isogenies_13_0(E)])  # long time (4s)
++        2
+     """
+     if E.j_invariant()!=0:
+         raise ValueError("j-invariant must be 0.")
+-- 
+2.39.1
+
+
+From c7654e85a763eb42e4c547c4a4627112b850f8c2 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 14:12:05 +0000
+Subject: [PATCH 5/5] rename the gen, and do basic tests on the found generator
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index 656ccbf86bc..b9787c1fd6b 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2290,15 +2290,22 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         It can happen that no points are found if the height bounds
+         used in the search are too small (see :trac:`10745`)::
+ 
+-            sage: K.<y> = NumberField(x^4 + x^2 - 7)
+-            sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
++            sage: K.<t> = NumberField(x^4 + x^2 - 7)
++            sage: E = EllipticCurve(K, [1, 0, 5*t^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+             sage: E.rank()
+             1
+-            sage: E.gens(lim3=13)  # long time (about 4s)
++            sage: gg=E.gens(lim3=13); gg  # long time (about 4s)
+             [(... : 1)]
+ 
++        Check that the the point found has infinite order, and that it is on the curve::
++
++            sage: P=gg[0]; P.order()
++            +Infinity
++            sage: E.defining_polynomial()(*P)
++            0
++
+         Here is a curve of rank 2::
+ 
+             sage: K.<t> = NumberField(x^2-17)
+-- 
+2.39.1
+
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..c5af07ee73a9 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -31,8 +31,8 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+distfiles="https://github.com/sagemath/sage-archive-2023-02-01/archive/refs/tags/$version.tar.gz"
+checksum=7c09f0ab84fa44380146cf1305b9c0e8ec7aea86d975259ca264be6798202bde
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (5 preceding siblings ...)
  2023-02-04  1:04 ` tornaria
@ 2023-02-04  1:38 ` tornaria
  2023-02-04 11:47 ` [PR PATCH] [Updated] " tornaria
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-04  1:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1416594792

Comment:
Tested locally together with #41210, #41572, #41972, #41973, #42016, #42043, #42044, #42050 on x86_64 (glibc/musl) and i686 (glibc).

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (6 preceding siblings ...)
  2023-02-04  1:38 ` tornaria
@ 2023-02-04 11:47 ` tornaria
  2023-02-05 14:00 ` tornaria
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-04 11:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 38657 bytes --]

From 33b8879b835e47ae87068ea47ae3b1ec94fc9668 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From 4bd37d80020bd5902407865a1d68f5b0c46a5a4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fixes to doctest failures in 32 bit after upgrade of pari to 2.15.2
 - fix an edge case of python 3.11 integer conversion on 32 bit
 - fix singular interface bug that triggers under very heavy load (e.g. on CI)
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch |  75 ++++
 ...1c2fc8bcfb5e6555716d05ce70511795ffa1.patch | 106 +++++
 .../trac-34537-sagemath-pari-2.15c.patch      | 403 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       |  76 ++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch |  65 +++
 .../zz-fix_edge_case_of_integer_check.patch   |  38 ++
 srcpkgs/sagemath/template                     |   2 +-
 srcpkgs/sagemath/update                       |   2 +
 8 files changed, 766 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
new file mode 100644
index 000000000000..3db3bb94cdcf
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
@@ -0,0 +1,106 @@
+From 6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Fri, 16 Dec 2022 15:25:38 -0300
+Subject: Trac 33907: fix singular interface
+
+This essentially reverts 85f65bf and a10d19d from trac #31846.
+It turns out this was originaly written for #30945, but that issue was
+fixed by upgrading cysignals.
+
+Singular really needs a custom `_send_interrupt()` method, because the
+default one will quit singular. Moreover, this handles two quirks of
+singular:
+
+ - a small delay before sending `chr(3)` works around a bug in singular.
+ - sometimes one needs to send `;` a few times after interrupt to get
+   back a prompt.
+
+The original author of the custom `_send_interrupt()` is Jeroen Demeyer
+in commit 17d23e9 (trac #10476). I changed the timeout for a smaller
+one, and rewrote the doctest to call `interrupt()` explicitly instead of
+using `alarm()` which introduces more noise.
+---
+ src/sage/interfaces/expect.py   |  1 -
+ src/sage/interfaces/singular.py | 47 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py
+index c4dc2d4..eb25daf 100644
+--- a/src/sage/interfaces/expect.py
++++ b/src/sage/interfaces/expect.py
+@@ -941,7 +941,6 @@ If this all works, you can then make calls like:
+         The interface still works after this interrupt::
+ 
+             sage: singular('2+3')
+-            Singular crashed -- automatically restarting.
+             5
+ 
+         Last, we demonstrate that by default the execution of a command
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 9c9586d..2c377f0 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -341,6 +341,7 @@ import re
+ import sys
+ import pexpect
+ import shlex
++import time
+ 
+ from .expect import Expect, ExpectElement, FunctionElement, ExpectFunction
+ 
+@@ -508,6 +509,52 @@ class Singular(ExtraTabCompletion, Expect):
+         """
+         return 'quit;'
+ 
++    def _send_interrupt(self):
++        """
++        Send an interrupt to Singular. If needed, additional
++        semi-colons are sent until we get back at the prompt.
++
++        TESTS:
++
++        The following works without restarting Singular::
++
++            sage: a = singular(1)
++            sage: _ = singular._expect.sendline('while(1){};')
++            sage: singular.interrupt()
++            True
++
++        We can still access a::
++
++            sage: 2*a
++            2
++
++        Interrupting nothing or unfinished input also works::
++
++            sage: singular.interrupt()
++            True
++            sage: _ = singular._expect.sendline('1+')
++            sage: singular.interrupt()
++            True
++            sage: 3*a
++            3
++
++        """
++        # Work around for Singular bug
++        # http://www.singular.uni-kl.de:8002/trac/ticket/727
++        time.sleep(0.1)
++
++        E = self._expect
++        E.sendline(chr(3))
++        # The following is needed so interrupt() works even when
++        # there is no computation going on.
++        for i in range(5):
++            try:
++                E.expect_upto(self._prompt, timeout=0.1)
++                return
++            except pexpect.TIMEOUT:
++                pass
++            E.sendline(";")
++
+     def _read_in_file_command(self, filename):
+         r"""
+         EXAMPLES::
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
new file mode 100644
index 000000000000..e199fff237e7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
@@ -0,0 +1,403 @@
+From 77b7786c653d5dd3c9b3040e895643798f3f6fb2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:31:52 +0000
+Subject: [PATCH 1/5] #34537: make number_field_element tests more robust
+
+---
+ .../number_field/number_field_element.pyx     | 51 ++++++++++---------
+ 1 file changed, 27 insertions(+), 24 deletions(-)
+
+diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx
+index 8330dea3b35..bbe5b90fb34 100644
+--- a/src/sage/rings/number_field/number_field_element.pyx
++++ b/src/sage/rings/number_field/number_field_element.pyx
+@@ -1637,10 +1637,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a).is_norm(L, element=True); t
+-            (True, -b^3 - 1)
+-            sage: t[1].norm(K)
+-            -a
++            sage: t, u = (-a).is_norm(L, element=True); u # random (not unique)
++            b^3 + 1
++            sage: t and u.norm(K) == -a
++            True
+ 
+         Verify that :trac:`27469` has been fixed::
+ 
+@@ -1648,8 +1648,7 @@ cdef class NumberFieldElement(FieldElement):
+             Cyclotomic Field of order 24 and degree 8
+             sage: K = L.subfield(z24^3, 'z8')[0]; K
+             Number Field in z8 with defining polynomial x^4 + 1 with z8 = 0.7071067811865475? + 0.7071067811865475?*I
+-            sage: flag, c = K(-7).is_norm(K, element=True)
+-            sage: flag
++            sage: flag, c = K(-7).is_norm(K, element=True); flag
+             True
+             sage: c.norm(K)
+             -7
+@@ -1746,30 +1745,34 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: K(17)._rnfisnorm(L)  # representation depends, not tested
+-            ((a^2 - 2)*b - 4, 1)
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: q==1
++            True
++            sage: y # random (not unique)
++            (a^2 - 2)*b - 4
+ 
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a)._rnfisnorm(L); t
+-            (-b^3 - 1, 1)
+-            sage: t[0].norm(K)
+-            -a
+-            sage: t = K(3)._rnfisnorm(L); t
++            sage: y, q = (-a)._rnfisnorm(L)
++            sage: y # random (not unique)
++            b^3 + 1
++            sage: q == 1 and y.norm(K) == -a
++            True
++            sage: y, q = K(3)._rnfisnorm(L); y, q # random (not unique)
+             (b^3 + a*b^2 + a^2*b - 1, 3*a^2 - 3*a + 6)
+-            sage: t[0].norm(K)*t[1]
+-            3
++            sage: y.norm(K)*q == 3
++            True
+ 
+         An example where the base field is a relative field::
+ 
+             sage: K.<a, b> = NumberField([x^2 - 2, x^2 - 3])
+             sage: L.<c> = K.extension(x^3 + 2)
+             sage: s = 2*a + b
+-            sage: t = s._rnfisnorm(L)
+-            sage: t[1] == 1 # True iff s is a norm
++            sage: y, q = s._rnfisnorm(L)
++            sage: q == 1 # True iff s is a norm
+             False
+-            sage: s == t[0].norm(K)*t[1]
++            sage: s == y.norm(K)*q
+             True
+ 
+         TESTS:
+@@ -1779,7 +1782,9 @@ cdef class NumberFieldElement(FieldElement):
+ 
+             sage: K.<a> = NumberField(x^2 + 1/2)
+             sage: L.<b> = K.extension(x^2 - 1/2)
+-            sage: a._rnfisnorm(L)
++            sage: y, q = a._rnfisnorm(L)
++            sage: y # random (not unique)
++            q == 1 and y.norm(K) == a
+             (a*b + a + 1/2, 1)
+ 
+         We test the above doctest, which was not tested.
+@@ -1788,12 +1793,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L.<b> = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: (xbar, q) = K(17)._rnfisnorm(L)
+-            sage: q == 1
+-            1
+-            sage: xbar.norm()
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: y.norm()
+             4913
+-            sage: xbar in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
++            sage: q == 1 and y in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
+             True
+ 
+         AUTHORS:
+-- 
+2.39.1
+
+
+From 37dcd374ce2f63b38b3f3be27cc10fb5eb5256c2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:51:05 +0000
+Subject: [PATCH 2/5] #34537: make number_field_ideal_rel tests more robust
+
+---
+ .../number_field/number_field_ideal_rel.py    | 20 +++++++++----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+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 f64bd5b761c..192c8f15034 100644
+--- a/src/sage/rings/number_field/number_field_ideal_rel.py
++++ b/src/sage/rings/number_field/number_field_ideal_rel.py
+@@ -204,8 +204,6 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+         r"""
+         Convert the absolute ideal id to a relative number field ideal.
+ 
+-        Assumes id.number_field() == self.absolute_field('a').
+-
+         WARNING:  This is an internal helper function.
+ 
+         TESTS::
+@@ -218,18 +216,18 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+             True
+             sage: J.absolute_norm()
+             22584817
+-            sage: J.absolute_ideal()
+-            Fractional ideal (22584817, -1473/812911*a^5 + 8695/4877466*a^4 - 1308209/4877466*a^3 + 117415/443406*a^2 - 22963264/2438733*a - 13721081784272/2438733)
+-            sage: J.absolute_ideal().norm()
++            sage: Labs.<c> = L.absolute_field(); Labs # random (polynomial not unique)
++            Number Field in c with defining polynomial x^6 + 217*x^4 - 2*x^3 + 15127*x^2 + 422*x + 338032
++            sage: Jabs = J.absolute_ideal(names='c')
++            sage: Jabs == Labs.ideal(22584817, -1473/812911*c^5 + 8695/4877466*c^4 - 1308209/4877466*c^3 + 117415/443406*c^2 - 22963264/2438733*c - 13721081784272/2438733)
++            True
++            sage: Jabs.norm()
+             22584817
+-
+-            sage: J._from_absolute_ideal(J.absolute_ideal()) == J
++            sage: J._from_absolute_ideal(Jabs) == J
+             True
+         """
+-        L = self.number_field()
+-        K = L.absolute_field('a')
+-        to_L = K.structure()[0]
+-        return L.ideal([to_L(_) for _ in id.gens()])
++        f, _ = id.number_field().structure()
++        return self.number_field().ideal([f(_) for _ in id.gens()])
+ 
+     def free_module(self):
+         r"""
+-- 
+2.39.1
+
+
+From 52e18fba1a4d77ddae9b27a94e736a940ab25ac3 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 11:30:39 +0000
+Subject: [PATCH 3/5] #34537: make qqbar tests more robust
+
+---
+ src/sage/rings/qqbar.py | 50 ++++++++++++++++++++++++++++++-----------
+ 1 file changed, 37 insertions(+), 13 deletions(-)
+
+diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
+index 31e0a721a52..18228844684 100644
+--- a/src/sage/rings/qqbar.py
++++ b/src/sage/rings/qqbar.py
+@@ -2656,9 +2656,11 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
+ 
+         sage: elems = [sqrt(5), 2^(1/3)+sqrt(3)*I, 3/4]
+         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
+-        sage: nf
++        sage: nf # random (polynomial and root not unique)
+         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
+           with a = 0.2598679? + 0.0572892?*I
++        sage: nf.is_isomorphic(NumberField(x^24 - 9*x^22 + 135*x^20 - 720*x^18 + 1821*x^16 - 3015*x^14 + 3974*x^12 - 3015*x^10 + 1821*x^8 - 720*x^6 + 135*x^4 - 9*x^2 + 1, 'a'))
++        True
+         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
+         True
+ 
+@@ -7857,16 +7859,21 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.neg(a)
+-            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.neg("ham spam and eggs")
++            sage: c = b.neg(None); c # random (not uniquely represented)
+             -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() + b.field_element_value() == 0
++            True
++
++        The parameter is ignored::
++
++            sage: b.neg("random").generator() == c.generator() and b.neg("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, -self._value)
+ 
+     def invert(self, n):
+         r"""
+-        1/self.
++        Reciprocal of self.
+ 
+         EXAMPLES::
+ 
+@@ -7875,16 +7882,20 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.invert(a)
+-            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.invert("ham spam and eggs")
++            sage: c = b.invert(None); c # random (not uniquely represented)
+             -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() * b.field_element_value() == 1
++            True
++
++        The parameter is ignored::
++
++            sage: b.invert("random").generator() == c.generator() and b.invert("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, ~self._value)
+ 
+     def conjugate(self, n):
+-        r"""
+-        Negation of self.
++        r"""Complex conjugate of self.
+ 
+         EXAMPLES::
+ 
+@@ -7893,10 +7904,23 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.conjugate(a)
+-            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
+-            sage: b.conjugate("ham spam and eggs")
++            sage: c = b.conjugate(None); c # random (not uniquely represented)
+             1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
++
++        Internally, complex conjugation is implemented by taking the
++        same abstract field element but conjugating the complex embedding of
++        the field::
++
++            sage: c.generator() == b.generator().conjugate()
++            True
++            sage: c.field_element_value() == b.field_element_value()
++            True
++
++        The parameter is ignored::
++
++            sage: b.conjugate("random").generator() == c.generator() and b.conjugate("random").field_element_value() == c.field_element_value()
++            True
++
+         """
+         if self._exactly_real:
+             return self
+-- 
+2.39.1
+
+
+From 238f4de34714989b866757523f2a46088dbfb720 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 01:25:39 +0000
+Subject: [PATCH 4/5] fixed doctests for elliptic curves on 32-bit
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++-----
+ .../schemes/elliptic_curves/isogeny_small_degree.py | 13 ++-----------
+ 2 files changed, 10 insertions(+), 16 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index c44c803aa82..656ccbf86bc 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2294,9 +2294,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+-            sage: E.rank(), E.gens(lim3=12)  # long time (about 4s)
+-            (1,
+-             [(369/25*y^3 + 539/25*y^2 + 1178/25*y + 1718/25 : -29038/125*y^3 - 43003/125*y^2 - 92706/125*y - 137286/125 : 1)])
++            sage: E.rank()
++            1
++            sage: E.gens(lim3=13)  # long time (about 4s)
++            [(... : 1)]
+ 
+         Here is a curve of rank 2::
+ 
+@@ -2644,7 +2645,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: [phi.codomain().cm_discriminant() for phi in E.isogenies_prime_degree()]  # long time
+             [-92, -23, -23]
+ 
+-            sage: C.matrix()  # long time
++            sage: C.matrix()  # long time # random
+             [1 2 2 4 4 2]
+             [2 1 2 4 2 4]
+             [2 2 1 2 4 4]
+@@ -2676,13 +2677,15 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         determined::
+ 
+             sage: G = C.graph()  # long time
+-            sage: G.adjacency_matrix()  # long time
++            sage: G.adjacency_matrix()  # long time # random
+             [0 1 1 0 0 1]
+             [1 0 1 0 1 0]
+             [1 1 0 1 0 0]
+             [0 0 1 0 1 1]
+             [0 1 0 1 0 1]
+             [1 0 0 1 1 0]
++            sage: Graph(polytopes.simplex(2).prism().adjacency_matrix()).is_isomorphic(G) # long time
++            True
+ 
+         To display the graph without any edge labels::
+ 
+diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+index 11bb61c9f21..f5657f2cf19 100644
+--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
++++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+@@ -1205,17 +1205,8 @@ def isogenies_13_0(E, minimal_models=True):
+         sage: K.<a> = NumberField(f)
+         sage: E = EllipticCurve(j=K(0)); E.ainvs()
+         (0, 0, 0, 0, 1)
+-        sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
+-        [(0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
+-          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
+-         (0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
+-          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
++        sage: len([phi.codomain().ainvs() for phi in isogenies_13_0(E)])  # long time (4s)
++        2
+     """
+     if E.j_invariant()!=0:
+         raise ValueError("j-invariant must be 0.")
+-- 
+2.39.1
+
+
+From c7654e85a763eb42e4c547c4a4627112b850f8c2 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 14:12:05 +0000
+Subject: [PATCH 5/5] rename the gen, and do basic tests on the found generator
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index 656ccbf86bc..b9787c1fd6b 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2290,15 +2290,22 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         It can happen that no points are found if the height bounds
+         used in the search are too small (see :trac:`10745`)::
+ 
+-            sage: K.<y> = NumberField(x^4 + x^2 - 7)
+-            sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
++            sage: K.<t> = NumberField(x^4 + x^2 - 7)
++            sage: E = EllipticCurve(K, [1, 0, 5*t^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+             sage: E.rank()
+             1
+-            sage: E.gens(lim3=13)  # long time (about 4s)
++            sage: gg=E.gens(lim3=13); gg  # long time (about 4s)
+             [(... : 1)]
+ 
++        Check that the the point found has infinite order, and that it is on the curve::
++
++            sage: P=gg[0]; P.order()  # long time
++            +Infinity
++            sage: E.defining_polynomial()(*P)  # long time
++            0
++
+         Here is a curve of rank 2::
+ 
+             sage: K.<t> = NumberField(x^2-17)
+-- 
+2.39.1
+
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..2bbced6290e0 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (7 preceding siblings ...)
  2023-02-04 11:47 ` [PR PATCH] [Updated] " tornaria
@ 2023-02-05 14:00 ` tornaria
  2023-02-05 14:00 ` tornaria
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-05 14:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 38657 bytes --]

From 5d152512a8d7045fc17abbd99c272c42fe20cf33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From d61fbc7571fdb73db480909eae604a1dfc438f74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fixes to doctest failures in 32 bit after upgrade of pari to 2.15.2
 - fix an edge case of python 3.11 integer conversion on 32 bit
 - fix singular interface bug that triggers under very heavy load (e.g. on CI)
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch |  75 ++++
 ...1c2fc8bcfb5e6555716d05ce70511795ffa1.patch | 106 +++++
 .../trac-34537-sagemath-pari-2.15c.patch      | 403 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       |  76 ++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch |  65 +++
 .../zz-fix_edge_case_of_integer_check.patch   |  38 ++
 srcpkgs/sagemath/template                     |   2 +-
 srcpkgs/sagemath/update                       |   2 +
 8 files changed, 766 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
new file mode 100644
index 000000000000..3db3bb94cdcf
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
@@ -0,0 +1,106 @@
+From 6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Fri, 16 Dec 2022 15:25:38 -0300
+Subject: Trac 33907: fix singular interface
+
+This essentially reverts 85f65bf and a10d19d from trac #31846.
+It turns out this was originaly written for #30945, but that issue was
+fixed by upgrading cysignals.
+
+Singular really needs a custom `_send_interrupt()` method, because the
+default one will quit singular. Moreover, this handles two quirks of
+singular:
+
+ - a small delay before sending `chr(3)` works around a bug in singular.
+ - sometimes one needs to send `;` a few times after interrupt to get
+   back a prompt.
+
+The original author of the custom `_send_interrupt()` is Jeroen Demeyer
+in commit 17d23e9 (trac #10476). I changed the timeout for a smaller
+one, and rewrote the doctest to call `interrupt()` explicitly instead of
+using `alarm()` which introduces more noise.
+---
+ src/sage/interfaces/expect.py   |  1 -
+ src/sage/interfaces/singular.py | 47 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py
+index c4dc2d4..eb25daf 100644
+--- a/src/sage/interfaces/expect.py
++++ b/src/sage/interfaces/expect.py
+@@ -941,7 +941,6 @@ If this all works, you can then make calls like:
+         The interface still works after this interrupt::
+ 
+             sage: singular('2+3')
+-            Singular crashed -- automatically restarting.
+             5
+ 
+         Last, we demonstrate that by default the execution of a command
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 9c9586d..2c377f0 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -341,6 +341,7 @@ import re
+ import sys
+ import pexpect
+ import shlex
++import time
+ 
+ from .expect import Expect, ExpectElement, FunctionElement, ExpectFunction
+ 
+@@ -508,6 +509,52 @@ class Singular(ExtraTabCompletion, Expect):
+         """
+         return 'quit;'
+ 
++    def _send_interrupt(self):
++        """
++        Send an interrupt to Singular. If needed, additional
++        semi-colons are sent until we get back at the prompt.
++
++        TESTS:
++
++        The following works without restarting Singular::
++
++            sage: a = singular(1)
++            sage: _ = singular._expect.sendline('while(1){};')
++            sage: singular.interrupt()
++            True
++
++        We can still access a::
++
++            sage: 2*a
++            2
++
++        Interrupting nothing or unfinished input also works::
++
++            sage: singular.interrupt()
++            True
++            sage: _ = singular._expect.sendline('1+')
++            sage: singular.interrupt()
++            True
++            sage: 3*a
++            3
++
++        """
++        # Work around for Singular bug
++        # http://www.singular.uni-kl.de:8002/trac/ticket/727
++        time.sleep(0.1)
++
++        E = self._expect
++        E.sendline(chr(3))
++        # The following is needed so interrupt() works even when
++        # there is no computation going on.
++        for i in range(5):
++            try:
++                E.expect_upto(self._prompt, timeout=0.1)
++                return
++            except pexpect.TIMEOUT:
++                pass
++            E.sendline(";")
++
+     def _read_in_file_command(self, filename):
+         r"""
+         EXAMPLES::
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
new file mode 100644
index 000000000000..e199fff237e7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
@@ -0,0 +1,403 @@
+From 77b7786c653d5dd3c9b3040e895643798f3f6fb2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:31:52 +0000
+Subject: [PATCH 1/5] #34537: make number_field_element tests more robust
+
+---
+ .../number_field/number_field_element.pyx     | 51 ++++++++++---------
+ 1 file changed, 27 insertions(+), 24 deletions(-)
+
+diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx
+index 8330dea3b35..bbe5b90fb34 100644
+--- a/src/sage/rings/number_field/number_field_element.pyx
++++ b/src/sage/rings/number_field/number_field_element.pyx
+@@ -1637,10 +1637,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a).is_norm(L, element=True); t
+-            (True, -b^3 - 1)
+-            sage: t[1].norm(K)
+-            -a
++            sage: t, u = (-a).is_norm(L, element=True); u # random (not unique)
++            b^3 + 1
++            sage: t and u.norm(K) == -a
++            True
+ 
+         Verify that :trac:`27469` has been fixed::
+ 
+@@ -1648,8 +1648,7 @@ cdef class NumberFieldElement(FieldElement):
+             Cyclotomic Field of order 24 and degree 8
+             sage: K = L.subfield(z24^3, 'z8')[0]; K
+             Number Field in z8 with defining polynomial x^4 + 1 with z8 = 0.7071067811865475? + 0.7071067811865475?*I
+-            sage: flag, c = K(-7).is_norm(K, element=True)
+-            sage: flag
++            sage: flag, c = K(-7).is_norm(K, element=True); flag
+             True
+             sage: c.norm(K)
+             -7
+@@ -1746,30 +1745,34 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: K(17)._rnfisnorm(L)  # representation depends, not tested
+-            ((a^2 - 2)*b - 4, 1)
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: q==1
++            True
++            sage: y # random (not unique)
++            (a^2 - 2)*b - 4
+ 
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a)._rnfisnorm(L); t
+-            (-b^3 - 1, 1)
+-            sage: t[0].norm(K)
+-            -a
+-            sage: t = K(3)._rnfisnorm(L); t
++            sage: y, q = (-a)._rnfisnorm(L)
++            sage: y # random (not unique)
++            b^3 + 1
++            sage: q == 1 and y.norm(K) == -a
++            True
++            sage: y, q = K(3)._rnfisnorm(L); y, q # random (not unique)
+             (b^3 + a*b^2 + a^2*b - 1, 3*a^2 - 3*a + 6)
+-            sage: t[0].norm(K)*t[1]
+-            3
++            sage: y.norm(K)*q == 3
++            True
+ 
+         An example where the base field is a relative field::
+ 
+             sage: K.<a, b> = NumberField([x^2 - 2, x^2 - 3])
+             sage: L.<c> = K.extension(x^3 + 2)
+             sage: s = 2*a + b
+-            sage: t = s._rnfisnorm(L)
+-            sage: t[1] == 1 # True iff s is a norm
++            sage: y, q = s._rnfisnorm(L)
++            sage: q == 1 # True iff s is a norm
+             False
+-            sage: s == t[0].norm(K)*t[1]
++            sage: s == y.norm(K)*q
+             True
+ 
+         TESTS:
+@@ -1779,7 +1782,9 @@ cdef class NumberFieldElement(FieldElement):
+ 
+             sage: K.<a> = NumberField(x^2 + 1/2)
+             sage: L.<b> = K.extension(x^2 - 1/2)
+-            sage: a._rnfisnorm(L)
++            sage: y, q = a._rnfisnorm(L)
++            sage: y # random (not unique)
++            q == 1 and y.norm(K) == a
+             (a*b + a + 1/2, 1)
+ 
+         We test the above doctest, which was not tested.
+@@ -1788,12 +1793,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L.<b> = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: (xbar, q) = K(17)._rnfisnorm(L)
+-            sage: q == 1
+-            1
+-            sage: xbar.norm()
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: y.norm()
+             4913
+-            sage: xbar in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
++            sage: q == 1 and y in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
+             True
+ 
+         AUTHORS:
+-- 
+2.39.1
+
+
+From 37dcd374ce2f63b38b3f3be27cc10fb5eb5256c2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:51:05 +0000
+Subject: [PATCH 2/5] #34537: make number_field_ideal_rel tests more robust
+
+---
+ .../number_field/number_field_ideal_rel.py    | 20 +++++++++----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+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 f64bd5b761c..192c8f15034 100644
+--- a/src/sage/rings/number_field/number_field_ideal_rel.py
++++ b/src/sage/rings/number_field/number_field_ideal_rel.py
+@@ -204,8 +204,6 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+         r"""
+         Convert the absolute ideal id to a relative number field ideal.
+ 
+-        Assumes id.number_field() == self.absolute_field('a').
+-
+         WARNING:  This is an internal helper function.
+ 
+         TESTS::
+@@ -218,18 +216,18 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+             True
+             sage: J.absolute_norm()
+             22584817
+-            sage: J.absolute_ideal()
+-            Fractional ideal (22584817, -1473/812911*a^5 + 8695/4877466*a^4 - 1308209/4877466*a^3 + 117415/443406*a^2 - 22963264/2438733*a - 13721081784272/2438733)
+-            sage: J.absolute_ideal().norm()
++            sage: Labs.<c> = L.absolute_field(); Labs # random (polynomial not unique)
++            Number Field in c with defining polynomial x^6 + 217*x^4 - 2*x^3 + 15127*x^2 + 422*x + 338032
++            sage: Jabs = J.absolute_ideal(names='c')
++            sage: Jabs == Labs.ideal(22584817, -1473/812911*c^5 + 8695/4877466*c^4 - 1308209/4877466*c^3 + 117415/443406*c^2 - 22963264/2438733*c - 13721081784272/2438733)
++            True
++            sage: Jabs.norm()
+             22584817
+-
+-            sage: J._from_absolute_ideal(J.absolute_ideal()) == J
++            sage: J._from_absolute_ideal(Jabs) == J
+             True
+         """
+-        L = self.number_field()
+-        K = L.absolute_field('a')
+-        to_L = K.structure()[0]
+-        return L.ideal([to_L(_) for _ in id.gens()])
++        f, _ = id.number_field().structure()
++        return self.number_field().ideal([f(_) for _ in id.gens()])
+ 
+     def free_module(self):
+         r"""
+-- 
+2.39.1
+
+
+From 52e18fba1a4d77ddae9b27a94e736a940ab25ac3 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 11:30:39 +0000
+Subject: [PATCH 3/5] #34537: make qqbar tests more robust
+
+---
+ src/sage/rings/qqbar.py | 50 ++++++++++++++++++++++++++++++-----------
+ 1 file changed, 37 insertions(+), 13 deletions(-)
+
+diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
+index 31e0a721a52..18228844684 100644
+--- a/src/sage/rings/qqbar.py
++++ b/src/sage/rings/qqbar.py
+@@ -2656,9 +2656,11 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
+ 
+         sage: elems = [sqrt(5), 2^(1/3)+sqrt(3)*I, 3/4]
+         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
+-        sage: nf
++        sage: nf # random (polynomial and root not unique)
+         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
+           with a = 0.2598679? + 0.0572892?*I
++        sage: nf.is_isomorphic(NumberField(x^24 - 9*x^22 + 135*x^20 - 720*x^18 + 1821*x^16 - 3015*x^14 + 3974*x^12 - 3015*x^10 + 1821*x^8 - 720*x^6 + 135*x^4 - 9*x^2 + 1, 'a'))
++        True
+         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
+         True
+ 
+@@ -7857,16 +7859,21 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.neg(a)
+-            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.neg("ham spam and eggs")
++            sage: c = b.neg(None); c # random (not uniquely represented)
+             -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() + b.field_element_value() == 0
++            True
++
++        The parameter is ignored::
++
++            sage: b.neg("random").generator() == c.generator() and b.neg("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, -self._value)
+ 
+     def invert(self, n):
+         r"""
+-        1/self.
++        Reciprocal of self.
+ 
+         EXAMPLES::
+ 
+@@ -7875,16 +7882,20 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.invert(a)
+-            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.invert("ham spam and eggs")
++            sage: c = b.invert(None); c # random (not uniquely represented)
+             -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() * b.field_element_value() == 1
++            True
++
++        The parameter is ignored::
++
++            sage: b.invert("random").generator() == c.generator() and b.invert("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, ~self._value)
+ 
+     def conjugate(self, n):
+-        r"""
+-        Negation of self.
++        r"""Complex conjugate of self.
+ 
+         EXAMPLES::
+ 
+@@ -7893,10 +7904,23 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.conjugate(a)
+-            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
+-            sage: b.conjugate("ham spam and eggs")
++            sage: c = b.conjugate(None); c # random (not uniquely represented)
+             1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
++
++        Internally, complex conjugation is implemented by taking the
++        same abstract field element but conjugating the complex embedding of
++        the field::
++
++            sage: c.generator() == b.generator().conjugate()
++            True
++            sage: c.field_element_value() == b.field_element_value()
++            True
++
++        The parameter is ignored::
++
++            sage: b.conjugate("random").generator() == c.generator() and b.conjugate("random").field_element_value() == c.field_element_value()
++            True
++
+         """
+         if self._exactly_real:
+             return self
+-- 
+2.39.1
+
+
+From 238f4de34714989b866757523f2a46088dbfb720 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 01:25:39 +0000
+Subject: [PATCH 4/5] fixed doctests for elliptic curves on 32-bit
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++-----
+ .../schemes/elliptic_curves/isogeny_small_degree.py | 13 ++-----------
+ 2 files changed, 10 insertions(+), 16 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index c44c803aa82..656ccbf86bc 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2294,9 +2294,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+-            sage: E.rank(), E.gens(lim3=12)  # long time (about 4s)
+-            (1,
+-             [(369/25*y^3 + 539/25*y^2 + 1178/25*y + 1718/25 : -29038/125*y^3 - 43003/125*y^2 - 92706/125*y - 137286/125 : 1)])
++            sage: E.rank()
++            1
++            sage: E.gens(lim3=13)  # long time (about 4s)
++            [(... : 1)]
+ 
+         Here is a curve of rank 2::
+ 
+@@ -2644,7 +2645,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: [phi.codomain().cm_discriminant() for phi in E.isogenies_prime_degree()]  # long time
+             [-92, -23, -23]
+ 
+-            sage: C.matrix()  # long time
++            sage: C.matrix()  # long time # random
+             [1 2 2 4 4 2]
+             [2 1 2 4 2 4]
+             [2 2 1 2 4 4]
+@@ -2676,13 +2677,15 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         determined::
+ 
+             sage: G = C.graph()  # long time
+-            sage: G.adjacency_matrix()  # long time
++            sage: G.adjacency_matrix()  # long time # random
+             [0 1 1 0 0 1]
+             [1 0 1 0 1 0]
+             [1 1 0 1 0 0]
+             [0 0 1 0 1 1]
+             [0 1 0 1 0 1]
+             [1 0 0 1 1 0]
++            sage: Graph(polytopes.simplex(2).prism().adjacency_matrix()).is_isomorphic(G) # long time
++            True
+ 
+         To display the graph without any edge labels::
+ 
+diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+index 11bb61c9f21..f5657f2cf19 100644
+--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
++++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+@@ -1205,17 +1205,8 @@ def isogenies_13_0(E, minimal_models=True):
+         sage: K.<a> = NumberField(f)
+         sage: E = EllipticCurve(j=K(0)); E.ainvs()
+         (0, 0, 0, 0, 1)
+-        sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
+-        [(0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
+-          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
+-         (0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
+-          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
++        sage: len([phi.codomain().ainvs() for phi in isogenies_13_0(E)])  # long time (4s)
++        2
+     """
+     if E.j_invariant()!=0:
+         raise ValueError("j-invariant must be 0.")
+-- 
+2.39.1
+
+
+From c7654e85a763eb42e4c547c4a4627112b850f8c2 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 14:12:05 +0000
+Subject: [PATCH 5/5] rename the gen, and do basic tests on the found generator
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index 656ccbf86bc..b9787c1fd6b 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2290,15 +2290,22 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         It can happen that no points are found if the height bounds
+         used in the search are too small (see :trac:`10745`)::
+ 
+-            sage: K.<y> = NumberField(x^4 + x^2 - 7)
+-            sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
++            sage: K.<t> = NumberField(x^4 + x^2 - 7)
++            sage: E = EllipticCurve(K, [1, 0, 5*t^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+             sage: E.rank()
+             1
+-            sage: E.gens(lim3=13)  # long time (about 4s)
++            sage: gg=E.gens(lim3=13); gg  # long time (about 4s)
+             [(... : 1)]
+ 
++        Check that the the point found has infinite order, and that it is on the curve::
++
++            sage: P=gg[0]; P.order()  # long time
++            +Infinity
++            sage: E.defining_polynomial()(*P)  # long time
++            0
++
+         Here is a curve of rank 2::
+ 
+             sage: K.<t> = NumberField(x^2-17)
+-- 
+2.39.1
+
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..2bbced6290e0 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (8 preceding siblings ...)
  2023-02-05 14:00 ` tornaria
@ 2023-02-05 14:00 ` tornaria
  2023-02-05 14:42 ` [PR PATCH] [Updated] " tornaria
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-05 14:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 181 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1417926544

Comment:
Rebased without changes to restart CI.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (9 preceding siblings ...)
  2023-02-05 14:00 ` tornaria
@ 2023-02-05 14:42 ` tornaria
  2023-02-05 14:56 ` tornaria
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-05 14:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 39289 bytes --]

From 5d152512a8d7045fc17abbd99c272c42fe20cf33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From d1ea2ee3ae5ae9e7a255c13d021540e8410a3ed4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fixes to doctest failures in 32 bit after upgrade of pari to 2.15.2
 - fix an edge case of python 3.11 integer conversion on 32 bit
 - fix singular interface bug that triggers under very heavy load (e.g. on CI)
 - tarball was moved; sha256 changed only b/c of main dirname change
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch |  75 ++++
 ...1c2fc8bcfb5e6555716d05ce70511795ffa1.patch | 106 +++++
 .../trac-34537-sagemath-pari-2.15c.patch      | 403 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       |  76 ++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch |  65 +++
 .../zz-fix_edge_case_of_integer_check.patch   |  38 ++
 srcpkgs/sagemath/template                     |   6 +-
 srcpkgs/sagemath/update                       |   2 +
 8 files changed, 768 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
new file mode 100644
index 000000000000..3db3bb94cdcf
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
@@ -0,0 +1,106 @@
+From 6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Fri, 16 Dec 2022 15:25:38 -0300
+Subject: Trac 33907: fix singular interface
+
+This essentially reverts 85f65bf and a10d19d from trac #31846.
+It turns out this was originaly written for #30945, but that issue was
+fixed by upgrading cysignals.
+
+Singular really needs a custom `_send_interrupt()` method, because the
+default one will quit singular. Moreover, this handles two quirks of
+singular:
+
+ - a small delay before sending `chr(3)` works around a bug in singular.
+ - sometimes one needs to send `;` a few times after interrupt to get
+   back a prompt.
+
+The original author of the custom `_send_interrupt()` is Jeroen Demeyer
+in commit 17d23e9 (trac #10476). I changed the timeout for a smaller
+one, and rewrote the doctest to call `interrupt()` explicitly instead of
+using `alarm()` which introduces more noise.
+---
+ src/sage/interfaces/expect.py   |  1 -
+ src/sage/interfaces/singular.py | 47 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py
+index c4dc2d4..eb25daf 100644
+--- a/src/sage/interfaces/expect.py
++++ b/src/sage/interfaces/expect.py
+@@ -941,7 +941,6 @@ If this all works, you can then make calls like:
+         The interface still works after this interrupt::
+ 
+             sage: singular('2+3')
+-            Singular crashed -- automatically restarting.
+             5
+ 
+         Last, we demonstrate that by default the execution of a command
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 9c9586d..2c377f0 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -341,6 +341,7 @@ import re
+ import sys
+ import pexpect
+ import shlex
++import time
+ 
+ from .expect import Expect, ExpectElement, FunctionElement, ExpectFunction
+ 
+@@ -508,6 +509,52 @@ class Singular(ExtraTabCompletion, Expect):
+         """
+         return 'quit;'
+ 
++    def _send_interrupt(self):
++        """
++        Send an interrupt to Singular. If needed, additional
++        semi-colons are sent until we get back at the prompt.
++
++        TESTS:
++
++        The following works without restarting Singular::
++
++            sage: a = singular(1)
++            sage: _ = singular._expect.sendline('while(1){};')
++            sage: singular.interrupt()
++            True
++
++        We can still access a::
++
++            sage: 2*a
++            2
++
++        Interrupting nothing or unfinished input also works::
++
++            sage: singular.interrupt()
++            True
++            sage: _ = singular._expect.sendline('1+')
++            sage: singular.interrupt()
++            True
++            sage: 3*a
++            3
++
++        """
++        # Work around for Singular bug
++        # http://www.singular.uni-kl.de:8002/trac/ticket/727
++        time.sleep(0.1)
++
++        E = self._expect
++        E.sendline(chr(3))
++        # The following is needed so interrupt() works even when
++        # there is no computation going on.
++        for i in range(5):
++            try:
++                E.expect_upto(self._prompt, timeout=0.1)
++                return
++            except pexpect.TIMEOUT:
++                pass
++            E.sendline(";")
++
+     def _read_in_file_command(self, filename):
+         r"""
+         EXAMPLES::
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
new file mode 100644
index 000000000000..e199fff237e7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
@@ -0,0 +1,403 @@
+From 77b7786c653d5dd3c9b3040e895643798f3f6fb2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:31:52 +0000
+Subject: [PATCH 1/5] #34537: make number_field_element tests more robust
+
+---
+ .../number_field/number_field_element.pyx     | 51 ++++++++++---------
+ 1 file changed, 27 insertions(+), 24 deletions(-)
+
+diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx
+index 8330dea3b35..bbe5b90fb34 100644
+--- a/src/sage/rings/number_field/number_field_element.pyx
++++ b/src/sage/rings/number_field/number_field_element.pyx
+@@ -1637,10 +1637,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a).is_norm(L, element=True); t
+-            (True, -b^3 - 1)
+-            sage: t[1].norm(K)
+-            -a
++            sage: t, u = (-a).is_norm(L, element=True); u # random (not unique)
++            b^3 + 1
++            sage: t and u.norm(K) == -a
++            True
+ 
+         Verify that :trac:`27469` has been fixed::
+ 
+@@ -1648,8 +1648,7 @@ cdef class NumberFieldElement(FieldElement):
+             Cyclotomic Field of order 24 and degree 8
+             sage: K = L.subfield(z24^3, 'z8')[0]; K
+             Number Field in z8 with defining polynomial x^4 + 1 with z8 = 0.7071067811865475? + 0.7071067811865475?*I
+-            sage: flag, c = K(-7).is_norm(K, element=True)
+-            sage: flag
++            sage: flag, c = K(-7).is_norm(K, element=True); flag
+             True
+             sage: c.norm(K)
+             -7
+@@ -1746,30 +1745,34 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: K(17)._rnfisnorm(L)  # representation depends, not tested
+-            ((a^2 - 2)*b - 4, 1)
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: q==1
++            True
++            sage: y # random (not unique)
++            (a^2 - 2)*b - 4
+ 
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a)._rnfisnorm(L); t
+-            (-b^3 - 1, 1)
+-            sage: t[0].norm(K)
+-            -a
+-            sage: t = K(3)._rnfisnorm(L); t
++            sage: y, q = (-a)._rnfisnorm(L)
++            sage: y # random (not unique)
++            b^3 + 1
++            sage: q == 1 and y.norm(K) == -a
++            True
++            sage: y, q = K(3)._rnfisnorm(L); y, q # random (not unique)
+             (b^3 + a*b^2 + a^2*b - 1, 3*a^2 - 3*a + 6)
+-            sage: t[0].norm(K)*t[1]
+-            3
++            sage: y.norm(K)*q == 3
++            True
+ 
+         An example where the base field is a relative field::
+ 
+             sage: K.<a, b> = NumberField([x^2 - 2, x^2 - 3])
+             sage: L.<c> = K.extension(x^3 + 2)
+             sage: s = 2*a + b
+-            sage: t = s._rnfisnorm(L)
+-            sage: t[1] == 1 # True iff s is a norm
++            sage: y, q = s._rnfisnorm(L)
++            sage: q == 1 # True iff s is a norm
+             False
+-            sage: s == t[0].norm(K)*t[1]
++            sage: s == y.norm(K)*q
+             True
+ 
+         TESTS:
+@@ -1779,7 +1782,9 @@ cdef class NumberFieldElement(FieldElement):
+ 
+             sage: K.<a> = NumberField(x^2 + 1/2)
+             sage: L.<b> = K.extension(x^2 - 1/2)
+-            sage: a._rnfisnorm(L)
++            sage: y, q = a._rnfisnorm(L)
++            sage: y # random (not unique)
++            q == 1 and y.norm(K) == a
+             (a*b + a + 1/2, 1)
+ 
+         We test the above doctest, which was not tested.
+@@ -1788,12 +1793,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L.<b> = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: (xbar, q) = K(17)._rnfisnorm(L)
+-            sage: q == 1
+-            1
+-            sage: xbar.norm()
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: y.norm()
+             4913
+-            sage: xbar in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
++            sage: q == 1 and y in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
+             True
+ 
+         AUTHORS:
+-- 
+2.39.1
+
+
+From 37dcd374ce2f63b38b3f3be27cc10fb5eb5256c2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:51:05 +0000
+Subject: [PATCH 2/5] #34537: make number_field_ideal_rel tests more robust
+
+---
+ .../number_field/number_field_ideal_rel.py    | 20 +++++++++----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+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 f64bd5b761c..192c8f15034 100644
+--- a/src/sage/rings/number_field/number_field_ideal_rel.py
++++ b/src/sage/rings/number_field/number_field_ideal_rel.py
+@@ -204,8 +204,6 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+         r"""
+         Convert the absolute ideal id to a relative number field ideal.
+ 
+-        Assumes id.number_field() == self.absolute_field('a').
+-
+         WARNING:  This is an internal helper function.
+ 
+         TESTS::
+@@ -218,18 +216,18 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+             True
+             sage: J.absolute_norm()
+             22584817
+-            sage: J.absolute_ideal()
+-            Fractional ideal (22584817, -1473/812911*a^5 + 8695/4877466*a^4 - 1308209/4877466*a^3 + 117415/443406*a^2 - 22963264/2438733*a - 13721081784272/2438733)
+-            sage: J.absolute_ideal().norm()
++            sage: Labs.<c> = L.absolute_field(); Labs # random (polynomial not unique)
++            Number Field in c with defining polynomial x^6 + 217*x^4 - 2*x^3 + 15127*x^2 + 422*x + 338032
++            sage: Jabs = J.absolute_ideal(names='c')
++            sage: Jabs == Labs.ideal(22584817, -1473/812911*c^5 + 8695/4877466*c^4 - 1308209/4877466*c^3 + 117415/443406*c^2 - 22963264/2438733*c - 13721081784272/2438733)
++            True
++            sage: Jabs.norm()
+             22584817
+-
+-            sage: J._from_absolute_ideal(J.absolute_ideal()) == J
++            sage: J._from_absolute_ideal(Jabs) == J
+             True
+         """
+-        L = self.number_field()
+-        K = L.absolute_field('a')
+-        to_L = K.structure()[0]
+-        return L.ideal([to_L(_) for _ in id.gens()])
++        f, _ = id.number_field().structure()
++        return self.number_field().ideal([f(_) for _ in id.gens()])
+ 
+     def free_module(self):
+         r"""
+-- 
+2.39.1
+
+
+From 52e18fba1a4d77ddae9b27a94e736a940ab25ac3 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 11:30:39 +0000
+Subject: [PATCH 3/5] #34537: make qqbar tests more robust
+
+---
+ src/sage/rings/qqbar.py | 50 ++++++++++++++++++++++++++++++-----------
+ 1 file changed, 37 insertions(+), 13 deletions(-)
+
+diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
+index 31e0a721a52..18228844684 100644
+--- a/src/sage/rings/qqbar.py
++++ b/src/sage/rings/qqbar.py
+@@ -2656,9 +2656,11 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
+ 
+         sage: elems = [sqrt(5), 2^(1/3)+sqrt(3)*I, 3/4]
+         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
+-        sage: nf
++        sage: nf # random (polynomial and root not unique)
+         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
+           with a = 0.2598679? + 0.0572892?*I
++        sage: nf.is_isomorphic(NumberField(x^24 - 9*x^22 + 135*x^20 - 720*x^18 + 1821*x^16 - 3015*x^14 + 3974*x^12 - 3015*x^10 + 1821*x^8 - 720*x^6 + 135*x^4 - 9*x^2 + 1, 'a'))
++        True
+         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
+         True
+ 
+@@ -7857,16 +7859,21 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.neg(a)
+-            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.neg("ham spam and eggs")
++            sage: c = b.neg(None); c # random (not uniquely represented)
+             -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() + b.field_element_value() == 0
++            True
++
++        The parameter is ignored::
++
++            sage: b.neg("random").generator() == c.generator() and b.neg("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, -self._value)
+ 
+     def invert(self, n):
+         r"""
+-        1/self.
++        Reciprocal of self.
+ 
+         EXAMPLES::
+ 
+@@ -7875,16 +7882,20 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.invert(a)
+-            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.invert("ham spam and eggs")
++            sage: c = b.invert(None); c # random (not uniquely represented)
+             -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() * b.field_element_value() == 1
++            True
++
++        The parameter is ignored::
++
++            sage: b.invert("random").generator() == c.generator() and b.invert("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, ~self._value)
+ 
+     def conjugate(self, n):
+-        r"""
+-        Negation of self.
++        r"""Complex conjugate of self.
+ 
+         EXAMPLES::
+ 
+@@ -7893,10 +7904,23 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.conjugate(a)
+-            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
+-            sage: b.conjugate("ham spam and eggs")
++            sage: c = b.conjugate(None); c # random (not uniquely represented)
+             1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
++
++        Internally, complex conjugation is implemented by taking the
++        same abstract field element but conjugating the complex embedding of
++        the field::
++
++            sage: c.generator() == b.generator().conjugate()
++            True
++            sage: c.field_element_value() == b.field_element_value()
++            True
++
++        The parameter is ignored::
++
++            sage: b.conjugate("random").generator() == c.generator() and b.conjugate("random").field_element_value() == c.field_element_value()
++            True
++
+         """
+         if self._exactly_real:
+             return self
+-- 
+2.39.1
+
+
+From 238f4de34714989b866757523f2a46088dbfb720 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 01:25:39 +0000
+Subject: [PATCH 4/5] fixed doctests for elliptic curves on 32-bit
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++-----
+ .../schemes/elliptic_curves/isogeny_small_degree.py | 13 ++-----------
+ 2 files changed, 10 insertions(+), 16 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index c44c803aa82..656ccbf86bc 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2294,9 +2294,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+-            sage: E.rank(), E.gens(lim3=12)  # long time (about 4s)
+-            (1,
+-             [(369/25*y^3 + 539/25*y^2 + 1178/25*y + 1718/25 : -29038/125*y^3 - 43003/125*y^2 - 92706/125*y - 137286/125 : 1)])
++            sage: E.rank()
++            1
++            sage: E.gens(lim3=13)  # long time (about 4s)
++            [(... : 1)]
+ 
+         Here is a curve of rank 2::
+ 
+@@ -2644,7 +2645,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: [phi.codomain().cm_discriminant() for phi in E.isogenies_prime_degree()]  # long time
+             [-92, -23, -23]
+ 
+-            sage: C.matrix()  # long time
++            sage: C.matrix()  # long time # random
+             [1 2 2 4 4 2]
+             [2 1 2 4 2 4]
+             [2 2 1 2 4 4]
+@@ -2676,13 +2677,15 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         determined::
+ 
+             sage: G = C.graph()  # long time
+-            sage: G.adjacency_matrix()  # long time
++            sage: G.adjacency_matrix()  # long time # random
+             [0 1 1 0 0 1]
+             [1 0 1 0 1 0]
+             [1 1 0 1 0 0]
+             [0 0 1 0 1 1]
+             [0 1 0 1 0 1]
+             [1 0 0 1 1 0]
++            sage: Graph(polytopes.simplex(2).prism().adjacency_matrix()).is_isomorphic(G) # long time
++            True
+ 
+         To display the graph without any edge labels::
+ 
+diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+index 11bb61c9f21..f5657f2cf19 100644
+--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
++++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+@@ -1205,17 +1205,8 @@ def isogenies_13_0(E, minimal_models=True):
+         sage: K.<a> = NumberField(f)
+         sage: E = EllipticCurve(j=K(0)); E.ainvs()
+         (0, 0, 0, 0, 1)
+-        sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
+-        [(0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
+-          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
+-         (0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
+-          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
++        sage: len([phi.codomain().ainvs() for phi in isogenies_13_0(E)])  # long time (4s)
++        2
+     """
+     if E.j_invariant()!=0:
+         raise ValueError("j-invariant must be 0.")
+-- 
+2.39.1
+
+
+From c7654e85a763eb42e4c547c4a4627112b850f8c2 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 14:12:05 +0000
+Subject: [PATCH 5/5] rename the gen, and do basic tests on the found generator
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index 656ccbf86bc..b9787c1fd6b 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2290,15 +2290,22 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         It can happen that no points are found if the height bounds
+         used in the search are too small (see :trac:`10745`)::
+ 
+-            sage: K.<y> = NumberField(x^4 + x^2 - 7)
+-            sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
++            sage: K.<t> = NumberField(x^4 + x^2 - 7)
++            sage: E = EllipticCurve(K, [1, 0, 5*t^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+             sage: E.rank()
+             1
+-            sage: E.gens(lim3=13)  # long time (about 4s)
++            sage: gg=E.gens(lim3=13); gg  # long time (about 4s)
+             [(... : 1)]
+ 
++        Check that the the point found has infinite order, and that it is on the curve::
++
++            sage: P=gg[0]; P.order()  # long time
++            +Infinity
++            sage: E.defining_polynomial()(*P)  # long time
++            0
++
+         Here is a curve of rank 2::
+ 
+             sage: K.<t> = NumberField(x^2-17)
+-- 
+2.39.1
+
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..c5af07ee73a9 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -31,8 +31,8 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+distfiles="https://github.com/sagemath/sage-archive-2023-02-01/archive/refs/tags/$version.tar.gz"
+checksum=7c09f0ab84fa44380146cf1305b9c0e8ec7aea86d975259ca264be6798202bde
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (10 preceding siblings ...)
  2023-02-05 14:42 ` [PR PATCH] [Updated] " tornaria
@ 2023-02-05 14:56 ` tornaria
  2023-02-06  2:54 ` [PR PATCH] [Updated] " tornaria
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-05 14:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 406 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1418003960

Comment:
I had to make a change since the tarball was moved; a different dirname changes the sha256 of the tarball but I checked that the contents are identical -- other than the name of the top level dir which xbps-src renames anyway (that feature gets another  :+1: ).


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (11 preceding siblings ...)
  2023-02-05 14:56 ` tornaria
@ 2023-02-06  2:54 ` tornaria
  2023-02-06 12:43 ` tornaria
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-06  2:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 39289 bytes --]

From 52654597eef63cecc45233fad3d44570f741ea8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From 736e0cbab58151592a5fa8e48d2228298b127df5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: rebuild for updates

Also:
 - rebuild for boost update in sync with brial (same PR)
 - fixes for numpy 1.24 (already updated)
 - fixes to support updating giac to 1.9.0.37
 - fixes to support updating tachyon 0.99.5
 - fixes to doctest failures in 32 bit after upgrade of pari to 2.15.2
 - fix an edge case of python 3.11 integer conversion on 32 bit
 - fix singular interface bug that triggers under very heavy load (e.g. on CI)
 - tarball was moved; sha256 changed only b/c of main dirname change
---
 ...4623a4b7404f5e4f9d152366d53e9c21cfa6.patch |  75 ++++
 ...1c2fc8bcfb5e6555716d05ce70511795ffa1.patch | 106 +++++
 .../trac-34537-sagemath-pari-2.15c.patch      | 403 ++++++++++++++++++
 .../patches/trac-34816-numpy_1.24.patch       |  76 ++++
 ...c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch |  65 +++
 .../zz-fix_edge_case_of_integer_check.patch   |  38 ++
 srcpkgs/sagemath/template                     |   6 +-
 srcpkgs/sagemath/update                       |   2 +
 8 files changed, 768 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
 create mode 100644 srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
new file mode 100644
index 000000000000..77c0dcb9a95b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-23712-support_tachyon_0.99.2-55c04623a4b7404f5e4f9d152366d53e9c21cfa6.patch
@@ -0,0 +1,75 @@
+From 55c04623a4b7404f5e4f9d152366d53e9c21cfa6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Wed, 21 Dec 2022 19:43:02 -0300
+Subject: Trac #23712: support tachyon >= 0.99.2
+
+In tachyon 0.99.2 the keyword `focallength` was changed to `focaldist`.
+To support it, when running on version >= 0.99.2 we "patch" the model as
+constructed by class `sage.plot.plot3d.tachyon.Tachyon`.
+
+In the future (possibly when tachyon in sage gets upgraded), all the
+focallength occurences in sage.plot.plot3d.tachyon can be replaced by
+focaldist for consistency with new tachyon, and the logic here can be
+reversed (i.e. patch the model when self.version() < '0.99.2') or just
+drop support for old versions.
+---
+ src/sage/interfaces/tachyon.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e5..21cc1db 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@ properly.
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ class TachyonRT(SageObject):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,22 @@ class TachyonRT(SageObject):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # not tested
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.read()
++        return re.search(r"Version ([\d.]*)", r)[1]
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
new file mode 100644
index 000000000000..3db3bb94cdcf
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-33907-fix_singular_interface-6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1.patch
@@ -0,0 +1,106 @@
+From 6f5c1c2fc8bcfb5e6555716d05ce70511795ffa1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
+Date: Fri, 16 Dec 2022 15:25:38 -0300
+Subject: Trac 33907: fix singular interface
+
+This essentially reverts 85f65bf and a10d19d from trac #31846.
+It turns out this was originaly written for #30945, but that issue was
+fixed by upgrading cysignals.
+
+Singular really needs a custom `_send_interrupt()` method, because the
+default one will quit singular. Moreover, this handles two quirks of
+singular:
+
+ - a small delay before sending `chr(3)` works around a bug in singular.
+ - sometimes one needs to send `;` a few times after interrupt to get
+   back a prompt.
+
+The original author of the custom `_send_interrupt()` is Jeroen Demeyer
+in commit 17d23e9 (trac #10476). I changed the timeout for a smaller
+one, and rewrote the doctest to call `interrupt()` explicitly instead of
+using `alarm()` which introduces more noise.
+---
+ src/sage/interfaces/expect.py   |  1 -
+ src/sage/interfaces/singular.py | 47 +++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 47 insertions(+), 1 deletion(-)
+
+diff --git a/src/sage/interfaces/expect.py b/src/sage/interfaces/expect.py
+index c4dc2d4..eb25daf 100644
+--- a/src/sage/interfaces/expect.py
++++ b/src/sage/interfaces/expect.py
+@@ -941,7 +941,6 @@ If this all works, you can then make calls like:
+         The interface still works after this interrupt::
+ 
+             sage: singular('2+3')
+-            Singular crashed -- automatically restarting.
+             5
+ 
+         Last, we demonstrate that by default the execution of a command
+diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
+index 9c9586d..2c377f0 100644
+--- a/src/sage/interfaces/singular.py
++++ b/src/sage/interfaces/singular.py
+@@ -341,6 +341,7 @@ import re
+ import sys
+ import pexpect
+ import shlex
++import time
+ 
+ from .expect import Expect, ExpectElement, FunctionElement, ExpectFunction
+ 
+@@ -508,6 +509,52 @@ class Singular(ExtraTabCompletion, Expect):
+         """
+         return 'quit;'
+ 
++    def _send_interrupt(self):
++        """
++        Send an interrupt to Singular. If needed, additional
++        semi-colons are sent until we get back at the prompt.
++
++        TESTS:
++
++        The following works without restarting Singular::
++
++            sage: a = singular(1)
++            sage: _ = singular._expect.sendline('while(1){};')
++            sage: singular.interrupt()
++            True
++
++        We can still access a::
++
++            sage: 2*a
++            2
++
++        Interrupting nothing or unfinished input also works::
++
++            sage: singular.interrupt()
++            True
++            sage: _ = singular._expect.sendline('1+')
++            sage: singular.interrupt()
++            True
++            sage: 3*a
++            3
++
++        """
++        # Work around for Singular bug
++        # http://www.singular.uni-kl.de:8002/trac/ticket/727
++        time.sleep(0.1)
++
++        E = self._expect
++        E.sendline(chr(3))
++        # The following is needed so interrupt() works even when
++        # there is no computation going on.
++        for i in range(5):
++            try:
++                E.expect_upto(self._prompt, timeout=0.1)
++                return
++            except pexpect.TIMEOUT:
++                pass
++            E.sendline(";")
++
+     def _read_in_file_command(self, filename):
+         r"""
+         EXAMPLES::
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
new file mode 100644
index 000000000000..e199fff237e7
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15c.patch
@@ -0,0 +1,403 @@
+From 77b7786c653d5dd3c9b3040e895643798f3f6fb2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:31:52 +0000
+Subject: [PATCH 1/5] #34537: make number_field_element tests more robust
+
+---
+ .../number_field/number_field_element.pyx     | 51 ++++++++++---------
+ 1 file changed, 27 insertions(+), 24 deletions(-)
+
+diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx
+index 8330dea3b35..bbe5b90fb34 100644
+--- a/src/sage/rings/number_field/number_field_element.pyx
++++ b/src/sage/rings/number_field/number_field_element.pyx
+@@ -1637,10 +1637,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a).is_norm(L, element=True); t
+-            (True, -b^3 - 1)
+-            sage: t[1].norm(K)
+-            -a
++            sage: t, u = (-a).is_norm(L, element=True); u # random (not unique)
++            b^3 + 1
++            sage: t and u.norm(K) == -a
++            True
+ 
+         Verify that :trac:`27469` has been fixed::
+ 
+@@ -1648,8 +1648,7 @@ cdef class NumberFieldElement(FieldElement):
+             Cyclotomic Field of order 24 and degree 8
+             sage: K = L.subfield(z24^3, 'z8')[0]; K
+             Number Field in z8 with defining polynomial x^4 + 1 with z8 = 0.7071067811865475? + 0.7071067811865475?*I
+-            sage: flag, c = K(-7).is_norm(K, element=True)
+-            sage: flag
++            sage: flag, c = K(-7).is_norm(K, element=True); flag
+             True
+             sage: c.norm(K)
+             -7
+@@ -1746,30 +1745,34 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: K(17)._rnfisnorm(L)  # representation depends, not tested
+-            ((a^2 - 2)*b - 4, 1)
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: q==1
++            True
++            sage: y # random (not unique)
++            (a^2 - 2)*b - 4
+ 
+             sage: K.<a> = NumberField(x^3 + x + 1)
+             sage: Q.<X> = K[]
+             sage: L.<b> = NumberField(X^4 + a)
+-            sage: t = (-a)._rnfisnorm(L); t
+-            (-b^3 - 1, 1)
+-            sage: t[0].norm(K)
+-            -a
+-            sage: t = K(3)._rnfisnorm(L); t
++            sage: y, q = (-a)._rnfisnorm(L)
++            sage: y # random (not unique)
++            b^3 + 1
++            sage: q == 1 and y.norm(K) == -a
++            True
++            sage: y, q = K(3)._rnfisnorm(L); y, q # random (not unique)
+             (b^3 + a*b^2 + a^2*b - 1, 3*a^2 - 3*a + 6)
+-            sage: t[0].norm(K)*t[1]
+-            3
++            sage: y.norm(K)*q == 3
++            True
+ 
+         An example where the base field is a relative field::
+ 
+             sage: K.<a, b> = NumberField([x^2 - 2, x^2 - 3])
+             sage: L.<c> = K.extension(x^3 + 2)
+             sage: s = 2*a + b
+-            sage: t = s._rnfisnorm(L)
+-            sage: t[1] == 1 # True iff s is a norm
++            sage: y, q = s._rnfisnorm(L)
++            sage: q == 1 # True iff s is a norm
+             False
+-            sage: s == t[0].norm(K)*t[1]
++            sage: s == y.norm(K)*q
+             True
+ 
+         TESTS:
+@@ -1779,7 +1782,9 @@ cdef class NumberFieldElement(FieldElement):
+ 
+             sage: K.<a> = NumberField(x^2 + 1/2)
+             sage: L.<b> = K.extension(x^2 - 1/2)
+-            sage: a._rnfisnorm(L)
++            sage: y, q = a._rnfisnorm(L)
++            sage: y # random (not unique)
++            q == 1 and y.norm(K) == a
+             (a*b + a + 1/2, 1)
+ 
+         We test the above doctest, which was not tested.
+@@ -1788,12 +1793,10 @@ cdef class NumberFieldElement(FieldElement):
+             sage: K.<a> = NumberField(x^3 + x^2 - 2*x - 1, 'a')
+             sage: P.<X> = K[]
+             sage: L.<b> = NumberField(X^2 + a^2 + 2*a + 1, 'b')
+-            sage: (xbar, q) = K(17)._rnfisnorm(L)
+-            sage: q == 1
+-            1
+-            sage: xbar.norm()
++            sage: y, q = K(17)._rnfisnorm(L)
++            sage: y.norm()
+             4913
+-            sage: xbar in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
++            sage: q == 1 and y in ((a^2 - 2)*b - 4, (a^2 - 2)*b + 4)
+             True
+ 
+         AUTHORS:
+-- 
+2.39.1
+
+
+From 37dcd374ce2f63b38b3f3be27cc10fb5eb5256c2 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 10:51:05 +0000
+Subject: [PATCH 2/5] #34537: make number_field_ideal_rel tests more robust
+
+---
+ .../number_field/number_field_ideal_rel.py    | 20 +++++++++----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+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 f64bd5b761c..192c8f15034 100644
+--- a/src/sage/rings/number_field/number_field_ideal_rel.py
++++ b/src/sage/rings/number_field/number_field_ideal_rel.py
+@@ -204,8 +204,6 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+         r"""
+         Convert the absolute ideal id to a relative number field ideal.
+ 
+-        Assumes id.number_field() == self.absolute_field('a').
+-
+         WARNING:  This is an internal helper function.
+ 
+         TESTS::
+@@ -218,18 +216,18 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
+             True
+             sage: J.absolute_norm()
+             22584817
+-            sage: J.absolute_ideal()
+-            Fractional ideal (22584817, -1473/812911*a^5 + 8695/4877466*a^4 - 1308209/4877466*a^3 + 117415/443406*a^2 - 22963264/2438733*a - 13721081784272/2438733)
+-            sage: J.absolute_ideal().norm()
++            sage: Labs.<c> = L.absolute_field(); Labs # random (polynomial not unique)
++            Number Field in c with defining polynomial x^6 + 217*x^4 - 2*x^3 + 15127*x^2 + 422*x + 338032
++            sage: Jabs = J.absolute_ideal(names='c')
++            sage: Jabs == Labs.ideal(22584817, -1473/812911*c^5 + 8695/4877466*c^4 - 1308209/4877466*c^3 + 117415/443406*c^2 - 22963264/2438733*c - 13721081784272/2438733)
++            True
++            sage: Jabs.norm()
+             22584817
+-
+-            sage: J._from_absolute_ideal(J.absolute_ideal()) == J
++            sage: J._from_absolute_ideal(Jabs) == J
+             True
+         """
+-        L = self.number_field()
+-        K = L.absolute_field('a')
+-        to_L = K.structure()[0]
+-        return L.ideal([to_L(_) for _ in id.gens()])
++        f, _ = id.number_field().structure()
++        return self.number_field().ideal([f(_) for _ in id.gens()])
+ 
+     def free_module(self):
+         r"""
+-- 
+2.39.1
+
+
+From 52e18fba1a4d77ddae9b27a94e736a940ab25ac3 Mon Sep 17 00:00:00 2001
+From: John Cremona <john.cremona@gmail.com>
+Date: Thu, 5 Jan 2023 11:30:39 +0000
+Subject: [PATCH 3/5] #34537: make qqbar tests more robust
+
+---
+ src/sage/rings/qqbar.py | 50 ++++++++++++++++++++++++++++++-----------
+ 1 file changed, 37 insertions(+), 13 deletions(-)
+
+diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
+index 31e0a721a52..18228844684 100644
+--- a/src/sage/rings/qqbar.py
++++ b/src/sage/rings/qqbar.py
+@@ -2656,9 +2656,11 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
+ 
+         sage: elems = [sqrt(5), 2^(1/3)+sqrt(3)*I, 3/4]
+         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
+-        sage: nf
++        sage: nf # random (polynomial and root not unique)
+         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
+           with a = 0.2598679? + 0.0572892?*I
++        sage: nf.is_isomorphic(NumberField(x^24 - 9*x^22 + 135*x^20 - 720*x^18 + 1821*x^16 - 3015*x^14 + 3974*x^12 - 3015*x^10 + 1821*x^8 - 720*x^6 + 135*x^4 - 9*x^2 + 1, 'a'))
++        True
+         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
+         True
+ 
+@@ -7857,16 +7859,21 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.neg(a)
+-            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.neg("ham spam and eggs")
++            sage: c = b.neg(None); c # random (not uniquely represented)
+             -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() + b.field_element_value() == 0
++            True
++
++        The parameter is ignored::
++
++            sage: b.neg("random").generator() == c.generator() and b.neg("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, -self._value)
+ 
+     def invert(self, n):
+         r"""
+-        1/self.
++        Reciprocal of self.
+ 
+         EXAMPLES::
+ 
+@@ -7875,16 +7882,20 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.invert(a)
+-            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
+-            sage: b.invert("ham spam and eggs")
++            sage: c = b.invert(None); c # random (not uniquely represented)
+             -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
++            sage: c.generator() == b.generator() and c.field_element_value() * b.field_element_value() == 1
++            True
++
++        The parameter is ignored::
++
++            sage: b.invert("random").generator() == c.generator() and b.invert("random").field_element_value() == c.field_element_value()
++            True
+         """
+         return ANExtensionElement(self._generator, ~self._value)
+ 
+     def conjugate(self, n):
+-        r"""
+-        Negation of self.
++        r"""Complex conjugate of self.
+ 
+         EXAMPLES::
+ 
+@@ -7893,10 +7904,23 @@ class ANExtensionElement(ANDescr):
+             sage: b = a._descr
+             sage: type(b)
+             <class 'sage.rings.qqbar.ANExtensionElement'>
+-            sage: b.conjugate(a)
+-            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
+-            sage: b.conjugate("ham spam and eggs")
++            sage: c = b.conjugate(None); c # random (not uniquely represented)
+             1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
++
++        Internally, complex conjugation is implemented by taking the
++        same abstract field element but conjugating the complex embedding of
++        the field::
++
++            sage: c.generator() == b.generator().conjugate()
++            True
++            sage: c.field_element_value() == b.field_element_value()
++            True
++
++        The parameter is ignored::
++
++            sage: b.conjugate("random").generator() == c.generator() and b.conjugate("random").field_element_value() == c.field_element_value()
++            True
++
+         """
+         if self._exactly_real:
+             return self
+-- 
+2.39.1
+
+
+From 238f4de34714989b866757523f2a46088dbfb720 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 01:25:39 +0000
+Subject: [PATCH 4/5] fixed doctests for elliptic curves on 32-bit
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++-----
+ .../schemes/elliptic_curves/isogeny_small_degree.py | 13 ++-----------
+ 2 files changed, 10 insertions(+), 16 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index c44c803aa82..656ccbf86bc 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2294,9 +2294,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+-            sage: E.rank(), E.gens(lim3=12)  # long time (about 4s)
+-            (1,
+-             [(369/25*y^3 + 539/25*y^2 + 1178/25*y + 1718/25 : -29038/125*y^3 - 43003/125*y^2 - 92706/125*y - 137286/125 : 1)])
++            sage: E.rank()
++            1
++            sage: E.gens(lim3=13)  # long time (about 4s)
++            [(... : 1)]
+ 
+         Here is a curve of rank 2::
+ 
+@@ -2644,7 +2645,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
+             sage: [phi.codomain().cm_discriminant() for phi in E.isogenies_prime_degree()]  # long time
+             [-92, -23, -23]
+ 
+-            sage: C.matrix()  # long time
++            sage: C.matrix()  # long time # random
+             [1 2 2 4 4 2]
+             [2 1 2 4 2 4]
+             [2 2 1 2 4 4]
+@@ -2676,13 +2677,15 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         determined::
+ 
+             sage: G = C.graph()  # long time
+-            sage: G.adjacency_matrix()  # long time
++            sage: G.adjacency_matrix()  # long time # random
+             [0 1 1 0 0 1]
+             [1 0 1 0 1 0]
+             [1 1 0 1 0 0]
+             [0 0 1 0 1 1]
+             [0 1 0 1 0 1]
+             [1 0 0 1 1 0]
++            sage: Graph(polytopes.simplex(2).prism().adjacency_matrix()).is_isomorphic(G) # long time
++            True
+ 
+         To display the graph without any edge labels::
+ 
+diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+index 11bb61c9f21..f5657f2cf19 100644
+--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
++++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+@@ -1205,17 +1205,8 @@ def isogenies_13_0(E, minimal_models=True):
+         sage: K.<a> = NumberField(f)
+         sage: E = EllipticCurve(j=K(0)); E.ainvs()
+         (0, 0, 0, 0, 1)
+-        sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
+-        [(0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
+-          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
+-         (0,
+-          0,
+-          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
+-          -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
+-          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
++        sage: len([phi.codomain().ainvs() for phi in isogenies_13_0(E)])  # long time (4s)
++        2
+     """
+     if E.j_invariant()!=0:
+         raise ValueError("j-invariant must be 0.")
+-- 
+2.39.1
+
+
+From c7654e85a763eb42e4c547c4a4627112b850f8c2 Mon Sep 17 00:00:00 2001
+From: Dima Pasechnik <dima@pasechnik.info>
+Date: Fri, 20 Jan 2023 14:12:05 +0000
+Subject: [PATCH 5/5] rename the gen, and do basic tests on the found generator
+
+---
+ .../schemes/elliptic_curves/ell_number_field.py     | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
+index 656ccbf86bc..b9787c1fd6b 100644
+--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
+@@ -2290,15 +2290,22 @@ class EllipticCurve_number_field(EllipticCurve_field):
+         It can happen that no points are found if the height bounds
+         used in the search are too small (see :trac:`10745`)::
+ 
+-            sage: K.<y> = NumberField(x^4 + x^2 - 7)
+-            sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0])
++            sage: K.<t> = NumberField(x^4 + x^2 - 7)
++            sage: E = EllipticCurve(K, [1, 0, 5*t^2 + 16, 0, 0])
+             sage: E.gens(lim1=1, lim3=1)
+             []
+             sage: E.rank()
+             1
+-            sage: E.gens(lim3=13)  # long time (about 4s)
++            sage: gg=E.gens(lim3=13); gg  # long time (about 4s)
+             [(... : 1)]
+ 
++        Check that the the point found has infinite order, and that it is on the curve::
++
++            sage: P=gg[0]; P.order()  # long time
++            +Infinity
++            sage: E.defining_polynomial()(*P)  # long time
++            0
++
+         Here is a curve of rank 2::
+ 
+             sage: K.<t> = NumberField(x^2-17)
+-- 
+2.39.1
+
diff --git a/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
new file mode 100644
index 000000000000..5fbab81ebcde
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34816-numpy_1.24.patch
@@ -0,0 +1,76 @@
+commit 1f22dea27235eeb7dd74cab2cee60cffa55fff2a
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 22:16:32 2023 -0300
+
+    complex_plot: fix plot of undefined values
+    
+    Undefined values would get some random color.
+    Rreplace all undefined values by white.
+    
+    In numpy 1.24 this avoids a runtime warning (cast of nan to uint8).
+
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+
+commit c57458d245f9e24c0283d72d5b97ace0ff011fd6
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:25:15 2023 -0300
+
+    doctest: fixes for numpy 1.24
+
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ class Histogram(GraphicPrimitive):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ class SageMagics(Magics):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
new file mode 100644
index 000000000000..7b072e2ba18e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34926-fix_tests_with_giac_1.9.0.35-3c98c3c9be2ca04e799fa6baf4ad09f21ed6eb91.patch
@@ -0,0 +1,65 @@
+From f28961e88271c6685f9d7e4697f36affe3bbe65c Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451db..ccad516 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0f..b8896a9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
+-- 
+cgit v1.0-1-gd88e
+
diff --git a/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..384d73283a2e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/zz-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,38 @@
+commit d95ccbdc02a63124bd5dd2743a2356c6f873c5b4
+Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
+Date:   Wed Jan 4 20:21:51 2023 -0300
+
+    sage.arith.long: fix edge case of integer_check_py
+
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..16d13512f68 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -310,6 +321,9 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..c5af07ee73a9 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
 version=9.7
-revision=4
+revision=5
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -31,8 +31,8 @@ short_desc="Open source mathematics software"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
-distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+distfiles="https://github.com/sagemath/sage-archive-2023-02-01/archive/refs/tags/$version.tar.gz"
+checksum=7c09f0ab84fa44380146cf1305b9c0e8ec7aea86d975259ca264be6798202bde
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (12 preceding siblings ...)
  2023-02-06  2:54 ` [PR PATCH] [Updated] " tornaria
@ 2023-02-06 12:43 ` tornaria
  2023-02-06 21:23 ` dkwo
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-06 12:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1419022892

Comment:
@dkwo @leahneukirchen this is good to merge IMO, as are #41210, #41572, #41972, #41973, #42016, #42043, #42044, #42050. I tested locally all together on the three non-cross arches.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (13 preceding siblings ...)
  2023-02-06 12:43 ` tornaria
@ 2023-02-06 21:23 ` dkwo
  2023-02-06 21:24 ` dkwo
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: dkwo @ 2023-02-06 21:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1419775618

Comment:
On aarch64 (after rebuilding libtool and ntl), the following tests fail:
```
graphs/generators/{distance_regular.ptx, classical_geometries.py} # segfault
graphs/strongly_regular_db.pyx # segfault
combinat/matrices/hadamard_matrix.py # segfault
quadratic_forms/binary_qf.py # 2 failed
schemes/elliptic_curves/hom_velusqrt.py # 1 failed
graphs/generic_graph.py # timed out
```

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (14 preceding siblings ...)
  2023-02-06 21:23 ` dkwo
@ 2023-02-06 21:24 ` dkwo
  2023-02-06 21:39 ` tornaria
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: dkwo @ 2023-02-06 21:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1419776726

Comment:
I did not test with the linked PR's though.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (15 preceding siblings ...)
  2023-02-06 21:24 ` dkwo
@ 2023-02-06 21:39 ` tornaria
  2023-02-06 23:37 ` dkwo
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-06 21:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1419800501

Comment:
> On aarch64 (after rebuilding libtool and ntl), the following tests fail:
> 
> ```
> graphs/generators/{distance_regular.ptx, classical_geometries.py} # segfault
> graphs/strongly_regular_db.pyx # segfault
> combinat/matrices/hadamard_matrix.py # segfault
> quadratic_forms/binary_qf.py # 2 failed
> schemes/elliptic_curves/hom_velusqrt.py # 1 failed
> graphs/generic_graph.py # timed out
> ```

Were these doctests passing before this PR?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (16 preceding siblings ...)
  2023-02-06 21:39 ` tornaria
@ 2023-02-06 23:37 ` dkwo
  2023-02-06 23:42 ` dkwo
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: dkwo @ 2023-02-06 23:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1419944331

Comment:
If I build from Void's master branch, it fails to start the tests, with `ImportError: ../sage/rings/polynomial/polynomial_integer_dense_flint.cpython-311-aarch64-linux-gno.so: undefined symbol: fmpz_set_ZZ`. Strangely, in this last case I had to first build maxima without sbcl, as we discussed in the past, while in building the current PR I did not have to it.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (17 preceding siblings ...)
  2023-02-06 23:37 ` dkwo
@ 2023-02-06 23:42 ` dkwo
  2023-02-07 16:47 ` dkwo
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: dkwo @ 2023-02-06 23:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1419944331

Comment:
If I build from Void's master branch, it fails to start the tests, with `ImportError: ../sage/rings/polynomial/polynomial_integer_dense_flint.cpython-311-aarch64-linux-gno.so: undefined symbol: fmpz_set_ZZ`. Strangely, in this last case I had to first build maxima without sbcl, as we discussed in the past, while in building the current PR I did not have to do it.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (18 preceding siblings ...)
  2023-02-06 23:42 ` dkwo
@ 2023-02-07 16:47 ` dkwo
  2023-02-13 15:58 ` tornaria
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: dkwo @ 2023-02-07 16:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1683 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1421089276

Comment:
btw, `flintlib` currently fails checks on musl:
```
=> flintlib-2.9.0_1: running do_check ...
    CC   test_helpers.o
make[1]: Entering directory '/builddir/flintlib-2.9.0'
make[1]: Nothing to be done for 'shared'.
make[1]: Leaving directory '/builddir/flintlib-2.9.0'
make[1]: Entering directory '/builddir/flintlib-2.9.0'
make[1]: Nothing to be done for 'static'.
make[1]: Leaving directory '/builddir/flintlib-2.9.0'
make[1]: Entering directory '/builddir/flintlib-2.9.0'
mkdir -p build/test
    CC   build/test/t-add_ssaaaa
    CC   build/test/t-add_sssaaaaaa
    CC   build/test/t-add_ssssaaaaaaaa
    CC   build/test/t-byte_swap
    CC   build/test/t-count_leading_zeros
    CC   build/test/t-count_trailing_zeros
    CC   build/test/t-invert_limb
    CC   build/test/t-sdiv_qrnnd
    CC   build/test/t-smul_ppmm
    CC   build/test/t-sub_dddmmmsss
    CC   build/test/t-sub_ddmmss
    CC   build/test/t-udiv_qrnnd
    CC   build/test/t-udiv_qrnnd_preinv
    CC   build/test/t-umul_ppmm
make[1]: Leaving directory '/builddir/flintlib-2.9.0'
make[1]: Entering directory '/builddir/flintlib-2.9.0'
add_sssaaaaaa....add_ssaaaa....byte_swap....add_ssssaaaaaaaa....PASS
count_leading_zeros....PASS
count_trailing_zeros....PASS
invert_limb....PASS
sdiv_qrnnd....make[1]: *** [Makefile.subdirs:107: build/test/t-sdiv_qrnnd_RUN] Arithmetic exception
make[1]: *** Waiting for unfinished jobs....
PASS
PASS
PASS
make[1]: Leaving directory '/builddir/flintlib-2.9.0'
make: *** [Makefile:222: check] Error 2
```

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (19 preceding siblings ...)
  2023-02-07 16:47 ` dkwo
@ 2023-02-13 15:58 ` tornaria
  2023-02-13 16:08 ` dkwo
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-13 15:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1428190748

Comment:
sagemath 9.8 is released. I'll work on that.

Meanwhile, it would be helpful if all the other package updates can be merged.

Re: aarch64, can we move that to a separate issue? I'm not ready to support sagemath on aarch64 yet.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (20 preceding siblings ...)
  2023-02-13 15:58 ` tornaria
@ 2023-02-13 16:08 ` dkwo
  2023-02-13 18:31 ` [PR PATCH] [Updated] " tornaria
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: dkwo @ 2023-02-13 16:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 295 bytes --]

New comment by dkwo on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1428210189

Comment:
> Re: aarch64, can we move that to a separate issue? I'm not ready to support sagemath on aarch64 yet.

That makes sense, sorry for pulluting this thread.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (21 preceding siblings ...)
  2023-02-13 16:08 ` dkwo
@ 2023-02-13 18:31 ` tornaria
  2023-02-14  0:11 ` tornaria
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-13 18:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1748 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

- rebuild for boost update in sync with brial (same PR)
- fixes for numpy 1.24 (already updated in void)
- fixes to support updating giac to 1.9.0.37
- fixes to support updating tachyon to 0.99.5
- fixes to doctest failures in 32 bit after upgrade of pari to 2.15.2
- fix an edge case of python 3.11 integer conversion on 32 bit
- fix singular interface bug that triggers under very heavy load (e.g. on CI)
- tarball was moved; sha256 changed only b/c of main dirname change

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 314835 bytes --]

From e38c2f1b92bb56b14de6ed3c7e02fa2855ce8597 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 1/2] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From 8675dce8787370730cdaea6aec4fff6efc168e00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 2/2] sagemath: update to 9.8.

Also:
 - fix edge case of python 3.11 integer conversion on 32 bit
 - support tachyon 0.99.5
 - support singular 4.3.1p3
 - fix tests for giac 1.9.0.35
 - fix tests for numpy 1.24
 - skip unstable tests in klyachko.py
 - remove zn_poly dependency
---
 srcpkgs/sagemath/files/sage_conf.py           |    3 +-
 .../patches/09-doctest_numerical_fix.patch    |   14 -
 .../34980-avoid_factoring_in_is_prime.patch   |   47 +
 .../patches/34994-fix_tests_numpy_1.24.patch  |   58 +
 .../34995-support_tachyon_0.99.2.patch        |   57 +
 ...34997-fix_edge_case_of_integer_check.patch |   36 +
 .../35058-skip_unstable_tests_klyachko.patch  |   22 +
 .../35068-fix_tests_giac_1.9.0.35.patch       |   62 +
 .../patches/35094-support_gap_4.12.patch      | 1303 ++++++++++++
 srcpkgs/sagemath/patches/get_patches          |   40 +
 ...cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch |   53 -
 ...fc4ec8b8687bccd22d2e3161c86cf5553e06.patch |  427 ----
 ...rac-33842-01-python_3.11-de38bac21e2.patch |   66 -
 ...-python_3.11-argspec-fix-9eb08f3afde.patch |  168 --
 ...3-python3.11-final_fixes-7b6fa565f42.patch | 1279 ------------
 .../trac-33842-04-python3.11_fix_32_bit.patch |  212 --
 ...d4e56243c609f44afc1f21c112b026f9e1fe.patch |   42 -
 ...93d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch |  526 -----
 ...1318f032caf8dc1c0de9489346d894409091.patch |   19 -
 .../trac-34537-sagemath-pari-2.15.patch       | 1750 -----------------
 .../trac-34537-sagemath-pari-2.15b.patch      |   29 -
 ...e0de0dca1cff0355326dd42bd8c7e5749568.patch |   72 -
 ...-support_singular_4.3.1.p3-5e5737a0c.patch |  205 ++
 srcpkgs/sagemath/template                     |    8 +-
 srcpkgs/sagemath/update                       |    2 +
 25 files changed, 1838 insertions(+), 4662 deletions(-)
 delete mode 100644 srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
 create mode 100644 srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
 create mode 100644 srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
 create mode 100644 srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
 create mode 100644 srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
 create mode 100644 srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
 create mode 100755 srcpkgs/sagemath/patches/get_patches
 delete mode 100644 srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/files/sage_conf.py b/srcpkgs/sagemath/files/sage_conf.py
index 85ec37dfb50e..00de40f1ee4f 100644
--- a/srcpkgs/sagemath/files/sage_conf.py
+++ b/srcpkgs/sagemath/files/sage_conf.py
@@ -1,3 +1,4 @@
 # configuration for sage on void linux
 SAGE_SHARE = "/usr/share/sagemath"
-GAP_ROOT_DIR = "/usr/share/gap"
+GAP_SHARE_DIR = "/usr/share/gap"
+GAP_LIB_DIR = "/usr/lib/gap"
diff --git a/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch b/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
deleted file mode 100644
index 8780c8a97efa..000000000000
--- a/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
+++ /dev/null
@@ -1,14 +0,0 @@
- - This fixes a doctest failure due to a small numerical issue when running
-   maxima-sbcl on 32 bit
-
---- a/src/sage/interfaces/maxima_abstract.py
-+++ b/src/sage/interfaces/maxima_abstract.py
-@@ -1525,7 +1525,7 @@ class MaximaAbstractElement(ExtraTabCompletion, InterfaceElement):
-         EXAMPLES::
- 
-             sage: maxima('exp(-sqrt(x))').nintegral('x',0,1)
--            (0.5284822353142306, 4.1633141378838...e-11, 231, 0)
-+            (0.5284822353142306, 4.163...e-11, 231, 0)
- 
-         Note that GP also does numerical integration, and can do so to very
-         high precision very quickly::
diff --git a/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch b/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
new file mode 100644
index 000000000000..b1cf0eac41ae
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
@@ -0,0 +1,47 @@
+diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
+index 33481fead06..afea852bd56 100644
+--- a/src/sage/rings/number_field/number_field_ideal.py
++++ b/src/sage/rings/number_field/number_field_ideal.py
+@@ -995,16 +995,36 @@ def is_prime(self):
+             False
+             sage: K.ideal(17).is_prime()  # ramified
+             False
++
++        TESTS:
++
++        Check that we do not factor the norm of the ideal, this used
++        to take half an hour, see :trac:`33360`::
++
++            sage: K.<a,b,c> = NumberField([x^2-2,x^2-3,x^2-5])
++            sage: t = (((-2611940*c + 1925290/7653)*b - 1537130/7653*c
++            ....:       + 10130950)*a + (1343014/7653*c - 8349770)*b
++            ....:       + 6477058*c - 2801449990/4002519)
++            sage: t.is_prime()
++            False
+         """
+         try:
+             return self._pari_prime is not None
+         except AttributeError:
+-            F = self.factor()  # factorization with caching
+-            if len(F) != 1 or F[0][1] != 1:
+-                self._pari_prime = None
+-            else:
+-                self._pari_prime = F[0][0]._pari_prime
+-            return self._pari_prime is not None
++            pass
++
++        K = self.number_field().pari_nf()
++        I = self.pari_hnf()
++
++        self._pari_prime = K.idealismaximal(I) or None
++
++        # PARI uses probabilistic primality testing inside idealismaximal().
++        if self._pari_prime \
++                and get_flag(None, 'arithmetic') \
++                and not self._pari_prime[0].isprime():
++            self._pari_prime = None
++
++        return self._pari_prime is not None
+ 
+     def pari_prime(self):
+         r"""
diff --git a/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch b/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
new file mode 100644
index 000000000000..91f06fd4d173
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
@@ -0,0 +1,58 @@
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ def get_minmax_data(self):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ def fortran(self, line, cell):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch b/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
new file mode 100644
index 000000000000..2769e87f6a4b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
@@ -0,0 +1,57 @@
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e50892..ce1d50f71bc 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ def __call__(self, model, outfile='sage.png', verbose=1, extra_opts=''):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,25 @@ def usage(self, use_pager=True):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # random
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.readline()
++        res = re.search(r"Version ([\d.]*)", r)
++        # debian patches tachyon so it won't report the version
++        # we hardcode '0.99' since that's indeed the version they ship
++        return res[1] if res else '0.99'
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
diff --git a/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..11eb20d4f735
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,36 @@
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..d96b98f247c 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -309,7 +320,12 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+ 
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+-    cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    cdef long lead_3_overflow
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
++    else:
++        lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch b/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
new file mode 100644
index 000000000000..c4d7d5c779d1
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
@@ -0,0 +1,22 @@
+diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py
+index b1304a16913..77fae4b7545 100644
+--- a/src/sage/schemes/toric/sheaf/klyachko.py
++++ b/src/sage/schemes/toric/sheaf/klyachko.py
+@@ -26,7 +26,7 @@
+     (0, 0, 18, 16, 1)
+     sage: Gtilde = G_sum.random_deformation()
+     sage: V = Gtilde.wedge(2) * K                     # long time
+-    sage: V.cohomology(dim=True, weight=(0,0,0,0))    # long time
++    sage: V.cohomology(dim=True, weight=(0,0,0,0))    # long time  # random failure (see #32773)
+     (0, 0, 3, 0, 0)
+ 
+ REFERENCES:
+@@ -948,7 +948,7 @@ def random_deformation(self, epsilon=None):
+            sage: V.cohomology(dim=True, weight=(0,))
+            (1, 0)
+            sage: Vtilde = V.random_deformation()
+-           sage: Vtilde.cohomology(dim=True, weight=(0,))
++           sage: Vtilde.cohomology(dim=True, weight=(0,))  # random failure (see #32773)
+            (1, 0)
+         """
+         filt = self._filt.random_deformation(epsilon)
diff --git a/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch b/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
new file mode 100644
index 000000000000..d9a9835c696b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
@@ -0,0 +1,62 @@
+From 9ac7840134054155545e24fa3e66402d42b91c0f Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: [PATCH] Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451dba5e7..ccad5169836 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0fea30..b8896a94be9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
diff --git a/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch b/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
new file mode 100644
index 000000000000..499e0c71e256
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
@@ -0,0 +1,1303 @@
+diff --git a/build/pkgs/gap/checksums.ini b/build/pkgs/gap/checksums.ini
+index 066e943308a..b0ea8ba8818 100644
+--- a/build/pkgs/gap/checksums.ini
++++ b/build/pkgs/gap/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=gap-VERSION.tar.gz
+-sha1=4ecdd281b8f430282fb9b12690b06e0a26abde10
+-md5=85dc9e459d5b6c66fcad9f468afd3e3e
+-cksum=1351843158
++sha1=a6e36f3f874a2c46f51561402634497eab705cca
++md5=c5cd9f272f2703d7a3649ad7193b2d90
++cksum=2760477284
+ upstream_url=https://github.com/gap-system/gap/releases/download/vVERSION/gap-VERSION.tar.gz
+diff --git a/build/pkgs/gap/package-version.txt b/build/pkgs/gap/package-version.txt
+index d782fca8f64..f1cd7de1de5 100644
+--- a/build/pkgs/gap/package-version.txt
++++ b/build/pkgs/gap/package-version.txt
+@@ -1 +1 @@
+-4.11.1
++4.12.2
+diff --git a/build/pkgs/gap/spkg-check.in b/build/pkgs/gap/spkg-check.in
+index d9791d33293..d2fccda6e04 100644
+--- a/build/pkgs/gap/spkg-check.in
++++ b/build/pkgs/gap/spkg-check.in
+@@ -3,6 +3,13 @@ cd src
+ # #28728: Fix test failure in tst/testinstall/strings.tst
+ export LC_CTYPE=en_US.UTF-8
+ 
++# #34391: in GAP 4.12 some packages need GAP package io
++#         to let tests run, otherwise this hangs. Thus we install io here.
++cd pkg/io
++./configure --with-gaproot=../..
++make
++cd ../..
++
+ make testinstall
+ if [[ $? -ne 0 ]]; then
+     exit 1
+diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in
+index 2ceadf99db4..e2c8b4dca54 100644
+--- a/build/pkgs/gap/spkg-install.in
++++ b/build/pkgs/gap/spkg-install.in
+@@ -8,8 +8,7 @@ export CFLAGS=$CFLAGS_NON_NATIVE
+ export CXXFLAGS=$CXXFLAGS_NON_NATIVE
+ 
+ GAP_BUILD_ROOT="$(pwd)"
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
+-DESTDIR_GAP_ROOT="$SAGE_DESTDIR$GAP_ROOT"
++GAP_ROOT="$SAGE_LOCAL/lib/gap"
+ 
+ # Enable debug info if requested.
+ # Note that -g3 allows you to use preprocessor macros in gdb which are widely used
+@@ -17,37 +16,17 @@ if [ "$SAGE_DEBUG" = yes ] ; then
+     export CFLAGS="-O0 -g3 -DDEBUG_MASTERPOINTERS -DDEBUG_GLOBAL_BAGS -DDEBUG_FUNCTIONS_BAGS $CFLAGS"
+ fi
+ 
+-sdh_configure $SAGE_CONFIGURE_GMP
+-sdh_make -j1
++# LDFLAGS hack below needed by Semigroups package
++sdh_configure $SAGE_CONFIGURE_GMP LDFLAGS="-pthread" --prefix=$SAGE_LOCAL
++sdh_make
+ 
+-# GAP's "make install" is work in progress; we use bits and pieces of it
+-# but we install many things manually.
+-sdh_make install-headers install-libgap
+-
+-# Install config.h, which is not currently handled by `make install-headers`
+-sdh_install gen/config.h "$SAGE_LOCAL/include/gap"
+-
+-# Now install the gap executable as "gap-bin"; it will be called normally
+-# through our wrapper script that sets the appropriate GAP_ROOT
+-SAGE_BIN="$SAGE_LOCAL/bin"
+-mkdir -p "$SAGE_DESTDIR$SAGE_BIN" || sdh_die "Failed to create the directory $SAGE_BIN"
+-
+-./libtool --mode=install install gap "$SAGE_DESTDIR$SAGE_BIN/gap-bin" || \
+-    sdh_die "Failed to install gap-bin to $SAGE_BIN"
+-
+-./libtool --mode=install install gac "$SAGE_DESTDIR$SAGE_BIN/gac" || \
+-    sdh_die "Failed to install gac to $SAGE_BIN"
+-
+-# Now copy additional files GAP needs to run (and a few optional bits) into
+-# GAP_ROOT; we don't need everything from the source tree
+-sdh_install bin doc gen grp lib src tst sysinfo.gap "$GAP_ROOT"
+-
+-# GAP's copy of libtool is also used by the toolchain for build GAP packages
+-# (i.e. by gac)
+-sdh_install libtool "$GAP_ROOT"
++sdh_make_install
++# sdh_make install-headers install-libgap
++# The 'packagemanager' package expects this https://github.com/gap-packages/PackageManager/issues/105
++mkdir -p "$SAGE_LOCAL/lib/gap/bin"
+ 
+ # Install only the minimal packages GAP needs to run
+-sdh_install pkg/GAPDoc-* pkg/primgrp-* pkg/SmallGrp-* pkg/transgrp "$GAP_ROOT"/pkg
++sdh_install pkg/gapdoc pkg/primgrp pkg/smallgrp pkg/transgrp "$GAP_ROOT"/pkg
+ 
+ # Install additional packages that are not strictly required, but that are
+ # typically "expected" to be loaded: These are the default packages that are
+@@ -58,50 +37,25 @@ sdh_install pkg/GAPDoc-* pkg/primgrp-* pkg/SmallGrp-* pkg/transgrp "$GAP_ROOT"/p
+ # Also include atlasrep which is a dependency of tomlib
+ sdh_install \
+     pkg/atlasrep \
+-    pkg/autpgrp-* \
+-    pkg/alnuth-* \
+-    pkg/crisp-* \
+-    pkg/ctbllib-* \
+-    pkg/FactInt-* \
++    pkg/autodoc \
++    pkg/autpgrp \
++    pkg/alnuth \
++    pkg/crisp \
++    pkg/ctbllib \
++    pkg/factint \
+     pkg/fga \
+-    pkg/irredsol-* \
+-    pkg/laguna-* \
+-    pkg/PackageManager-* \
+-    pkg/polenta-* \
+-    pkg/polycyclic-* \
+-    pkg/resclasses-* \
+-    pkg/sophus-* \
+-    pkg/tomlib-* \
++    pkg/irredsol \
++    pkg/laguna \
++    pkg/packagemanager \
++    pkg/polenta \
++    pkg/polycyclic \
++    pkg/radiroot \
++    pkg/resclasses \
++    pkg/sophus \
++    pkg/tomlib \
++    pkg/utils \
+     "$GAP_ROOT"/pkg
+ 
+-# Install the GAP startup script; ensure it is executable
+-sdh_install -T ../gap "$SAGE_BIN/gap"
+-chmod +x "$SAGE_DESTDIR$SAGE_BIN/gap"
+-
+-# Create symlinks under $GAP_ROOT for these executables, as they are expected
+-# (especially when building kernel packages) to exist
+-ln -sf "../../bin/gap-bin" "$DESTDIR_GAP_ROOT/gap"
+-ln -sf "../../bin/gac" "$DESTDIR_GAP_ROOT/gac"
+-
+-# Fix the $GAP_ROOT/bin/<arch>/src symlink to be relative (otherwise it links
+-# to the actual path of the sources GAP was compiled from)
+-for srclink in "$DESTDIR_GAP_ROOT"/bin/*/src; do
+-    rm -f "$srclink"
+-    ln -s "../../src" "$srclink"
+-done
+-
+-# Additional fixups for some files after they have been copied into their
+-# destination directory.  gac and sysinfo.gap are generated files that contain
+-# in them hard-coded references to the GAP build directory, which will soon
+-# be going away.  This breaks the build toolchain for some compiled GAP
+-# packages.  We need to replace these paths with the final GAP_ROOT path.  The
+-# below will work so long as neither of these paths contain '|', and if they do
+-# then god help you.  https://trac.sagemath.org/ticket/27218
+-sed -i -e "s|$GAP_BUILD_ROOT|$GAP_ROOT|g" \
+-    "$SAGE_DESTDIR$SAGE_BIN/gac" "$DESTDIR_GAP_ROOT/sysinfo.gap" \
+-    "$DESTDIR_GAP_ROOT/bin/gap.sh" "$DESTDIR_GAP_ROOT/doc/make_doc" || \
+-    sdh_die "Failed to fix up hard-coded paths in GAP build tools."
+-
+ # TODO: This seems unnecessary--we are already installing all of doc/ to
+ # GAP_ROOT, which is necessary for some functionality in GAP to work.  Do
+ # we need this?  Maybe doc/gap could just be a symlink to gap/doc??
+diff --git a/build/pkgs/gap/spkg-legacy-uninstall b/build/pkgs/gap/spkg-legacy-uninstall
+index d17eb939eb7..a8e5c59e1fb 100755
+--- a/build/pkgs/gap/spkg-legacy-uninstall
++++ b/build/pkgs/gap/spkg-legacy-uninstall
+@@ -4,6 +4,8 @@ rm -rf "$SAGE_LOCAL/gap/gap-4."*
+ rm -rf "$SAGE_SHARE/gap"
+ rm -f "$SAGE_LOCAL/gap/latest"
+ rm -f "$SAGE_LOCAL/bin/gap"
++rm -f "$SAGE_LOCAL/bin/gac"
+ 
+-# Remove old libgap headers
++# Remove old libgap headers and library
+ rm -rf "$SAGE_LOCAL/include/gap"
++rm -rf "$SAGE_LOCAL/lib/gap"
+diff --git a/build/pkgs/gap/spkg-prerm.in b/build/pkgs/gap/spkg-prerm.in
+deleted file mode 100644
+index 661d92621fa..00000000000
+--- a/build/pkgs/gap/spkg-prerm.in
++++ /dev/null
+@@ -1,6 +0,0 @@
+-# These generated files are placed in directory provided by the SPKG, so
+-# delete the generated files first so that their parent directories can be
+-# removed during installation
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
+-rm -f "$GAP_ROOT/pkg/atlasrep/datagens/"*.*
+-rm -f "$GAP_ROOT/pkg/atlasrep/dataword/"*.*
+diff --git a/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch b/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch
+deleted file mode 100644
+index e45fe7d9c6f..00000000000
+--- a/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch
++++ /dev/null
+@@ -1,150 +0,0 @@
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c b/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-index 3bbdc45..7df699f 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-@@ -8,9 +8,8 @@ extern short sp[],**mat[],*psp[],**imcos[],**cpco[],lorb[],
+- short *cst,**cpst,***cdpst,**svptr,*cp,*rel;
+- short *spst,**pspst,**pptr,**cpptr,npt,nb,nph,nph2,npg,npg2,
+-       rno,orno,coh_index,*invg;
+--FILE  *ip,*op;
+- 
+--void seeknln (void) { while (getc(ip)!='\n'); }
+-+void seeknln (FILE *ip) { while (getc(ip)!='\n'); }
+- 
+- /* This program differs from most other permutation programs in that perms are
+-    all stored in the single array sp. Schreier vectors are stored in the short
+-@@ -23,13 +22,14 @@ void seeknln (void) { while (getc(ip)!='\n'); }
+- int 
+- crprog1 (void)
+- { short *pc,*qc,ex,neg; int x;
+-+  FILE  *ip,*op;
+-   short i,j,k,l,m,n,cl,rl,*p,ocl,im,pt,pt1,pn,ipt;
+-   if ((ip=fopen(inf2,"r"))== 0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf2); return(-1);}
+-   fscanf(ip,"%hd%hd%hd%hd",&npt,&nph,&nb,&k);
+-   if (nb>=mb) {fprintf(stderr,"nb too big. Increase MB.\n"); return(-1);}
+-   if (k<=2) {fprintf(stderr,"inf2 has illegal format.\n"); return(-1); }
+--  seeknln(); seeknln();
+-+  seeknln(ip); seeknln(ip);
+-   for (i=1;i<=nb;i++) fscanf(ip,"%hd",lorb+i);
+-   pptr=psp-1; pspst=psp+nph; svptr=cpsp-1;  cpst=cpsp+nb;
+-   invg=sp; nph2=2*nph; spst=sp+nph2;
+-@@ -37,7 +37,7 @@ crprog1 (void)
+-   { pptr[i]=spst+(i-1)*npt-1; p=pptr[i];
+-     for (j=1;j<=npt;j++) {fscanf(ip,"%hd",&k); p[k]=j; }
+-     invg[2*i-2]=2*i-1; invg[2*i-1]=2*i-2;
+--    seeknln();
+-+    seeknln(ip);
+-   }
+-   spst+=(npt*nph);
+-   for (i=1;i<=nb;i++)
+-@@ -75,7 +75,7 @@ crprog1 (void)
+-   strcpy(inf1,inf0); strcat(inf1,".rel");
+-   if ((ip=fopen(inf1,"r"))==0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf1); return(-1);}
+--  fscanf(ip,"%hd%hd",&k,&rno); seeknln();
+-+  fscanf(ip,"%hd%hd",&k,&rno); seeknln(ip);
+-   op=fopen(outft,"w");
+- /* Now we have read everything in, and the computation can start */
+-   orno=0;
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-index a7396b2..658496f 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-@@ -20,8 +20,6 @@ short  mexp=MEXP,mcl=MCL,no,rel[RSP],wt[MEXP],exp,*rpf,*rpb,
+- extern short  prime,dim,*spv,**spm,mspace[],*vec[],**mat[],cp[],pinv[],opmats,
+-         mm,mv;
+- extern int msp;
+--FILE *ip,*op;
+--
+- 
+- int 
+- calcmats (void)
+-@@ -59,7 +57,7 @@ calcmats (void)
+-   }
+-   for (i=1;i<=exp;i++) trans(mat[i+exp],mat[i]);
+-   if (opmats)
+--  { op=fopen(outf,"w");
+-+  { FILE *op=fopen(outf,"w");
+-     fprintf(op,"%4d%4d%4d\n",prime,dim,exp);
+-     for (i=1;i<=exp;i++) printmat(mat[i]); 
+-     fclose(op);
+-@@ -71,6 +69,7 @@ int
+- rdmats (void)
+- /* reads matrices of generators of P */
+- { short i; int quot;
+-+  FILE *ip;
+-   ip=fopen(inf4,"r");
+-   if (ip==0)
+-   { fprintf(stderr,"Cannot open %s\n ",inf4); return(-1); }
+-@@ -90,12 +89,12 @@ rdmats (void)
+-   fclose(ip);
+-   return(0);
+- }
+--FILE *ip;
+- 
+- int 
+- ingp (int inp)
+- /* Read in output of respcrun -s */
+- { short i,j,k,l,m,*orpf,**pcp;
+-+  FILE *ip;
+-   ip=fopen(inf3,"r");
+-   if (ip==0) { fprintf(stderr,"Cannot open %s\n",inf3); return(-1); }
+-   fscanf(ip,"%hd%hd%hd%hd%hd%hd",&prime,&exp,&i,&no,&j,&m);
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-index 0896551..6841bc8 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-@@ -9,7 +9,6 @@ extern short  intexp,mexp,mng,wksp,
+-        spugen[],*tlintg[];
+- extern int ptrsp,rsp;
+- short  fac;
+--FILE *ip,*op;
+- 
+- int 
+- ingp (void)
+-@@ -18,6 +17,7 @@ ingp (void)
+-    of nqrun, and tails are also read in.
+- */
+- { short i,j,k,l,m,x,y,no,*orpf,*orpb,**pcp;  char tails;
+-+  FILE *ip;
+-   if ((ip=fopen(inf1,"r"))==0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf1); return(-1); }
+-   fscanf(ip,"%hd%hd%hd%hd%hd%hd",&prime,&exp,&nng,&no,&class,&m);
+-@@ -89,6 +89,7 @@ int
+- outgp (void)
+- /* The PCP is output, together with tails */
+- { short i,k,l,**pcp,*b,*e,*c;
+-+  FILE *op;
+-   op=fopen(outf,"w");
+-   fprintf(op,"%4d%4d%4d%4d%4d%4d\n",prime,exp,nng,exp,class,1);
+-   for (i=1;i<=exp;i++) fprintf(op,"%4d",wt[i]); fprintf(op,"\n");
+-@@ -379,7 +380,7 @@ restart:
+-     nng--; mnng--; enexpnt--;
+-     if (nng==0)
+-     { if (gap)
+--      { op=fopen(outfm,"w"); fprintf(op,"COHOMOLO.Multiplier:=[];\n");
+-+      { FILE *op=fopen(outfm,"w"); fprintf(op,"COHOMOLO.Multiplier:=[];\n");
+-         fclose(op);
+-         printf("All new generators eliminated. Multiplier is trivial.\n");
+-       }
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-index 01cf914..0144883 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-@@ -9,7 +9,6 @@ extern short  intexp,mng,mexp,wksp,
+-        spugen[],*intg[],*imintg[],*tlintg[];
+- extern int ptrsp,rsp;
+- short  *wf,*wc; char norm;
+--FILE *ip,*op;
+- 
+- /* The data structures for this program and for nqrun are similar.
+-    d1 and d2 contain definitions of generators. (Def. comes from commutator
+-@@ -35,6 +34,7 @@ nqmprog (void)
+- { short i,j,k,l,m,d,*gi,*gj,*ti,*tj,cl,def,*ps,*pf,**dp,*nrpb,*p,*orpf,*orpb,
+-         nb,np,k1,*rno,*covrel,**pgen,tdef,sgn;
+-   char nt;
+-+  FILE *ip,*op;
+-   if (ingp() == -1) {fprintf(stderr,"Input error.\n"); return(-1); }
+-   eexpnt=expnt+exp; enexpnt=nexpnt+nng;
+- 
+diff --git a/build/pkgs/gap_packages/patches/guava_leon_includes.patch b/build/pkgs/gap_packages/patches/guava_leon_includes.patch
+deleted file mode 100644
+index cdcd19cc3e8..00000000000
+--- a/build/pkgs/gap_packages/patches/guava_leon_includes.patch
++++ /dev/null
+@@ -1,13 +0,0 @@
+---- a/pkg/guava-3.15/src/leon/src/generate.c	Sat Feb 29 09:02:10 2020
+---- b/pkg/guava-3.15/src/leon/src/generate.c	Thu Sep 24 13:58:36 2020
+-***************
+-*** 115,120 ****
+---- 115,122 ----
+-  #include "groupio.h"
+-  #include "enum.h"
+-  #include "storage.h"
+-+ #include "chbase.h"
+-+ #include "inform.h"
+-  
+-  #ifdef ALT_TIME_HEADER
+-  #include "cputime.h"
+diff --git a/build/pkgs/gap_packages/spkg-install.in b/build/pkgs/gap_packages/spkg-install.in
+index 168e6b11532..6dff182a48f 100644
+--- a/build/pkgs/gap_packages/spkg-install.in
++++ b/build/pkgs/gap_packages/spkg-install.in
+@@ -1,4 +1,4 @@
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
++GAP_ROOT="$SAGE_LOCAL/lib/gap"
+ PKG_DIR="$GAP_ROOT/pkg"
+ 
+ PKG_SRC_DIR="$(pwd)/src/pkg"
+@@ -11,33 +11,31 @@ cd "$PKG_SRC_DIR"
+ #    (GAP 4.8.6 still had it, but this is gone in 4.10)
+ 
+ sdh_install \
+-    aclib-* \
+-    AutoDoc-* \
+-    corelg-* \
+-    crime-* \
++    aclib \
++    corelg \
++    crime \
+     cryst \
+     crystcat \
+-    design-* \
++    design \
+     gbnp \
+-    genss-* \
+-    hap-* \
+-    hapcryst-* \
+-    hecke-* \
+-    images-* \
+-    liealgdb-* \
+-    liepring-* \
+-    liering-* \
+-    loops-* \
+-    MapClass-* \
+-    polymaking-* \
+-    qpa-* \
+-    quagroup-* \
+-    radiroot-* \
+-    repsn-* \
+-    sla-* \
+-    sonata-* \
+-    Toric-* \
+-    utils-* \
++    genss \
++    hap \
++    hapcryst \
++    hecke \
++    images \
++    liealgdb \
++    liepring \
++    liering \
++    loops \
++    mapclass \
++    polymaking \
++    qpa \
++    quagroup \
++    repsn \
++    singular \
++    sla \
++    sonata \
++    toric \
+     "$PKG_DIR"
+ 
+ install_compiled_pkg()
+@@ -45,27 +43,23 @@ install_compiled_pkg()
+     local pkg="$1"
+     # Install the bin/ dir (where compiled modules should end up)
+     # under <prefix>/lib/gap; we then symlink to it later
+-    sdh_install bin "$SAGE_LOCAL/lib/gap/pkg/$pkg"
++    sdh_install * "$SAGE_LOCAL/lib/gap/pkg/$pkg"
+ 
++    # TODO:
+     # Clean up any build artificts before installing the rest of the package
+     # Also remove configure/Makefiles
+     # Note: None, if any of the packages really have a proper install target
+-    make clean  # Works for some packages but not all
+-    rm -rf bin/
+-    rm -rf configure configure.* config.* autogen.sh *.m4 Makefile* m4/
++    #make clean  # Works for some packages but not all
++    #rm -rf bin/
++    #rm -rf configure configure.* config.* autogen.sh *.m4 Makefile* m4/
+ 
+-    # Create the bin/ symlink
+-    ln -s "$SAGE_LOCAL/lib/gap/pkg/$pkg/bin" bin
+-
+-    # Install the rest of the package files
+-    sdh_install * "$PKG_DIR/$pkg"
+ }
+ 
+ # Build and install compiled packages:
+ #
+ # These packages have an old ./configure that take the GAP_ROOT as a positional
+ # argument
+-for pkg in cohomolo-* crypting-* grape-* guava-* orb-* datastructures-*
++for pkg in cohomolo crypting grape guava orb datastructures
+ do
+     echo "Building GAP package $pkg"
+     CFLAGS="$CFLAGS -Wno-implicit-function-declaration"
+@@ -91,7 +85,7 @@ pararr=( " " " " "--with-external-planarity" "--with-external-libsemigroups" )
+ ##############################################################################
+ 
+ parind=0
+-for pkg in nq-* io-* digraphs-* semigroups-*
++for pkg in nq io digraphs semigroups
+ do
+     echo "Building GAP package $pkg"
+     cd "$PKG_SRC_DIR/$pkg"
+diff --git a/build/pkgs/libsemigroups/checksums.ini b/build/pkgs/libsemigroups/checksums.ini
+index 62c4268515f..4e13a36cb35 100644
+--- a/build/pkgs/libsemigroups/checksums.ini
++++ b/build/pkgs/libsemigroups/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=libsemigroups-VERSION.tar.gz
+-sha1=2b16c095cc5ffd3f77a71dfbf48cce188e054c03
+-md5=7082cadcf7a195ccb93175cd72b6db95
+-cksum=1501022358
++sha1=86375824b47ce4b0e23570122e873f67136d0c0a
++md5=ff79ad5fbc8bfeb64d48faaf24106b98
++cksum=2845045455
+ upstream_url=https://github.com/libsemigroups/libsemigroups/releases/download/vVERSION/libsemigroups-VERSION.tar.gz
+diff --git a/build/pkgs/libsemigroups/package-version.txt b/build/pkgs/libsemigroups/package-version.txt
+index 9084fa2f716..f90b1afc082 100644
+--- a/build/pkgs/libsemigroups/package-version.txt
++++ b/build/pkgs/libsemigroups/package-version.txt
+@@ -1 +1 @@
+-1.1.0
++2.3.2
+diff --git a/build/pkgs/libsemigroups/spkg-install.in b/build/pkgs/libsemigroups/spkg-install.in
+index 2aaf0e99043..128b54d2f99 100644
+--- a/build/pkgs/libsemigroups/spkg-install.in
++++ b/build/pkgs/libsemigroups/spkg-install.in
+@@ -1,4 +1,4 @@
+ cd src
+-sdh_configure
++sdh_configure --disable-eigen
+ sdh_make
+ sdh_make_install
+diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4
+index d4d145defe3..6a85631f624 100644
+--- a/build/pkgs/singular/spkg-configure.m4
++++ b/build/pkgs/singular/spkg-configure.m4
+@@ -9,52 +9,7 @@ SAGE_SPKG_CONFIGURE([singular], [
+        AC_MSG_CHECKING([that Singular's help is working])
+        AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error occurred"` = x], [
+         AC_MSG_RESULT(yes)
+-        dnl We have Singular. Now determine the shared library path on
+-        dnl platforms on which sage.libs.singular needs to reload the library with RTLD_GLOBAL.
+-        AS_CASE([$host_os],
+-          [cygwin*], [dnl Nothing to do
+-                     ],
+-                     [dnl Use pkg-config to get singular's libdir while we're at it. As a
+-                      dnl moral compromise for using pkg-config, this ultimately allows us
+-                      dnl to pass an absolute path to dlopen(), which is the only approach
+-                      dnl that POSIX guarantees will work.
+-                      PKG_CHECK_VAR([SINGULAR_LIB_DIR], [Singular], [libdir])
+-                      dnl The acl_shlibext variable is set in the top-level configure.ac.
+-                      AC_LANG_PUSH(C)
+-                      ORIG_LIBS="${LIBS}"
+-                      LIBS="${LIBS} -ldl"
+-                      AC_MSG_CHECKING([if we can dlopen($LIBSINGULAR_PATH)])
+-                      LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libSingular.${acl_shlibext}"
+-
+-                      dnl if we can dlopen() it, substitute the name for sage_conf;
+-                      dnl otherwise, fall back to using the SPKG.
+-                      AC_RUN_IFELSE(
+-                        [AC_LANG_PROGRAM(
+-                          [[#include <dlfcn.h>]],
+-                          [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
+-                            if (h == 0) { return 1; } else { return dlclose(h); }]]
+-                        )], [
+-                          AC_MSG_RESULT(yes)
+-                        ], [
+-                          dnl try Debian-specific name
+-                          LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libsingular-Singular.${acl_shlibext}"
+-                          AC_RUN_IFELSE(
+-                           [AC_LANG_PROGRAM(
+-                             [[#include <dlfcn.h>]],
+-                             [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
+-                               if (h == 0) { return 1; } else { return dlclose(h); }]]
+-                           )], [
+-                             AC_MSG_RESULT(yes)
+-                           ], [
+-                            AC_MSG_RESULT(no)
+-                            sage_spkg_install_singular=yes
+-                          ], [AC_MSG_RESULT(yes)])
+-                        ], [AC_MSG_RESULT(yes)])
+-
+-                      AC_LANG_POP()
+-                      LIBS="${ORIG_LIBS}"
+-                     ]
+-       )], [
++       ], [
+        AC_MSG_RESULT(no)
+        sage_spkg_install_singular=yes
+        ]
+@@ -64,20 +19,4 @@ SAGE_SPKG_CONFIGURE([singular], [
+       ])
+     ])
+   ])
+-],[],[],[
+-  dnl Post-check phase
+-  dnl We make the sage_conf substitutions here, because the "default"
+-  dnl substitution needs to be made even if we skipped the system-Singular
+-  dnl checks themselves.
+-  AS_IF([test "x${sage_spkg_install_singular}" = "xyes"], [
+-    AS_CASE([$host_os],
+-      [cygwin*], [dnl Nothing to do
+-                 ],
+-                 [dnl Set shared library path, needed for reloading the library with RTLD_GLOBAL
+-                  LIBSINGULAR_PATH="\$SAGE_LOCAL/lib/libSingular.${acl_shlibext}"
+-                 ]
+-    )
+-  ])
+-
+-  AC_SUBST(LIBSINGULAR_PATH, "${LIBSINGULAR_PATH}")
+ ])
+diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in
+index 6cd28f558a8..d66bdb3d264 100644
+--- a/pkgs/sage-conf/_sage_conf/_conf.py.in
++++ b/pkgs/sage-conf/_sage_conf/_conf.py.in
+@@ -55,9 +55,6 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"
+ OPENMP_CFLAGS = "@OPENMP_CFLAGS@"
+ OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"
+ 
+-# The full absolute path to the main Singular library.
+-LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)
+-
+ # Installation location of wheels. This is determined at configuration time
+ # and does not depend on the installation location of sage-conf.
+ SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels"
+diff --git a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
+index c917338e444..182e74aad20 100644
+--- a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
++++ b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
+@@ -139,12 +139,12 @@ string, which you can print::
+     X.1      1  1  1  1  1  1  1  1  1  1  1  1  1
+     X.2      1 -1  1  1 -1  1  1 -1 -1 -1  1  1  1
+     X.3      2  .  2 -1  .  2  2  .  .  . -1  2  2
+-    X.4      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
+-    X.5      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
+-    X.6      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
+-    X.7      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
+-    X.8      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
+-    X.9      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
++    X.4      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
++    X.5      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
++    X.6      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
++    X.7      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
++    X.8      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
++    X.9      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
+     X.10     4 -2  . -1  .  .  .  2  .  .  1  . -4
+     X.11     4  2  . -1  .  .  . -2  .  .  1  . -4
+     X.12     6  . -2  .  . -2 -2  .  .  .  .  2  6
+diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx
+index de5db985e0b..c83b9264e44 100644
+--- a/src/sage/coding/codecan/autgroup_can_label.pyx
++++ b/src/sage/coding/codecan/autgroup_can_label.pyx
+@@ -76,7 +76,7 @@ columns do share the same coloring::
+     ((1,),
+      (2,),
+      (3, 5, 4),
+-     (6, 19, 16, 9, 21, 10, 8, 15, 14, 11, 20, 13, 12, 7, 17, 18))
++     (6, 19, 16, 21, 9, 10, 15, 8, 20, 11, 14, 13, 7, 12, 18, 17))
+ 
+ We can also restrict the group action to linear isometries::
+ 
+diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py
+index a3ac3ca1547..bfb9f8696e8 100644
+--- a/src/sage/coding/linear_code.py
++++ b/src/sage/coding/linear_code.py
+@@ -465,27 +465,27 @@ def automorphism_group_gens(self, equivalence="semilinear"):
+             0
+             sage: C = codes.HammingCode(GF(4, 'z'), 3)
+             sage: C.automorphism_group_gens()
+-            ([((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
++            ([((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
++                Defn: z |--> z + 1),
++              ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z + 1),
+-              ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
+-                Defn: z |--> z),
+               ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+              362880)
+             sage: C.automorphism_group_gens(equivalence="linear")
+-            ([((z + 1, 1, z + 1, z + 1, z + 1, z, 1, z, 1, 1, 1, 1, z + 1, z + 1, z + 1, z, z, 1, z, z, z); (1,15,2,8,16,18,3)(4,9,12,13,20,10,11)(5,21,14,6,7,19,17), Ring endomorphism of Finite Field in z of size 2^2
++            ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((z + 1, z + 1, z + 1, z + 1, z + 1, 1, z, 1, z, z, z, 1, z, 1, 1, 1, z + 1, z + 1, z + 1, 1, z); (1,15,21,8,9)(2,18,5,3,11,16,7,10,19,13,12,4,17,6,20), Ring endomorphism of Finite Field in z of size 2^2
++              ((z + 1, z + 1, z + 1, z, 1, 1, z, z, 1, z + 1, z, 1, 1, z, 1, z + 1, z, z + 1, z + 1, 1, z); (1,3,18,2,17,6,19)(4,15,13,20,7,14,16)(5,11,8,21,12,9,10), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+               ((z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1); (), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+              181440)
+             sage: C.automorphism_group_gens(equivalence="permutational")
+-            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
++            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
++              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,18)(3,19)(4,10)(5,16)(8,13)(9,14)(11,21)(15,20), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,17)(2,8)(3,14)(4,10)(7,12)(9,19)(13,18)(15,20), Ring endomorphism of Finite Field in z of size 2^2
++              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+               ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,13)(3,14)(4,20)(5,11)(8,18)(9,19)(10,15)(16,21), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+@@ -691,10 +691,10 @@ def _canonize(self, equivalence):
+             sage: C_iso == aut_group_can_label.get_canonical_form()
+             True
+             sage: aut_group_can_label.get_autom_gens()
+-            [((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
++            [((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
++               Defn: z |--> z + 1),
++             ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
+                Defn: z |--> z + 1),
+-             ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
+-               Defn: z |--> z),
+              ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
+                Defn: z |--> z)]
+         """
+diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py
+index 2836d59d960..8c882d5ac3b 100644
+--- a/src/sage/combinat/posets/posets.py
++++ b/src/sage/combinat/posets/posets.py
+@@ -8813,7 +8813,7 @@ def _libgap_(self):
+             sage: libgap(P)  # optional - gap_packages
+             <A poset on 5 points>
+             sage: A = libgap(GF(2)).PosetAlgebra(P); A  # optional - gap_packages
+-            <GF(2)[<quiver with 5 vertices and 5 arrows>]/<two-sided ideal in <GF(2)[<quiver with 5 vertices and 5 arrows>]>, (1 generators)>>
++            <GF(2)[<quiver with 5 vertices and 5 arrows>]/<two-sided ideal in <GF(2)[<quiver with 5 vertices and 5 arrows>]>, (1 generator)>>
+             sage: A.Dimension()  # optional - gap_packages
+             13
+         """
+diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py
+index 6b756bafc30..8ac99319bec 100644
+--- a/src/sage/combinat/root_system/hecke_algebra_representation.py
++++ b/src/sage/combinat/root_system/hecke_algebra_representation.py
+@@ -357,7 +357,7 @@ def Tw(self, word, signs=None, scalar=None):
+             sage: q1, q2 = K.gens()
+             sage: KW = W.algebra(K)
+             sage: x = KW.an_element(); x
+-            123 + 3*32 + 2*3 + e
++            123 + 3*2312 + 2*31 + e
+ 
+             sage: T = KW.demazure_lusztig_operators(q1,q2)
+             sage: T12 = T.Tw( (1,2) )
+diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py
+index b8a0bebab44..9bccba124c8 100644
+--- a/src/sage/combinat/symmetric_group_algebra.py
++++ b/src/sage/combinat/symmetric_group_algebra.py
+@@ -101,7 +101,7 @@ def SymmetricGroupAlgebra(R, W, category=None):
+         sage: SGA.group()
+         Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space)
+         sage: SGA.an_element()
+-        s1*s2*s3 + 3*s3*s2 + 2*s3 + 1
++        s1*s2*s3 + 3*s2*s3*s1*s2 + 2*s3*s1 + 1
+ 
+     The preferred way to construct the symmetric group algebra is to
+     go through the usual ``algebra`` method::
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 911f34b1bc6..5f7aca8599c 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -197,7 +197,8 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ GRAPHS_DATA_DIR = var("GRAPHS_DATA_DIR", join(SAGE_SHARE, "graphs"))
+ ELLCURVE_DATA_DIR = var("ELLCURVE_DATA_DIR", join(SAGE_SHARE, "ellcurves"))
+ POLYTOPE_DATA_DIR = var("POLYTOPE_DATA_DIR", join(SAGE_SHARE, "reflexive_polytopes"))
+-GAP_ROOT_DIR = var("GAP_ROOT_DIR", join(SAGE_SHARE, "gap"))
++GAP_LIB_DIR = var("GAP_LIB_DIR", join(SAGE_LOCAL, "lib", "gap"))
++GAP_SHARE_DIR = var("GAP_SHARE_DIR", join(SAGE_SHARE, "gap"))
+ THEBE_DIR = var("THEBE_DIR", join(SAGE_SHARE, "thebe"))
+ COMBINATORIAL_DESIGN_DATA_DIR = var("COMBINATORIAL_DESIGN_DATA_DIR", join(SAGE_SHARE, "combinatorial_designs"))
+ CREMONA_MINI_DATA_DIR = var("CREMONA_MINI_DATA_DIR", join(SAGE_SHARE, "cremona"))
+@@ -229,12 +230,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ LIE_INFO_DIR = var("LIE_INFO_DIR", join(SAGE_LOCAL, "lib", "LiE"))
+ SINGULAR_BIN = var("SINGULAR_BIN") or "Singular"
+ 
+-# The path to libSingular, to be passed to dlopen(). This will
+-# typically be set to an absolute path in sage_conf, but the relative
+-# fallback path here works on systems where dlopen() searches the
+-# system's library locations.
+-LIBSINGULAR_PATH = var("LIBSINGULAR_PATH", "libSingular.so")
+-
+ # OpenMP
+ OPENMP_CFLAGS = var("OPENMP_CFLAGS", "")
+ OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
+@@ -255,81 +250,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ SAGE_GAP_COMMAND = var('SAGE_GAP_COMMAND', _gap_cmd)
+ 
+ 
+-def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+-    """
+-    Return the full path to a shared library file installed in
+-    ``$SAGE_LOCAL/lib`` or the directories associated with the
+-    Python sysconfig.
+-
+-    This can also be passed more than one library name (e.g. for cases where
+-    some library may have multiple names depending on the platform) in which
+-    case the first one found is returned.
+-
+-    This supports most *NIX variants (in which ``lib<libname>.so`` is found
+-    under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
+-    extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
+-    or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
+-
+-    For distributions like Debian that use a multiarch layout, we also try the
+-    multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
+-
+-    This returns ``None`` if no matching library file could be found.
+-
+-    EXAMPLES::
+-
+-        sage: from sage.env import _get_shared_lib_path
+-        sage: "gap" in _get_shared_lib_path("gap")
+-        True
+-        sage: _get_shared_lib_path("an_absurd_lib") is None
+-        True
+-
+-    """
+-
+-    for libname in libnames:
+-        search_directories: List[Path] = []
+-        patterns: List[str] = []
+-        if sys.platform == 'cygwin':
+-            # Later down we take the first matching DLL found, so search
+-            # SAGE_LOCAL first so that it takes precedence
+-            if SAGE_LOCAL:
+-                search_directories.append(Path(SAGE_LOCAL) / 'bin')
+-            search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
+-            # Note: The following is not very robust, since if there are multible
+-            # versions for the same library this just selects one more or less
+-            # at arbitrary. However, practically speaking, on Cygwin, there
+-            # will only ever be one version
+-            patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
+-        else:
+-            if sys.platform == 'darwin':
+-                ext = 'dylib'
+-            else:
+-                ext = 'so'
+-
+-            if SAGE_LOCAL:
+-                search_directories.append(Path(SAGE_LOCAL) / 'lib')
+-            libdir = sysconfig.get_config_var('LIBDIR')
+-            if libdir is not None:
+-                libdir = Path(libdir)
+-                search_directories.append(libdir)
+-
+-                multiarchlib = sysconfig.get_config_var('MULTIARCH')
+-                if multiarchlib is not None:
+-                    search_directories.append(libdir / multiarchlib),
+-
+-            patterns = [f'lib{libname}.{ext}']
+-
+-        for directory in search_directories:
+-            for pattern in patterns:
+-                path = next(directory.glob(pattern), None)
+-                if path is not None:
+-                    return str(path.resolve())
+-
+-    # Just return None if no files were found
+-    return None
+-
+-# locate libgap shared object
+-GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
+-
+ # post process
+ if DOT_SAGE is not None and ' ' in DOT_SAGE:
+     if UNAME[:6] == 'CYGWIN':
+diff --git a/src/sage/groups/abelian_gps/abelian_group_gap.py b/src/sage/groups/abelian_gps/abelian_group_gap.py
+index a4b047113c5..86090b43535 100644
+--- a/src/sage/groups/abelian_gps/abelian_group_gap.py
++++ b/src/sage/groups/abelian_gps/abelian_group_gap.py
+@@ -338,7 +338,7 @@ def _element_constructor_(self, x, check=True):
+         if isinstance(x, AbelianGroupElement_gap):
+             try:
+                 if x in self._cover:
+-                    x = self.gap().NaturalHomomorphism().Image(x.gap())
++                    x = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations).Image(x.gap())
+                 else:
+                     x = x.gap()
+             except AttributeError:
+@@ -1043,7 +1043,7 @@ def natural_homomorphism(self):
+             From: Abelian group with gap, generator orders (4,)
+             To:   Quotient abelian group with generator orders (2,)
+         """
+-        phi = self.gap().NaturalHomomorphism()
++        phi = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations)
+         Hom = self._cover.Hom(self)
+         return Hom(phi)
+ 
+diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
+index 8d6e443683c..1beb01af87f 100644
+--- a/src/sage/groups/finitely_presented.py
++++ b/src/sage/groups/finitely_presented.py
+@@ -596,9 +596,9 @@ def gap(self):
+             sage: k = G.rewriting_system()
+             sage: k.gap()
+             Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules
+-            [ [ a^2, <identity ...> ], [ a*A, <identity ...> ],
+-              [ A*a, <identity ...> ], [ b^2, <identity ...> ],
+-              [ b*B, <identity ...> ], [ B*b, <identity ...> ] ]
++            [ [ a*A, <identity ...> ], [ A*a, <identity ...> ],
++              [ b*B, <identity ...> ], [ B*b, <identity ...> ],
++              [ a^2, <identity ...> ], [ b^2, <identity ...> ] ]
+         """
+         return self._gap
+ 
+diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
+index 7fc4dbe7548..e5eccd45942 100644
+--- a/src/sage/groups/fqf_orthogonal.py
++++ b/src/sage/groups/fqf_orthogonal.py
+@@ -143,7 +143,7 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
+         [2/3   0   0]
+         [  0 2/3   0]
+         [  0   0 4/3]
+-        generated by 2 elements
++        generated by 3 elements
+         sage: q = matrix.diagonal(QQ, [3/2, 1/4, 1/4])
+         sage: T = TorsionQuadraticForm(q)
+         sage: T.orthogonal_group().order()
+diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx
+index d25121aa792..dc81b71635b 100644
+--- a/src/sage/groups/libgap_wrapper.pyx
++++ b/src/sage/groups/libgap_wrapper.pyx
+@@ -25,7 +25,7 @@ Note how we call the constructor of both superclasses to initialize
+ its output via LibGAP::
+ 
+     sage: FooGroup()
+-    <pc group of size 3 with 1 generators>
++    <pc group of size 3 with 1 generator>
+     sage: type(FooGroup().gap())
+     <class 'sage.libs.gap.element.GapElement'>
+ 
+@@ -106,7 +106,7 @@ class ParentLibGAP(SageObject):
+         ....:         ParentLibGAP.__init__(self, lg)
+         ....:         Group.__init__(self)
+         sage: FooGroup()
+-        <pc group of size 3 with 1 generators>
++        <pc group of size 3 with 1 generator>
+     """
+ 
+     def __init__(self, libgap_parent, ambient=None):
+@@ -461,7 +461,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement):
+         ....:         ParentLibGAP.__init__(self, lg)
+         ....:         Group.__init__(self)
+         sage: FooGroup()
+-        <pc group of size 3 with 1 generators>
++        <pc group of size 3 with 1 generator>
+         sage: FooGroup().gens()
+         (f1,)
+     """
+diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py
+index a6d3dc02513..63956ad5f10 100644
+--- a/src/sage/groups/matrix_gps/finitely_generated.py
++++ b/src/sage/groups/matrix_gps/finitely_generated.py
+@@ -563,9 +563,6 @@ def as_permutation_group(self, algorithm=None, seed=None):
+             21499084800
+             sage: P = G.as_permutation_group()
+             sage: Psmaller = G.as_permutation_group(algorithm="smaller", seed=6)
+-            sage: P == Psmaller  # see the note below
+-            True
+-            sage: Psmaller = G.as_permutation_group(algorithm="smaller")
+             sage: P == Psmaller
+             False
+             sage: P.cardinality()
+diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
+index f2ccca042ac..47d6862333c 100644
+--- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
++++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
+@@ -427,7 +427,7 @@ cdef class LabelledBranching:
+             sage: from sage.groups.perm_gps.partn_ref2.refinement_generic import LabelledBranching
+             sage: L = LabelledBranching(3)
+             sage: L.small_generating_set()
+-            []
++            [()]
+             sage: L.add_gen(libgap.eval('(1,2,3)'))
+             sage: L.small_generating_set()
+             [(1,2,3)]
+diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
+index ebdf7c4c6eb..fb14008c8e0 100644
+--- a/src/sage/groups/perm_gps/permgroup.py
++++ b/src/sage/groups/perm_gps/permgroup.py
+@@ -926,7 +926,7 @@ def _coerce_map_from_(self, G):
+            sage: f = PG._coerce_map_from_(MG)
+            sage: mg = MG.an_element()
+            sage: p = f(mg); p
+-           (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60)
++           (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21)
+            sage: PG(p._gap_()) == p
+            True
+ 
+@@ -972,12 +972,12 @@ def _coerce_map_from_(self, G):
+             sage: P = G.as_permutation_group(algorithm='smaller', seed=5)
+             sage: P1 = G.as_permutation_group()
+             sage: P == P1
+-            False
++            True
+             sage: g1, g2, g3 = G.gens()
+             sage: P(g1*g2)
+-            (1,3,7,12)(2,4,8,10)(5,11)(6,9)
++            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
+             sage: P1(g1*g2)
+-            (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66)
++            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
+ 
+         Another check for :trac:`5583`::
+ 
+@@ -1302,7 +1302,7 @@ def gens_small(self):
+             sage: G.gens_small() # random
+             [('b','c'), ('a','c','b')] ## (on 64-bit Linux)
+             [('a','b'), ('a','c','b')] ## (on Solaris)
+-            sage: len(G.gens_small()) == 2
++            sage: len(G.gens_small()) == 2 # random
+             True
+         """
+         gens = self._libgap_().SmallGeneratingSet()
+@@ -4370,17 +4370,23 @@ def is_transitive(self, domain=None):
+ 
+         ::
+ 
+-            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
+-            sage: G.is_transitive([1,4,5])
++            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)],[(6,7)]])
++            sage: G.is_transitive([1,2,3,4,5])
+             True
+-            sage: G.is_transitive([2..6])
++            sage: G.is_transitive([1..7])
+             False
+             sage: G.is_transitive(G.non_fixed_points())
+-            True
++            False
+             sage: H = PermutationGroup([[(1,2,3)],[(4,5,6)]])
+             sage: H.is_transitive(H.non_fixed_points())
+             False
+ 
++        If `G` does not act on the domain, it always returns ``False``::
++
++            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
++            sage: G.is_transitive([1,4,5])
++            False
++
+         Note that this differs from the definition in GAP, where
+         ``IsTransitive`` returns whether the group is transitive on the
+         set of points moved by the group.
+@@ -4436,12 +4442,16 @@ def is_primitive(self, domain=None):
+             sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
+             sage: G.is_primitive([1..4])
+             False
+-            sage: G.is_primitive([1,2,3])
+-            True
+             sage: G = PermutationGroup([[(3,4,5,6)],[(3,4)]]) #S_4 on [3..6]
+             sage: G.is_primitive(G.non_fixed_points())
+             True
+ 
++        If `G` does not act on the domain, it always returns ``False``::
++
++            sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
++            sage: G.is_primitive([1,2,3])
++            False
++
+         """
+         #If the domain is not a subset of self.domain(), then the
+         #action isn't primitive.
+diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
+index 7ae1792e9de..ecaa9fd2341 100644
+--- a/src/sage/interfaces/gap.py
++++ b/src/sage/interfaces/gap.py
+@@ -1512,6 +1512,8 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
+     """
+     # Create new workspace with filename WORKSPACE
+     g = Gap(use_workspace_cache=False, max_workspace_size=None)
++    g.eval('ColorPrompt(false)')
++    g.eval('SetUserPreference("UseColorPrompt", false)')
+     g.eval('SetUserPreference("HistoryMaxLines", 30)')
+     from sage.tests.gap_packages import all_installed_packages
+     for pkg in all_installed_packages(gap=g):
+diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
+index 33a87dd5076..03b40be6856 100644
+--- a/src/sage/interfaces/gap_workspace.py
++++ b/src/sage/interfaces/gap_workspace.py
+@@ -16,7 +16,8 @@
+ import os
+ import time
+ import hashlib
+-from sage.env import DOT_SAGE, GAP_SO
++import subprocess
++from sage.env import DOT_SAGE, HOSTNAME, GAP_LIB_DIR, GAP_SHARE_DIR
+ 
+ 
+ def gap_workspace_file(system="gap", name="workspace", dir=None):
+@@ -59,11 +60,13 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
+     if dir is None:
+         dir = os.path.join(DOT_SAGE, 'gap')
+ 
+-    if GAP_SO:
+-        h = hashlib.sha1(GAP_SO.encode('utf-8')).hexdigest()
+-    else:
+-        h = 'unknown'
+-    return os.path.join(dir, '%s-%s-%s' % (system, name, h))
++    data = f'{GAP_LIB_DIR}:{GAP_SHARE_DIR}'
++    for path in GAP_LIB_DIR, GAP_SHARE_DIR:
++        sysinfo = os.path.join(path, "sysinfo.gap")
++        if os.path.exists(sysinfo):
++            data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
++    h = hashlib.sha1(data.encode('utf-8')).hexdigest()
++    return os.path.join(dir, f'{system}-{name}-{HOSTNAME}-{h}')
+ 
+ 
+ def prepare_workspace_dir(dir=None):
+diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
+index c555ea0333c..e3db3934baf 100644
+--- a/src/sage/libs/gap/element.pyx
++++ b/src/sage/libs/gap/element.pyx
+@@ -130,6 +130,7 @@ cdef char *capture_stdout(Obj func, Obj obj):
+     """
+     cdef Obj s, stream, output_text_string
+     cdef UInt res
++    cdef TypOutputFile output
+     # The only way to get a string representation of an object that is truly
+     # consistent with how it would be represented at the GAP REPL is to call
+     # ViewObj on it.  Unfortunately, ViewObj *prints* to the output stream,
+@@ -145,12 +146,12 @@ cdef char *capture_stdout(Obj func, Obj obj):
+         output_text_string = GAP_ValueGlobalVariable("OutputTextString")
+         stream = CALL_2ARGS(output_text_string, s, GAP_True)
+ 
+-        if not OpenOutputStream(stream):
++        if not OpenOutputStream(&output, stream):
+             raise GAPError("failed to open output capture stream for "
+                            "representing GAP object")
+ 
+         CALL_1ARGS(func, obj)
+-        CloseOutput()
++        CloseOutput(&output)
+         return CSTR_STRING(s)
+     finally:
+         GAP_Leave()
+diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd
+index 6d22e32540b..6111d18a5c7 100644
+--- a/src/sage/libs/gap/gap_includes.pxd
++++ b/src/sage/libs/gap/gap_includes.pxd
+@@ -76,8 +76,10 @@ cdef extern from "gap/intobj.h" nogil:
+ 
+ 
+ cdef extern from "gap/io.h" nogil:
+-    UInt OpenOutputStream(Obj stream)
+-    UInt CloseOutput()
++    ctypedef struct TypOutputFile:
++        pass
++    UInt OpenOutputStream(TypOutputFile* output, Obj stream)
++    UInt CloseOutput(TypOutputFile* output)
+ 
+ 
+ cdef extern from "gap/libgap-api.h" nogil:
+diff --git a/src/sage/libs/gap/libgap.pyx b/src/sage/libs/gap/libgap.pyx
+index b1a64e57939..6a36613aa8c 100644
+--- a/src/sage/libs/gap/libgap.pyx
++++ b/src/sage/libs/gap/libgap.pyx
+@@ -695,7 +695,7 @@ class Gap(Parent):
+             sage: libgap.List
+             <Gap function "List">
+             sage: libgap.GlobalRandomSource
+-            <RandomSource in IsGlobalRandomSource>
++            <RandomSource in IsGAPRandomSource>
+         """
+         if name in dir(self.__class__):
+             return getattr(self.__class__, name)
+diff --git a/src/sage/libs/gap/saved_workspace.py b/src/sage/libs/gap/saved_workspace.py
+index ad5adec36d0..7636707f557 100644
+--- a/src/sage/libs/gap/saved_workspace.py
++++ b/src/sage/libs/gap/saved_workspace.py
+@@ -8,7 +8,7 @@
+ 
+ import os
+ import glob
+-from sage.env import GAP_ROOT_DIR
++from sage.env import GAP_LIB_DIR
+ from sage.interfaces.gap_workspace import gap_workspace_file
+ 
+ 
+@@ -31,7 +31,7 @@ def timestamp():
+     """
+     libgap_dir = os.path.dirname(__file__)
+     libgap_files = glob.glob(os.path.join(libgap_dir, '*'))
+-    gap_packages = glob.glob(os.path.join(GAP_ROOT_DIR, 'pkg', '*'))
++    gap_packages = glob.glob(os.path.join(GAP_LIB_DIR, 'pkg', '*'))
+     files = libgap_files + gap_packages
+     if len(files) == 0:
+         print('Unable to find LibGAP files.')
+diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
+index 344ab88c42a..eaa659d64c7 100644
+--- a/src/sage/libs/gap/util.pyx
++++ b/src/sage/libs/gap/util.pyx
+@@ -13,7 +13,7 @@ Utility functions for GAP
+ #*****************************************************************************
+ 
+ from libc.signal cimport signal, SIGCHLD, SIG_DFL
+-from posix.dlfcn cimport dlopen, dlclose, RTLD_NOW, RTLD_GLOBAL
++from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
+ 
+ from cpython.exc cimport PyErr_Fetch, PyErr_Restore
+ from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
+@@ -164,33 +164,6 @@ cdef void gasman_callback() with gil:
+ ### Initialization of GAP ##################################################
+ ############################################################################
+ 
+-def gap_root():
+-    """
+-    Find the location of the GAP root install which is stored in the gap
+-    startup script.
+-
+-    EXAMPLES::
+-
+-        sage: from sage.libs.gap.util import gap_root
+-        sage: gap_root()   # random output
+-        '/home/vbraun/opt/sage-5.3.rc0/local/gap/latest'
+-    """
+-    if os.path.exists(sage.env.GAP_ROOT_DIR):
+-        return sage.env.GAP_ROOT_DIR
+-
+-    # Attempt to figure out the appropriate GAP_ROOT by reading the
+-    # local/bin/gap shell script; this is an ugly hack that exists for
+-    # historical reasons; the best approach to setting where Sage looks for
+-    # the appropriate GAP_ROOT is to set the GAP_ROOT_DIR variable
+-    SAGE_LOCAL = sage.env.SAGE_LOCAL
+-    with open(os.path.join(SAGE_LOCAL, 'bin', 'gap')) as f:
+-        gap_sh = f.read().splitlines()
+-    gapdir = next(x for x in gap_sh if x.strip().startswith('GAP_ROOT'))
+-    gapdir = gapdir.split('"')[1]
+-    gapdir = gapdir.replace('$SAGE_LOCAL', SAGE_LOCAL)
+-    return gapdir
+-
+-
+ # To ensure that we call initialize_libgap only once.
+ cdef bint _gap_is_initialized = False
+ 
+@@ -232,12 +205,12 @@ cdef initialize():
+     # this isn't portable
+ 
+     cdef void* handle
+-    libgapname = str_to_bytes(sage.env.GAP_SO)
+-    handle = dlopen(libgapname, RTLD_NOW | RTLD_GLOBAL)
++    # reload the current module to force reload of libgap (see #33446)
++    lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
++    handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
+     if handle is NULL:
+-        raise RuntimeError(
+-                "Could not dlopen() libgap even though it should already "
+-                "be loaded!")
++        err = dlerror()
++        raise RuntimeError(f"Could not reload gap library with RTLD_GLOBAL ({err})")
+     dlclose(handle)
+ 
+     # Define argv variable, which we will pass in to
+@@ -245,7 +218,7 @@ cdef initialize():
+     cdef char* argv[16]
+     argv[0] = "sage"
+     argv[1] = "-l"
+-    s = str_to_bytes(gap_root(), FS_ENCODING, "surrogateescape")
++    s = str_to_bytes(sage.env.GAP_LIB_DIR + ";" + sage.env.GAP_SHARE_DIR, FS_ENCODING, "surrogateescape")
+     argv[2] = s
+ 
+     argv[3] = "-m"
+@@ -362,15 +335,9 @@ cdef Obj gap_eval(str gap_string) except? NULL:
+         GAPError: Error, Variable: 'Complex' must have a value
+         Syntax error: ; expected in stream:1
+         Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^
++                ^^^^^
+         Error, Variable: 'with' must have a value
+-        Syntax error: ; expected in stream:1
+-        Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^^^^^^^^^
+         Error, Variable: 'bits' must have a value
+-        Syntax error: ; expected in stream:1
+-        Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+         Error, Variable: 'precision' must have a value
+ 
+     Test that on a subsequent attempt we get the same message (no garbage was
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index d8ea7b07f3c..4beb1774df9 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -1705,14 +1705,7 @@ cdef object si2sa_intvec(intvec *v):
+ cdef extern from *: # hack to get at cython macro
+     int unlikely(int)
+ 
+-cdef extern from "dlfcn.h":
+-    void *dlopen(char *, long)
+-    char *dlerror()
+-    void dlclose(void *handle)
+-
+-cdef extern from "dlfcn.h":
+-    cdef long RTLD_LAZY
+-    cdef long RTLD_GLOBAL
++from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
+ 
+ cdef int overflow_check(unsigned long e, ring *_ring) except -1:
+     """
+@@ -1762,8 +1755,6 @@ cdef init_libsingular():
+ 
+     cdef void *handle = NULL
+ 
+-    from sage.env import LIBSINGULAR_PATH
+-    lib = str_to_bytes(LIBSINGULAR_PATH, FS_ENCODING, "surrogateescape")
+ 
+     # This is a workaround for https://github.com/Singular/Singular/issues/1113
+     # and can be removed once that fix makes it into release of Singular that
+@@ -1780,10 +1771,12 @@ cdef init_libsingular():
+ 
+     import platform
+     if not platform.system().startswith("CYGWIN"):
++        # reload the current module to force reload of libSingular (see #33446)
++        lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
+         handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
+         if not handle:
+             err = dlerror()
+-            raise ImportError(f"cannot load Singular library from {LIBSINGULAR_PATH} ({err})")
++            raise RuntimeError(f"Could not reload Singular library with RTLD_GLOBAL ({err})")
+ 
+     # load SINGULAR
+     siInit(lib)
+diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py
+index 2e4518ca226..c302b169b8a 100644
+--- a/src/sage/tests/gap_packages.py
++++ b/src/sage/tests/gap_packages.py
+@@ -103,7 +103,7 @@ def all_installed_packages(ignore_dot_gap=False, gap=None):
+ 
+         sage: from sage.tests.gap_packages import all_installed_packages
+         sage: all_installed_packages()
+-        (...'GAPDoc'...)
++        (...'gapdoc'...)
+         sage: all_installed_packages(ignore_dot_gap=True) == all_installed_packages(gap=gap, ignore_dot_gap=True)
+         True
+     """
diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches
new file mode 100755
index 000000000000..6cb717f72d8e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/get_patches
@@ -0,0 +1,40 @@
+#! /bin/sh
+
+URL_BASE_PR="https://github.com/sagemath/sage/pull/"
+URL_BASE_COMPARE="https://github.com/sagemath/sage/compare/9.8..."
+
+case "$1" in
+	-n)  DO=echo ;;
+esac
+
+# get_pr <PR number> <description> [ext]
+get_pr() {
+	pr=$1
+	desc=$(echo "$2" | sed -e 's/ /_/g')
+	ext=${3-diff}
+	$DO wget "$URL_BASE_PR$pr.$ext" -O "$pr-$desc.patch"
+}
+
+get_trac() {
+	ticket=$1
+	desc=$(echo "$2" | sed -e 's/ /_/g')
+	commit=$3
+	$DO wget "$URL_BASE_COMPARE$commit.diff" -O "trac-$ticket-$desc-$commit.patch"
+}
+
+# run from patches dir
+cd $(dirname "$0")
+
+# merged in 10.0.beta0
+get_trac 34851 "support singular 4.3.1.p3" 5e5737a0c
+get_pr 35068 "fix tests giac 1.9.0.35" patch
+
+# positive review
+get_pr 34994 "fix tests numpy 1.24"
+get_pr 34997 "fix edge case of integer_check"
+get_pr 35058 "skip unstable tests klyachko"
+get_pr 35094 "support gap 4.12"					# includes PR 35093
+
+# needs review 
+get_pr 34995 "support tachyon 0.99.2"
+get_pr 34980 "avoid factoring in is_prime"
diff --git a/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch b/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
deleted file mode 100644
index e052e306e7a1..000000000000
--- a/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 6330cee1a69229b2f5d8ac4a09a73d8152f5e14d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 28 Feb 2022 23:15:16 -0300
-Subject: trac 33360: avoid factoring in is_prime()
-
-In the added TEST, the ideal norm is product of two primes but factoring
-this product takes about half an hour, so factoring the ideal is slow.
-
-To fix the issue, we only factor the ideal if the norm is a prime power.
----
- src/sage/rings/number_field/number_field_ideal.py | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
-index f785f22..10d1f88 100644
---- a/src/sage/rings/number_field/number_field_ideal.py
-+++ b/src/sage/rings/number_field/number_field_ideal.py
-@@ -995,10 +995,32 @@ class NumberFieldIdeal(Ideal_generic):
-             False
-             sage: K.ideal(17).is_prime()  # ramified
-             False
-+
-+        TESTS::
-+
-+        Check that we do not factor the norm of the ideal, this used
-+        to take half an hour, see :trac:`33360`
-+
-+           sage: K.<a,b,c> = NumberField([x^2-2,x^2-3,x^2-5])
-+           sage: t = (((-2611940*c + 1925290/7653)*b - 1537130/7653*c
-+           ....:       + 10130950)*a + (1343014/7653*c - 8349770)*b
-+           ....:       + 6477058*c - 2801449990/4002519)
-+           sage: t.is_prime()
-+           False
-+
-         """
-         try:
-             return self._pari_prime is not None
-         except AttributeError:
-+            K = self.number_field().pari_nf()
-+            I = self.pari_hnf()
-+            # This would be better, but it is broken in pari 2.13.3.
-+            #   self._pari_prime = K.idealismaximal(I) or None
-+            # Instead we factor I, but only if the norm is a prime power
-+            n = K.idealnorm(I)
-+            if n.denominator() > 1 or not n.isprimepower():
-+                self._pari_prime = None
-+                return False
-             F = self.factor()  # factorization with caching
-             if len(F) != 1 or F[0][1] != 1:
-                 self._pari_prime = None
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch b/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
deleted file mode 100644
index fb9e0f5a8071..000000000000
--- a/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
+++ /dev/null
@@ -1,427 +0,0 @@
-From 9feec282d039ca25bbefa50710f8217b775ce111 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Thu, 3 Mar 2022 14:47:00 -0300
-Subject: gap: do not directly dlopen() the gap library
-
-This needs the soname (as in sage.env.GAP_SO) which has issues for
-system gap as explained in #33446.
-
-Instead we dlopen() the extension module sage.libs.gap.util which,
-having a link time dependency to libgap, will indirectly dlopen() it.
-
-For the record: by the time we run dlopen() the libgap should be already
-loaded. The purpose of doing it is to change mode to RTLD_GLOBAL so that
-symbols in libgap are placed in the global symbol table. This is
-required to compiled load gap packages.
-
-An easy test that this is working ok is:
-
-    sage: libgap.LoadPackage("io")
-    true
-
-This requires optional spkg `gap_packages` to be installed.
----
- src/sage/libs/gap/util.pyx | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
-index 344ab88..aff604b 100644
---- a/src/sage/libs/gap/util.pyx
-+++ b/src/sage/libs/gap/util.pyx
-@@ -13,7 +13,7 @@ Utility functions for GAP
- #*****************************************************************************
- 
- from libc.signal cimport signal, SIGCHLD, SIG_DFL
--from posix.dlfcn cimport dlopen, dlclose, RTLD_NOW, RTLD_GLOBAL
-+from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
- 
- from cpython.exc cimport PyErr_Fetch, PyErr_Restore
- from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
-@@ -232,12 +232,12 @@ cdef initialize():
-     # this isn't portable
- 
-     cdef void* handle
--    libgapname = str_to_bytes(sage.env.GAP_SO)
--    handle = dlopen(libgapname, RTLD_NOW | RTLD_GLOBAL)
-+    # reload the current module to force reload of libgap (see #33446)
-+    lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
-+    handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
-     if handle is NULL:
--        raise RuntimeError(
--                "Could not dlopen() libgap even though it should already "
--                "be loaded!")
-+        err = dlerror()
-+        raise RuntimeError(f"Could not reload gap library with RTLD_GLOBAL ({err})")
-     dlclose(handle)
- 
-     # Define argv variable, which we will pass in to
--- 
-cgit v1.0-1-gd88e
-
-
-From 704a7953b97ab726e2af610724726aa562bc8bf8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Thu, 3 Mar 2022 23:00:07 -0300
-Subject: singular: do not directly dlopen() the singular library
-
-Same as for gap in the previous commit. Instead of requiring the soname
-(as in sage.env.LIBSINGULAR_PATH) we dlopen() the extension module
-sage.libs.singular.singular which will indirectly dlopen() libSingular.
----
- src/sage/libs/singular/singular.pyx | 15 ++++-----------
- 1 file changed, 4 insertions(+), 11 deletions(-)
-
-diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
-index d8ea7b0..4beb177 100644
---- a/src/sage/libs/singular/singular.pyx
-+++ b/src/sage/libs/singular/singular.pyx
-@@ -1705,14 +1705,7 @@ cdef object si2sa_intvec(intvec *v):
- cdef extern from *: # hack to get at cython macro
-     int unlikely(int)
- 
--cdef extern from "dlfcn.h":
--    void *dlopen(char *, long)
--    char *dlerror()
--    void dlclose(void *handle)
--
--cdef extern from "dlfcn.h":
--    cdef long RTLD_LAZY
--    cdef long RTLD_GLOBAL
-+from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
- 
- cdef int overflow_check(unsigned long e, ring *_ring) except -1:
-     """
-@@ -1762,8 +1755,6 @@ cdef init_libsingular():
- 
-     cdef void *handle = NULL
- 
--    from sage.env import LIBSINGULAR_PATH
--    lib = str_to_bytes(LIBSINGULAR_PATH, FS_ENCODING, "surrogateescape")
- 
-     # This is a workaround for https://github.com/Singular/Singular/issues/1113
-     # and can be removed once that fix makes it into release of Singular that
-@@ -1780,10 +1771,12 @@ cdef init_libsingular():
- 
-     import platform
-     if not platform.system().startswith("CYGWIN"):
-+        # reload the current module to force reload of libSingular (see #33446)
-+        lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
-         handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
-         if not handle:
-             err = dlerror()
--            raise ImportError(f"cannot load Singular library from {LIBSINGULAR_PATH} ({err})")
-+            raise RuntimeError(f"Could not reload Singular library with RTLD_GLOBAL ({err})")
- 
-     # load SINGULAR
-     siInit(lib)
--- 
-cgit v1.0-1-gd88e
-
-
-From d7145c14ef58acfbe00d8f941d2802e96ad4ba15 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 16:37:34 -0300
-Subject: singular: remove LIBSINGULAR_PATH, no longer needed
-
----
- build/pkgs/singular/spkg-configure.m4 | 63 +----------------------------------
- pkgs/sage-conf/_sage_conf/_conf.py.in |  3 --
- src/sage/env.py                       |  6 ----
- 3 files changed, 1 insertion(+), 71 deletions(-)
-
-diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4
-index af2eb85..6d3d3da 100644
---- a/build/pkgs/singular/spkg-configure.m4
-+++ b/build/pkgs/singular/spkg-configure.m4
-@@ -9,52 +9,7 @@ SAGE_SPKG_CONFIGURE([singular], [
-        AC_MSG_CHECKING([that Singular's help is working])
-        AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error\ occurred"` = x], [
-         AC_MSG_RESULT(yes)
--        dnl We have Singular. Now determine the shared library path on
--        dnl platforms on which sage.libs.singular needs to reload the library with RTLD_GLOBAL.
--        AS_CASE([$host_os],
--          [cygwin*], [dnl Nothing to do
--                     ],
--                     [dnl Use pkg-config to get singular's libdir while we're at it. As a
--                      dnl moral compromise for using pkg-config, this ultimately allows us
--                      dnl to pass an absolute path to dlopen(), which is the only approach
--                      dnl that POSIX guarantees will work.
--                      PKG_CHECK_VAR([SINGULAR_LIB_DIR], [Singular], [libdir])
--                      dnl The acl_shlibext variable is set in the top-level configure.ac.
--                      AC_LANG_PUSH(C)
--                      ORIG_LIBS="${LIBS}"
--                      LIBS="${LIBS} -ldl"
--                      AC_MSG_CHECKING([if we can dlopen($LIBSINGULAR_PATH)])
--                      LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libSingular.${acl_shlibext}"
--
--                      dnl if we can dlopen() it, substitute the name for sage_conf;
--                      dnl otherwise, fall back to using the SPKG.
--                      AC_RUN_IFELSE(
--                        [AC_LANG_PROGRAM(
--                          [[#include <dlfcn.h>]],
--                          [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
--                            if (h == 0) { return 1; } else { return dlclose(h); }]]
--                        )], [
--                          AC_MSG_RESULT(yes)
--                        ], [
--                          dnl try Debian-specific name
--                          LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libsingular-Singular.${acl_shlibext}"
--                          AC_RUN_IFELSE(
--                           [AC_LANG_PROGRAM(
--                             [[#include <dlfcn.h>]],
--                             [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
--                               if (h == 0) { return 1; } else { return dlclose(h); }]]
--                           )], [
--                             AC_MSG_RESULT(yes)
--                           ], [
--                            AC_MSG_RESULT(no)
--                            sage_spkg_install_singular=yes
--                          ], [AC_MSG_RESULT(yes)])
--                        ], [AC_MSG_RESULT(yes)])
--
--                      AC_LANG_POP()
--                      LIBS="${ORIG_LIBS}"
--                     ]
--       )], [
-+       ], [
-        AC_MSG_RESULT(no)
-        sage_spkg_install_singular=yes
-        ]
-@@ -64,20 +19,4 @@ SAGE_SPKG_CONFIGURE([singular], [
-       ])
-     ])
-   ])
--],[],[],[
--  dnl Post-check phase
--  dnl We make the sage_conf substitutions here, because the "default"
--  dnl substitution needs to be made even if we skipped the system-Singular
--  dnl checks themselves.
--  AS_IF([test "x${sage_spkg_install_singular}" = "xyes"], [
--    AS_CASE([$host_os],
--      [cygwin*], [dnl Nothing to do
--                 ],
--                 [dnl Set shared library path, needed for reloading the library with RTLD_GLOBAL
--                  LIBSINGULAR_PATH="\$SAGE_LOCAL/lib/libSingular.${acl_shlibext}"
--                 ]
--    )
--  ])
--
--  AC_SUBST(LIBSINGULAR_PATH, "${LIBSINGULAR_PATH}")
- ])
-diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in
-index 6cd28f5..d66bdb3 100644
---- a/pkgs/sage-conf/_sage_conf/_conf.py.in
-+++ b/pkgs/sage-conf/_sage_conf/_conf.py.in
-@@ -55,9 +55,6 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"
- OPENMP_CFLAGS = "@OPENMP_CFLAGS@"
- OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"
- 
--# The full absolute path to the main Singular library.
--LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)
--
- # Installation location of wheels. This is determined at configuration time
- # and does not depend on the installation location of sage-conf.
- SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels"
-diff --git a/src/sage/env.py b/src/sage/env.py
-index 911f34b..93f79de 100644
---- a/src/sage/env.py
-+++ b/src/sage/env.py
-@@ -229,12 +229,6 @@ NTL_LIBDIR = var("NTL_LIBDIR")
- LIE_INFO_DIR = var("LIE_INFO_DIR", join(SAGE_LOCAL, "lib", "LiE"))
- SINGULAR_BIN = var("SINGULAR_BIN") or "Singular"
- 
--# The path to libSingular, to be passed to dlopen(). This will
--# typically be set to an absolute path in sage_conf, but the relative
--# fallback path here works on systems where dlopen() searches the
--# system's library locations.
--LIBSINGULAR_PATH = var("LIBSINGULAR_PATH", "libSingular.so")
--
- # OpenMP
- OPENMP_CFLAGS = var("OPENMP_CFLAGS", "")
- OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
--- 
-cgit v1.0-1-gd88e
-
-
-From 92e5a211c792f86f5325d601abfddf667da6a776 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 15:49:26 -0300
-Subject: Revert "src/sage/interfaces/gap_workspace.py: Use hash of GAP_SO to
- disambiguate the workspace file, not SAGE_LOCAL"
-
-This reverts commit a801e6d85bd420b60ea75b1671856eb43ac6b18b.
-
-See #33446.
----
- src/sage/interfaces/gap_workspace.py | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
-
-diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
-index 33a87dd..953dc85 100644
---- a/src/sage/interfaces/gap_workspace.py
-+++ b/src/sage/interfaces/gap_workspace.py
-@@ -16,7 +16,7 @@ Support for (lib)GAP workspace files
- import os
- import time
- import hashlib
--from sage.env import DOT_SAGE, GAP_SO
-+from sage.env import DOT_SAGE, SAGE_LOCAL
- 
- 
- def gap_workspace_file(system="gap", name="workspace", dir=None):
-@@ -59,10 +59,7 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
-     if dir is None:
-         dir = os.path.join(DOT_SAGE, 'gap')
- 
--    if GAP_SO:
--        h = hashlib.sha1(GAP_SO.encode('utf-8')).hexdigest()
--    else:
--        h = 'unknown'
-+    h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
-     return os.path.join(dir, '%s-%s-%s' % (system, name, h))
- 
- 
--- 
-cgit v1.0-1-gd88e
-
-
-From b45e555b5711ae10d369b568333940c2aa771053 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 16:38:49 -0300
-Subject: gap: remove GAP_SO, no longer needed
-
----
- src/sage/env.py | 75 ---------------------------------------------------------
- 1 file changed, 75 deletions(-)
-
-diff --git a/src/sage/env.py b/src/sage/env.py
-index 93f79de..c16a094 100644
---- a/src/sage/env.py
-+++ b/src/sage/env.py
-@@ -249,81 +249,6 @@ if SAGE_GAP_MEMORY is not None:
- SAGE_GAP_COMMAND = var('SAGE_GAP_COMMAND', _gap_cmd)
- 
- 
--def _get_shared_lib_path(*libnames: str) -> Optional[str]:
--    """
--    Return the full path to a shared library file installed in
--    ``$SAGE_LOCAL/lib`` or the directories associated with the
--    Python sysconfig.
--
--    This can also be passed more than one library name (e.g. for cases where
--    some library may have multiple names depending on the platform) in which
--    case the first one found is returned.
--
--    This supports most *NIX variants (in which ``lib<libname>.so`` is found
--    under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
--    extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
--    or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
--
--    For distributions like Debian that use a multiarch layout, we also try the
--    multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
--
--    This returns ``None`` if no matching library file could be found.
--
--    EXAMPLES::
--
--        sage: from sage.env import _get_shared_lib_path
--        sage: "gap" in _get_shared_lib_path("gap")
--        True
--        sage: _get_shared_lib_path("an_absurd_lib") is None
--        True
--
--    """
--
--    for libname in libnames:
--        search_directories: List[Path] = []
--        patterns: List[str] = []
--        if sys.platform == 'cygwin':
--            # Later down we take the first matching DLL found, so search
--            # SAGE_LOCAL first so that it takes precedence
--            if SAGE_LOCAL:
--                search_directories.append(Path(SAGE_LOCAL) / 'bin')
--            search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
--            # Note: The following is not very robust, since if there are multible
--            # versions for the same library this just selects one more or less
--            # at arbitrary. However, practically speaking, on Cygwin, there
--            # will only ever be one version
--            patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
--        else:
--            if sys.platform == 'darwin':
--                ext = 'dylib'
--            else:
--                ext = 'so'
--
--            if SAGE_LOCAL:
--                search_directories.append(Path(SAGE_LOCAL) / 'lib')
--            libdir = sysconfig.get_config_var('LIBDIR')
--            if libdir is not None:
--                libdir = Path(libdir)
--                search_directories.append(libdir)
--
--                multiarchlib = sysconfig.get_config_var('MULTIARCH')
--                if multiarchlib is not None:
--                    search_directories.append(libdir / multiarchlib),
--
--            patterns = [f'lib{libname}.{ext}']
--
--        for directory in search_directories:
--            for pattern in patterns:
--                path = next(directory.glob(pattern), None)
--                if path is not None:
--                    return str(path.resolve())
--
--    # Just return None if no files were found
--    return None
--
--# locate libgap shared object
--GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
--
- # post process
- if DOT_SAGE is not None and ' ' in DOT_SAGE:
-     if UNAME[:6] == 'CYGWIN':
--- 
-cgit v1.0-1-gd88e
-
-
-From 31e3fc4ec8b8687bccd22d2e3161c86cf5553e06 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Mar 2022 12:10:37 -0300
-Subject: gap_workspace_file: include hostname and gap version
-
----
- src/sage/interfaces/gap_workspace.py | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
-index 953dc85..8c03b6b 100644
---- a/src/sage/interfaces/gap_workspace.py
-+++ b/src/sage/interfaces/gap_workspace.py
-@@ -16,7 +16,8 @@ Support for (lib)GAP workspace files
- import os
- import time
- import hashlib
--from sage.env import DOT_SAGE, SAGE_LOCAL
-+import subprocess
-+from sage.env import DOT_SAGE, SAGE_LOCAL, HOSTNAME, GAP_ROOT_DIR
- 
- 
- def gap_workspace_file(system="gap", name="workspace", dir=None):
-@@ -59,8 +60,12 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
-     if dir is None:
-         dir = os.path.join(DOT_SAGE, 'gap')
- 
--    h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
--    return os.path.join(dir, '%s-%s-%s' % (system, name, h))
-+    data = SAGE_LOCAL
-+    sysinfo = os.path.join(GAP_ROOT_DIR, "sysinfo.gap")
-+    if os.path.exists(sysinfo):
-+        data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
-+    h = hashlib.sha1(data.encode('utf-8')).hexdigest()
-+    return os.path.join(dir, '%s-%s-%s-%s' % (system, name, HOSTNAME, h))
- 
- 
- def prepare_workspace_dir(dir=None):
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch b/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
deleted file mode 100644
index 70b1fed99ce4..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From de38bac21e276c6dba95b8b33f7457a0ac56bdeb Mon Sep 17 00:00:00 2001
-From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
-Date: Tue, 25 Oct 2022 19:43:53 -0700
-Subject: [PATCH] src/sage: Apply python-3.11.patch from
- https://github.com/void-linux/void-packages/commit/6229f313450ecae88743b4d5e99da2ed4de44e07
-
----
- src/sage/cpython/cython_metaclass.h | 2 +-
- src/sage/libs/gmp/pylong.pyx        | 8 +++-----
- src/sage/symbolic/ginac/numeric.cpp | 1 -
- 3 files changed, 4 insertions(+), 7 deletions(-)
-
-diff --git a/src/sage/cpython/cython_metaclass.h b/src/sage/cpython/cython_metaclass.h
-index cc620a4dac7..6487342b71e 100644
---- a/src/sage/cpython/cython_metaclass.h
-+++ b/src/sage/cpython/cython_metaclass.h
-@@ -66,7 +66,7 @@ static CYTHON_INLINE int Sage_PyType_Ready(PyTypeObject* t)
-         }
- 
-         /* Now, set t.__class__ to metaclass */
--        Py_TYPE(t) = metaclass;
-+        Py_SET_TYPE(t, metaclass);
-         PyType_Modified(t);
-     }
-     else
-diff --git a/src/sage/libs/gmp/pylong.pyx b/src/sage/libs/gmp/pylong.pyx
-index 388be32c55e..e772b60e3e0 100644
---- a/src/sage/libs/gmp/pylong.pyx
-+++ b/src/sage/libs/gmp/pylong.pyx
-@@ -32,7 +32,7 @@ from cpython.longintrepr cimport _PyLong_New, py_long, digit, PyLong_SHIFT
- from .mpz cimport *
- 
- cdef extern from *:
--    Py_ssize_t* Py_SIZE_PTR "&Py_SIZE"(object)
-+    void Py_SET_SIZE(object, Py_ssize_t)
-     int hash_bits """
-         #ifdef _PyHASH_BITS
-         _PyHASH_BITS         /* Python 3 */
-@@ -57,10 +57,8 @@ cdef mpz_get_pylong_large(mpz_srcptr z):
-     mpz_export(L.ob_digit, NULL,
-             -1, sizeof(digit), 0, PyLong_nails, z)
-     if mpz_sgn(z) < 0:
--        # Set correct size (use a pointer to hack around Cython's
--        # non-support for lvalues).
--        sizeptr = Py_SIZE_PTR(L)
--        sizeptr[0] = -pylong_size
-+        # Set correct size
-+        Py_SET_SIZE(L, -pylong_size)
-     return L
- 
- 
-diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp
-index 22060441760..b40ed64edb5 100644
---- a/src/sage/symbolic/ginac/numeric.cpp
-+++ b/src/sage/symbolic/ginac/numeric.cpp
-@@ -52,7 +52,6 @@
- #define register
- #define PY_SSIZE_T_CLEAN
- #include <Python.h>
--#include <longintrepr.h>
- #include "flint/fmpz.h"
- #include "flint/fmpz_factor.h"
- 
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch b/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
deleted file mode 100644
index 0bb1f5f68b0e..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From 9eb08f3afde3266bbd667e196513240a0fe245f4 Mon Sep 17 00:00:00 2001
-From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
-Date: Tue, 25 Oct 2022 22:52:56 -0700
-Subject: [PATCH] inspect.ArgSpec -> inspect.FullArgSpec
-
----
- src/sage/misc/cachefunc.pyx         |  4 ++--
- src/sage/misc/decorators.py         |  6 ++++--
- src/sage/misc/function_mangling.pyx |  2 +-
- src/sage/misc/sageinspect.py        | 24 +++++++++++++-----------
- 4 files changed, 20 insertions(+), 16 deletions(-)
-
-diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx
-index 9fa967ce737..72042ef13d6 100644
---- a/src/sage/misc/cachefunc.pyx
-+++ b/src/sage/misc/cachefunc.pyx
-@@ -2818,7 +2818,7 @@ cdef class CachedMethod():
-                 except Exception:
-                     pass
-             if self.nargs == 0:
--                args, varargs, keywords, defaults = sage_getargspec(f)
-+                args, varargs, keywords, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-                 if varargs is None and keywords is None and len(args)<=1:
-                     self.nargs = 1
-                 else:
-@@ -2954,7 +2954,7 @@ cdef class CachedSpecialMethod(CachedMethod):
-         # we need to analyse the argspec
-         f = self._cachedfunc.f
-         if self.nargs == 0:
--            args, varargs, keywords, defaults = sage_getargspec(f)
-+            args, varargs, keywords, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-             if varargs is None and keywords is None and len(args)<=1:
-                 self.nargs = 1
-                 Caller = CachedMethodCallerNoArgs(inst, f, name=name, do_pickle=self._cachedfunc.do_pickle)
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 28c52448813..311a5105739 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -32,7 +32,8 @@ from copy import copy
- 
- from sage.misc.sageinspect import (sage_getsource, sage_getsourcelines,
-                                    sage_getargspec)
--from inspect import ArgSpec
-+
-+from inspect import FullArgSpec
- 
- 
- def sage_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
-@@ -499,7 +500,8 @@ class options():
-                     list(self.options))
-             defaults = (argspec.defaults or ()) + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
-+            return FullArgSpec(args, argspec.varargs, argspec.keywords, defaults,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
-         wrapper._sage_argspec_ = argspec
- 
-diff --git a/src/sage/misc/function_mangling.pyx b/src/sage/misc/function_mangling.pyx
-index 0ac03cf0715..e1bb7978953 100644
---- a/src/sage/misc/function_mangling.pyx
-+++ b/src/sage/misc/function_mangling.pyx
-@@ -116,7 +116,7 @@ cdef class ArgumentFixer:
-     """
-     def __init__(self, f, classmethod = False):
-         try:
--            arg_names, varargs, varkw, defaults = sage_getargspec(f)
-+            arg_names, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-         except AttributeError:
-             # This error occurs if f is defined in a Cython file and the
-             # source file has gone.
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index fbca2defc20..a3821cb56b9 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -359,7 +359,7 @@ def _extract_embedded_signature(docstring, name):
-         docstring = L[1] if len(L) > 1 else ''  # Remove first line, keep the rest
-         def_string = "def " + name + signature + ": pass"
-         try:
--            return docstring, inspect.ArgSpec(*_sage_getargspec_cython(def_string))
-+            return docstring, inspect.FullArgSpec(*_sage_getargspec_cython(def_string))
-         except SyntaxError:
-             docstring = os.linesep.join(L)
-     return docstring, None
-@@ -1135,8 +1135,9 @@ def _sage_getargspec_from_ast(source):
-     vararg = getattr(ast_args.vararg, 'arg', None)
-     kwarg = getattr(ast_args.kwarg, 'arg', None)
- 
--    return inspect.ArgSpec(args, vararg, kwarg,
--                           tuple(defaults) if defaults else None)
-+    return inspect.FullArgSpec(args, vararg, kwarg,
-+                               tuple(defaults) if defaults else None,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
- 
- def _sage_getargspec_cython(source):
-@@ -1152,7 +1153,7 @@ def _sage_getargspec_cython(source):
- 
-     OUTPUT:
- 
--    - an instance of :obj:`inspect.ArgSpec`, i.e., a named tuple
-+    - an instance of :class:`inspect.FullArgSpec`, i.e., a named tuple
- 
-     EXAMPLES::
- 
-@@ -1662,11 +1663,11 @@ def sage_getargspec(obj):
-         return sage_getargspec(obj.__call__)
-     if isinstance(obj, (lazy_attribute, AbstractMethod)):
-         source = sage_getsource(obj)
--        return inspect.ArgSpec(*_sage_getargspec_cython(source))
-+        return inspect.FullArgSpec(*_sage_getargspec_cython(source))
-     if not callable(obj):
-         raise TypeError("obj is not a code object")
-     try:
--        return inspect.ArgSpec(*obj._sage_argspec_())
-+        return inspect.FullArgSpec(*obj._sage_argspec_())
-     except (AttributeError, TypeError):
-         pass
-     # If we are lucky, the function signature is embedded in the docstring.
-@@ -1682,7 +1683,7 @@ def sage_getargspec(obj):
-         # Note that this may give a wrong result for the constants!
-         try:
-             args, varargs, varkw = inspect.getargs(obj.__code__)
--            return inspect.ArgSpec(args, varargs, varkw, obj.__defaults__)
-+            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__)
-         except (TypeError, AttributeError):
-             pass
-     if isclassinstance(obj):
-@@ -1717,7 +1718,7 @@ def sage_getargspec(obj):
-         except TypeError: # happens for Python builtins
-             source = ''
-         if source:
--            return inspect.ArgSpec(*_sage_getargspec_cython(source))
-+            return inspect.FullArgSpec(*_sage_getargspec_cython(source))
-         else:
-             func_obj = obj
- 
-@@ -1730,7 +1731,7 @@ def sage_getargspec(obj):
-         except TypeError: # arg is not a code object
-             # The above "hopefully" was wishful thinking:
-             try:
--                return inspect.ArgSpec(*_sage_getargspec_cython(sage_getsource(obj)))
-+                return inspect.FullArgSpec(*_sage_getargspec_cython(sage_getsource(obj)))
-             except TypeError: # This happens for Python builtins
-                 # The best we can do is to return a generic argspec
-                 args = []
-@@ -1740,7 +1741,8 @@ def sage_getargspec(obj):
-         defaults = func_obj.__defaults__
-     except AttributeError:
-         defaults = None
--    return inspect.ArgSpec(args, varargs, varkw, defaults)
-+    return inspect.FullArgSpec(args, varargs, varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
- 
- def formatannotation(annotation, base_module=None):
-@@ -1811,7 +1813,7 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
-     :func:`sage_getargspec`. Since :func:`sage_getargspec` works for
-     Cython functions while Python's inspect module does not, it makes
-     sense to keep this function for formatting instances of
--    ``inspect.ArgSpec``.
-+    ``inspect.FullArgSpec``.
- 
-     EXAMPLES::
- 
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch b/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
deleted file mode 100644
index cd2fa11622c3..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
+++ /dev/null
@@ -1,1279 +0,0 @@
-From 8955607c71cb94e4a810b89f113b7b220a351417 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Nov 2022 11:26:10 -0300
-Subject: [PATCH 01/11] dict_del_by_value: move python internal definitions to
- a separate file
-
----
- src/sage/cpython/dict_del_by_value.pyx | 153 ++++++++---------------
- src/sage/cpython/dict_internal.h       | 165 +++++++++++++++++++++++++
- 2 files changed, 214 insertions(+), 104 deletions(-)
- create mode 100644 src/sage/cpython/dict_internal.h
-
-diff --git a/src/sage/cpython/dict_del_by_value.pyx b/src/sage/cpython/dict_del_by_value.pyx
-index 488bf9c84cc..3894554c13d 100644
---- a/src/sage/cpython/dict_del_by_value.pyx
-+++ b/src/sage/cpython/dict_del_by_value.pyx
-@@ -19,13 +19,8 @@ AUTHORS:
- #                  https://www.gnu.org/licenses/
- # ****************************************************************************
- 
--import weakref
--from weakref import KeyedRef
--
- from cpython.list cimport PyList_New
--from cpython cimport Py_XINCREF, Py_XDECREF
- 
--from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
- cdef extern from "Python.h":
-     ctypedef struct PyDictKeysObject
- 
-@@ -34,99 +29,47 @@ cdef extern from "Python.h":
-         PyDictKeysObject * ma_keys
-         PyObject ** ma_values
- 
--    #we need this redefinition because we want to be able to call
--    #PyWeakref_GetObject with borrowed references. This is the recommended
--    #strategy according to Cython/Includes/cpython/__init__.pxd
--    PyObject* PyWeakref_GetObject(PyObject * wr)
-     int PyList_SetItem(object list, Py_ssize_t index, PyObject * item) except -1
--    int PyWeakref_Check(PyObject * ob)
--####
--#definitions replicated from CPython's Objects/dict-common.h
--#(this file is not exported from CPython, so we need to be
--#careful the definitions are in step with what happens there.
--
--ctypedef void* dict_lookup_func  # Precise definition not needed
--
--ctypedef union IndexBlock:
--    int8_t as_1[8]
--    int16_t as_2[4]
--    int32_t as_4[2]
--    int64_t as_8[1]
--
--ctypedef struct MyPyDictKeysObject:
--    Py_ssize_t dk_refcnt
--    Py_ssize_t dk_size
--    dict_lookup_func dk_lookup
--    Py_ssize_t dk_usable
--    Py_ssize_t dk_nentries
--    IndexBlock dk_indices
--
--ctypedef struct PyDictKeyEntry:
--    Py_hash_t me_hash
--    PyObject * me_key
--    PyObject * me_value
--
--cdef Py_ssize_t DKIX_EMPTY = -1
--cdef Py_ssize_t DKIX_DUMMY = -2
--cdef Py_ssize_t DKIX_ERROR = -3
--
--#####
--#These routines are copied from CPython's Object/dictobject.c
--#in order to access PyDictKeysObject fields
--
--cdef inline int DK_IXSIZE(MyPyDictKeysObject *keys):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        return 1
--    elif s <= 0xffff:
--        return 2
--    elif s <= 0xffffffff:
--        return 4
--    else:
--        return 8
--
--cdef inline PyDictKeyEntry * DK_ENTRIES(MyPyDictKeysObject *keys):
--    return <PyDictKeyEntry*> &(keys.dk_indices.as_1[keys.dk_size * DK_IXSIZE(keys)])
--
--cdef inline Py_ssize_t dk_get_index(MyPyDictKeysObject *keys, Py_ssize_t i):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        return keys.dk_indices.as_1[i]
--    elif s <= 0xffff:
--        return keys.dk_indices.as_2[i]
--    elif s <= 0xffffffff:
--        return keys.dk_indices.as_4[i]
--    else:
--        return keys.dk_indices.as_8[i]
--
--cdef inline void dk_set_index(MyPyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        keys.dk_indices.as_1[i] = ix
--    elif s <= 0xffff:
--        keys.dk_indices.as_2[i] = ix
--    elif s <= 0xffffffff:
--        keys.dk_indices.as_4[i] = ix
--    else:
--        keys.dk_indices.as_8[i] = ix
--
--#End of replication of Object/dictobject.c
--######
--
--cdef dict_lookup_func lookdict
--
--cdef dict_lookup_func DK_LOOKUP(PyDictObject *mp):
--    return (<MyPyDictKeysObject *>(mp.ma_keys)).dk_lookup
--
--def init_lookdict():
--    global lookdict
--    # A dict which a non-string key uses the generic "lookdict"
--    # as lookup function
--    cdef object D = {}
--    D[0] = 0
--    lookdict = DK_LOOKUP(<PyDictObject *>D)
--
--init_lookdict()
-+
-+cdef extern from "dict_internal.h":
-+    Py_ssize_t DK_MASK(PyDictKeysObject *)
-+    PyDictKeyEntry * DK_ENTRIES(PyDictKeysObject *keys)
-+
-+    Py_ssize_t dictkeys_get_index (PyDictKeysObject *keys, Py_ssize_t i)
-+    void dictkeys_set_index (PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+
-+    Py_ssize_t DKIX_EMPTY, DKIX_DUMMY
-+    int PERTURB_SHIFT
-+
-+    ctypedef struct PyDictKeyEntry:
-+        Py_hash_t me_hash
-+        PyObject * me_key
-+        PyObject * me_value
-+
-+
-+# dk_lookup was removed in python 3.11
-+DEF HAS_DK_LOOKUP = PY_VERSION_HEX < 0x30b0000
-+
-+IF HAS_DK_LOOKUP:
-+
-+    cdef extern from *:
-+        """
-+        #define DK_LOOKUP(dk) ((dk)->dk_lookup)
-+        """
-+        ctypedef void * dict_lookup_func  # Precise definition not needed
-+        dict_lookup_func DK_LOOKUP(PyDictKeysObject *mp)
-+
-+    cdef dict_lookup_func lookdict
-+
-+    def init_lookdict():
-+        global lookdict
-+        # A dict which a non-string key uses the generic "lookdict"
-+        # as lookup function
-+        cdef object D = {}
-+        D[0] = 0
-+        lookdict = DK_LOOKUP((<PyDictObject *>D).ma_keys)
-+
-+    init_lookdict()
- 
- cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_t hash) except -1:
-     """
-@@ -177,9 +120,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-         sage: for i in range(10^3+10): newA = A(); M[newA] = prev; prev = newA
-         sage: del a
-     """
--    keys = <MyPyDictKeysObject *>(mp.ma_keys)
-+    keys = mp.ma_keys
-     cdef size_t perturb
--    cdef size_t mask = <size_t> keys.dk_size-1
-+    cdef size_t mask = DK_MASK(keys)
-     cdef PyDictKeyEntry *entries = DK_ENTRIES(keys)
-     cdef PyDictKeyEntry *ep
- 
-@@ -187,7 +130,7 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-         raise TypeError("del_dictitem_by_exact_value cannot be applied to a shared key dict")
- 
-     cdef size_t i = <size_t>hash & mask
--    ix = dk_get_index(keys, i)
-+    ix = dictkeys_get_index(keys, i)
- 
-     if ix == DKIX_EMPTY:
-         # key not found
-@@ -196,9 +139,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-     ep = &(entries[ix])
-     perturb = hash
-     while (ep.me_value != value or ep.me_hash != hash):
--        perturb = perturb >> 5 #this is the value of PERTURB_SHIFT
-+        perturb = perturb >> PERTURB_SHIFT
-         i = mask & (i * 5 + perturb + 1)
--        ix = dk_get_index(keys, i)
-+        ix = dictkeys_get_index(keys, i)
-         if ix == DKIX_EMPTY:
-             # key not found
-             return 0
-@@ -206,7 +149,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
- 
-     # We need the lookup function to be the generic lookdict, otherwise
-     # deletions may not work correctly
--    keys.dk_lookup = lookdict
-+    IF HAS_DK_LOOKUP:
-+        # Can this fail? In any case dk_lookup was removed in python 3.11
-+        assert DK_LOOKUP(keys) is lookdict
- 
-     T = PyList_New(2)
-     PyList_SetItem(T, 0, ep.me_key)
-@@ -214,7 +159,7 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-     ep.me_key = NULL
-     ep.me_value = NULL
-     mp.ma_used -= 1
--    dk_set_index(keys, i, DKIX_DUMMY)
-+    dictkeys_set_index(keys, i, DKIX_DUMMY)
-     #We have transferred the to-be-deleted references to the list T
-     #we now delete the list so that the actual decref happens through a
-     #deallocation routine that uses the Python Trashcan macros to
-diff --git a/src/sage/cpython/dict_internal.h b/src/sage/cpython/dict_internal.h
-new file mode 100644
-index 00000000000..06c7a16b275
---- /dev/null
-+++ b/src/sage/cpython/dict_internal.h
-@@ -0,0 +1,165 @@
-+/* This contains internal definitions for python dictionaries,
-+ * mostly copied from cpython sourcecode.
-+ *
-+ * Moved here to make it easier to maintain in the face of python
-+ * changes.
-+ * */
-+
-+/************************************************************/
-+/* Copied verbatim from cpython 3.8 (Objects/dict-common.h) */
-+/************************************************************/
-+
-+#ifndef Py_DICT_COMMON_H
-+#define Py_DICT_COMMON_H
-+
-+typedef struct {
-+    /* Cached hash code of me_key. */
-+    Py_hash_t me_hash;
-+    PyObject *me_key;
-+    PyObject *me_value; /* This field is only meaningful for combined tables */
-+} PyDictKeyEntry;
-+
-+/* dict_lookup_func() returns index of entry which can be used like DK_ENTRIES(dk)[index].
-+ * -1 when no entry found, -3 when compare raises error.
-+ */
-+typedef Py_ssize_t (*dict_lookup_func)
-+    (PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr);
-+
-+#define DKIX_EMPTY (-1)
-+#define DKIX_DUMMY (-2)  /* Used internally */
-+#define DKIX_ERROR (-3)
-+
-+/* See dictobject.c for actual layout of DictKeysObject */
-+struct _dictkeysobject {
-+    Py_ssize_t dk_refcnt;
-+
-+    /* Size of the hash table (dk_indices). It must be a power of 2. */
-+    Py_ssize_t dk_size;
-+
-+    /* Function to lookup in the hash table (dk_indices):
-+
-+       - lookdict(): general-purpose, and may return DKIX_ERROR if (and
-+         only if) a comparison raises an exception.
-+
-+       - lookdict_unicode(): specialized to Unicode string keys, comparison of
-+         which can never raise an exception; that function can never return
-+         DKIX_ERROR.
-+
-+       - lookdict_unicode_nodummy(): similar to lookdict_unicode() but further
-+         specialized for Unicode string keys that cannot be the <dummy> value.
-+
-+       - lookdict_split(): Version of lookdict() for split tables. */
-+    dict_lookup_func dk_lookup;
-+
-+    /* Number of usable entries in dk_entries. */
-+    Py_ssize_t dk_usable;
-+
-+    /* Number of used entries in dk_entries. */
-+    Py_ssize_t dk_nentries;
-+
-+    /* Actual hash table of dk_size entries. It holds indices in dk_entries,
-+       or DKIX_EMPTY(-1) or DKIX_DUMMY(-2).
-+
-+       Indices must be: 0 <= indice < USABLE_FRACTION(dk_size).
-+
-+       The size in bytes of an indice depends on dk_size:
-+
-+       - 1 byte if dk_size <= 0xff (char*)
-+       - 2 bytes if dk_size <= 0xffff (int16_t*)
-+       - 4 bytes if dk_size <= 0xffffffff (int32_t*)
-+       - 8 bytes otherwise (int64_t*)
-+
-+       Dynamically sized, SIZEOF_VOID_P is minimum. */
-+    char dk_indices[];  /* char is required to avoid strict aliasing. */
-+
-+    /* "PyDictKeyEntry dk_entries[dk_usable];" array follows:
-+       see the DK_ENTRIES() macro */
-+};
-+
-+#endif
-+
-+
-+/***********************************************************/
-+/* Copied verbatim from cpython 3.8 (Objects/dictobject.c) */
-+/***********************************************************/
-+
-+#define PERTURB_SHIFT 5
-+#define DK_SIZE(dk) ((dk)->dk_size)
-+#if SIZEOF_VOID_P > 4
-+#define DK_IXSIZE(dk)                          \
-+    (DK_SIZE(dk) <= 0xff ?                     \
-+        1 : DK_SIZE(dk) <= 0xffff ?            \
-+            2 : DK_SIZE(dk) <= 0xffffffff ?    \
-+                4 : sizeof(int64_t))
-+#else
-+#define DK_IXSIZE(dk)                          \
-+    (DK_SIZE(dk) <= 0xff ?                     \
-+        1 : DK_SIZE(dk) <= 0xffff ?            \
-+            2 : sizeof(int32_t))
-+#endif
-+#define DK_ENTRIES(dk) \
-+    ((PyDictKeyEntry*)(&((int8_t*)((dk)->dk_indices))[DK_SIZE(dk) * DK_IXSIZE(dk)]))
-+
-+#define DK_MASK(dk) (((dk)->dk_size)-1)
-+
-+/* lookup indices.  returns DKIX_EMPTY, DKIX_DUMMY, or ix >=0 */
-+static inline Py_ssize_t
-+dictkeys_get_index(PyDictKeysObject *keys, Py_ssize_t i)
-+{
-+    Py_ssize_t s = DK_SIZE(keys);
-+    Py_ssize_t ix;
-+
-+    if (s <= 0xff) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    else if (s <= 0xffff) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (s > 0xffffffff) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    assert(ix >= DKIX_DUMMY);
-+    return ix;
-+}
-+
-+/* write to indices. */
-+static inline void
-+dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+{
-+    Py_ssize_t s = DK_SIZE(keys);
-+
-+    assert(ix >= DKIX_DUMMY);
-+
-+    if (s <= 0xff) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        assert(ix <= 0x7f);
-+        indices[i] = (char)ix;
-+    }
-+    else if (s <= 0xffff) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fff);
-+        indices[i] = (int16_t)ix;
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (s > 0xffffffff) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        indices[i] = ix;
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fffffff);
-+        indices[i] = (int32_t)ix;
-+    }
-+}
-+
-+/************************************************************/
--- 
-2.38.1
-
-
-From 76040803c8ae150baef449edce67ebdafb2ee896 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Nov 2022 11:53:24 -0300
-Subject: [PATCH 02/11] dict_del_by_value: add internal definitions for python
- 3.11
-
----
- src/sage/cpython/dict_internal.h | 77 ++++++++++++++++++++++++++++++++
- 1 file changed, 77 insertions(+)
-
-diff --git a/src/sage/cpython/dict_internal.h b/src/sage/cpython/dict_internal.h
-index 06c7a16b275..42a57bcb468 100644
---- a/src/sage/cpython/dict_internal.h
-+++ b/src/sage/cpython/dict_internal.h
-@@ -5,6 +5,8 @@
-  * changes.
-  * */
- 
-+#if PY_VERSION_HEX < 0x30b0000
-+
- /************************************************************/
- /* Copied verbatim from cpython 3.8 (Objects/dict-common.h) */
- /************************************************************/
-@@ -163,3 +165,78 @@ dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
- }
- 
- /************************************************************/
-+
-+#else   /* Python >= 3.11 */
-+
-+#define Py_BUILD_CORE
-+#include <internal/pycore_dict.h>
-+
-+/************************************************************/
-+/* Copied verbatim from cpython 3.11 (Objects/dictobject.c) */
-+/************************************************************/
-+
-+#define PERTURB_SHIFT 5
-+#define DK_MASK(dk) (DK_SIZE(dk)-1)
-+
-+/* lookup indices.  returns DKIX_EMPTY, DKIX_DUMMY, or ix >=0 */
-+static inline Py_ssize_t
-+dictkeys_get_index(const PyDictKeysObject *keys, Py_ssize_t i)
-+{
-+    int log2size = DK_LOG_SIZE(keys);
-+    Py_ssize_t ix;
-+
-+    if (log2size < 8) {
-+        const int8_t *indices = (const int8_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    else if (log2size < 16) {
-+        const int16_t *indices = (const int16_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (log2size >= 32) {
-+        const int64_t *indices = (const int64_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#endif
-+    else {
-+        const int32_t *indices = (const int32_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    assert(ix >= DKIX_DUMMY);
-+    return ix;
-+}
-+
-+/* write to indices. */
-+static inline void
-+dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+{
-+    int log2size = DK_LOG_SIZE(keys);
-+
-+    assert(ix >= DKIX_DUMMY);
-+    assert(keys->dk_version == 0);
-+
-+    if (log2size < 8) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        assert(ix <= 0x7f);
-+        indices[i] = (char)ix;
-+    }
-+    else if (log2size < 16) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fff);
-+        indices[i] = (int16_t)ix;
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (log2size >= 32) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        indices[i] = ix;
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fffffff);
-+        indices[i] = (int32_t)ix;
-+    }
-+}
-+
-+#endif
--- 
-2.38.1
-
-
-From 014c2ac9a6f6de25d4e31fe0bdaf819e9c67d24b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 06:47:18 -0300
-Subject: [PATCH 03/11] deprecated uu -> base64
-
----
- src/sage/rings/polynomial/pbori/gbrefs.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/rings/polynomial/pbori/gbrefs.py b/src/sage/rings/polynomial/pbori/gbrefs.py
-index 76e3924715d..70dc795cbab 100644
---- a/src/sage/rings/polynomial/pbori/gbrefs.py
-+++ b/src/sage/rings/polynomial/pbori/gbrefs.py
-@@ -1,6 +1,6 @@
- import gzip
- from io import StringIO
--import uu
-+import base64 as uu
- import re
- from types import ModuleType
- from .PyPolyBoRi import Polynomial
--- 
-2.38.1
-
-
-From dc8e155994a870a5e0b01a690a3fec8975197973 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 06:47:34 -0300
-Subject: [PATCH 04/11] sage.misc.fpickle: fix for python 3.11
-
----
- src/sage/misc/fpickle.pyx | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/src/sage/misc/fpickle.pyx b/src/sage/misc/fpickle.pyx
-index 502080e2c10..c5d544765bb 100644
---- a/src/sage/misc/fpickle.pyx
-+++ b/src/sage/misc/fpickle.pyx
-@@ -34,6 +34,12 @@ def reduce_code(co):
-         sage: def foo(N): return N+1
-         sage: sage.misc.fpickle.reduce_code(foo.__code__)
-         (<cyfunction code_ctor at ...>, ...)
-+
-+    Test that the constructed code matches the original code:
-+
-+        sage: ctor, args = sage.misc.fpickle.reduce_code(foo.__code__)
-+        sage: ctor(*args) == foo.__code__
-+        True
-     """
-     if co.co_freevars or co.co_cellvars:
-         raise ValueError("Cannot pickle code objects from closures")
-@@ -44,7 +50,12 @@ def reduce_code(co):
-     co_args += (co.co_kwonlyargcount, co.co_nlocals,
-                 co.co_stacksize, co.co_flags, co.co_code,
-                 co.co_consts, co.co_names, co.co_varnames, co.co_filename,
--                co.co_name, co.co_firstlineno, co.co_lnotab)
-+                co.co_name)
-+    if sys.version_info.minor >= 11:
-+        co_args += (co.co_qualname, co.co_firstlineno,
-+                    co.co_linetable, co.co_exceptiontable)
-+    else:
-+        co_args += (co.co_firstlineno, co.co_lnotab)
- 
-     return (code_ctor, co_args)
- 
--- 
-2.38.1
-
-
-From 8b0dac2322d4a888c607c56d3b5a72ff71df4147 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 08:15:43 -0300
-Subject: [PATCH 05/11] Fix FullArgSpec usage after
- 9eb08f3afde3266bbd667e196513240a0fe245f4
-
- - `kwonlydefaults` default is `[]` rather than `{}`
- - `argspec.keywords` changed to `argspec.varkw`
- - `ArgSpec` changed to `FullArgSpec`
----
- src/sage/coding/abstract_code.py | 2 +-
- src/sage/misc/decorators.py      | 7 ++++---
- src/sage/misc/sageinspect.py     | 9 +++++----
- 3 files changed, 10 insertions(+), 8 deletions(-)
-
-diff --git a/src/sage/coding/abstract_code.py b/src/sage/coding/abstract_code.py
-index ba2ec68a038..238a165c021 100644
---- a/src/sage/coding/abstract_code.py
-+++ b/src/sage/coding/abstract_code.py
-@@ -123,7 +123,7 @@ def _explain_constructor(cl):
-         reqs = "The constructor requires the arguments {}.".format(args)
-     else:
-         reqs = "The constructor requires no arguments."
--    if argspec.varargs or argspec.keywords:
-+    if argspec.varargs or argspec.varkw:
-         var = "It accepts unspecified arguments as well.\n"
-     else:
-         var = ""
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 311a5105739..271e243050f 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -423,7 +423,8 @@ class suboptions():
-             defaults = (argspec.defaults if argspec.defaults is not None else ()) \
-                         + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
-+            return FullArgSpec(args, argspec.varargs, argspec.varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
-         wrapper._sage_argspec_ = argspec
- 
-         return wrapper
-@@ -500,8 +501,8 @@ class options():
-                     list(self.options))
-             defaults = (argspec.defaults or ()) + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return FullArgSpec(args, argspec.varargs, argspec.keywords, defaults,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+            return FullArgSpec(args, argspec.varargs, argspec.varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         wrapper._sage_argspec_ = argspec
- 
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index a3821cb56b9..ce9a74f931d 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -1137,7 +1137,7 @@ def _sage_getargspec_from_ast(source):
- 
-     return inspect.FullArgSpec(args, vararg, kwarg,
-                                tuple(defaults) if defaults else None,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
- def _sage_getargspec_cython(source):
-@@ -1683,7 +1683,8 @@ def sage_getargspec(obj):
-         # Note that this may give a wrong result for the constants!
-         try:
-             args, varargs, varkw = inspect.getargs(obj.__code__)
--            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__)
-+            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__,
-+                                       kwonlyargs=[], kwonlydefaults=None, annotations={})
-         except (TypeError, AttributeError):
-             pass
-     if isclassinstance(obj):
-@@ -1742,7 +1743,7 @@ def sage_getargspec(obj):
-     except AttributeError:
-         defaults = None
-     return inspect.FullArgSpec(args, varargs, varkw, defaults,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
- def formatannotation(annotation, base_module=None):
-@@ -1788,7 +1789,7 @@ def formatannotation(annotation, base_module=None):
- 
- 
- def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
--                       kwonlyargs=(), kwonlydefaults={}, annotations={},
-+                       kwonlyargs=(), kwonlydefaults=None, annotations={},
-                        formatarg=str,
-                        formatvarargs=lambda name: '*' + name,
-                        formatvarkw=lambda name: '**' + name,
--- 
-2.38.1
-
-
-From db45aebfd6bd8413bec0fda218410d72deacd398 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 07:13:38 -0300
-Subject: [PATCH 06/11] warnings: ignore deprecation for 'import cgi' in cython
-
----
- src/sage/all.py | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index 6aef26c42a9..92d36d1fd26 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -104,6 +104,11 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message='The distutils(.sysconfig module| package) is deprecated',
-                         module='Cython|distutils|numpy|sage.env|sage.features')
- 
-+# triggered by cython 0.29.32
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message="'cgi' is deprecated and slated for removal in Python 3.13",
-+                        module='Cython')
-+
- ################ end setup warnings ###############################
- 
- 
--- 
-2.38.1
-
-
-From 664fc008ed50c2f61fb3df3020c0d81b41170628 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 20:39:12 -0300
-Subject: [PATCH 07/11] warnings: ignore deprecation for 'import sre_constants'
- in pyparsing
-
----
- src/sage/all.py | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index 92d36d1fd26..ea0712308b4 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -109,6 +109,11 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message="'cgi' is deprecated and slated for removal in Python 3.13",
-                         module='Cython')
- 
-+# triggered by pyparsing 2.4.7
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message="module 'sre_constants' is deprecated",
-+                        module='pyparsing')
-+
- ################ end setup warnings ###############################
- 
- 
--- 
-2.38.1
-
-
-From 08e1161c23caeeed5ad0e0237df8172eb8806ee5 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:40:17 -0300
-Subject: [PATCH 08/11] warnings: ignore deprecation of
- importlib.resources.path/read_binary
-
----
- src/sage/all.py                    | 6 ++++++
- src/sage/repl/display/formatter.py | 3 +++
- 2 files changed, 9 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index ea0712308b4..fedf2a17aab 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -114,6 +114,12 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message="module 'sre_constants' is deprecated",
-                         module='pyparsing')
- 
-+# importlib.resources.path and ...read_binary are deprecated in python 3.11,
-+# but the replacement importlib.resources.files needs python 3.9
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message=r'(path|read_binary) is deprecated\. Use files\(\) instead\.',
-+                        module='sage.repl.rich_output.output_(graphics|graphics3d|video)')
-+
- ################ end setup warnings ###############################
- 
- 
-diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py
-index 488f0bf2791..7e06656d880 100644
---- a/src/sage/repl/display/formatter.py
-+++ b/src/sage/repl/display/formatter.py
-@@ -143,6 +143,9 @@ class SageDisplayFormatter(DisplayFormatter):
- 
-             sage: import os
-             sage: import importlib.resources
-+            sage: import warnings
-+            sage: warnings.filterwarnings('ignore', category=DeprecationWarning,
-+            ....:     message=r'path is deprecated\. Use files\(\) instead\.')
-             sage: from sage.repl.rich_output.backend_ipython import BackendIPython
-             sage: backend = BackendIPython()
-             sage: shell = get_test_shell()
--- 
-2.38.1
-
-
-From 44480f4827e2bc1ed8daf6f4504a22ae6e8be4a4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 07:14:01 -0300
-Subject: [PATCH 09/11] doctests: fixes due to ArgSpec -> FullArgSpec change
-
----
- src/sage/interfaces/singular.py            |  3 +-
- src/sage/libs/singular/standard_options.py |  3 +-
- src/sage/misc/cachefunc.pyx                |  6 +-
- src/sage/misc/decorators.py                |  9 ++-
- src/sage/misc/lazy_import.pyx              |  4 +-
- src/sage/misc/sageinspect.py               | 94 ++++++++++------------
- src/sage/parallel/decorate.py              |  3 +-
- src/sage/plot/plot3d/plot3d.py             | 18 +++--
- src/sage/sets/set_from_iterator.py         |  4 +-
- 9 files changed, 76 insertions(+), 68 deletions(-)
-
-diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
-index 9c9586d8bc7..1dea77cdff0 100644
---- a/src/sage/interfaces/singular.py
-+++ b/src/sage/interfaces/singular.py
-@@ -2734,7 +2734,8 @@ def singular_gb_standard_options(func):
-         sage: P.<x,y> = QQ[]
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.interreduced_basis)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getsourcelines(I.interreduced_basis)
-         (['    @handle_AA_and_QQbar\n',
-           '    @singular_gb_standard_options\n',
-diff --git a/src/sage/libs/singular/standard_options.py b/src/sage/libs/singular/standard_options.py
-index 6797cb05001..5d74da3ce3a 100644
---- a/src/sage/libs/singular/standard_options.py
-+++ b/src/sage/libs/singular/standard_options.py
-@@ -117,7 +117,8 @@ def libsingular_gb_standard_options(func):
-         sage: P.<x,y> = QQ[]
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.interreduced_basis)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getsourcelines(I.interreduced_basis)
-         (['    @handle_AA_and_QQbar\n',
-           '    @singular_gb_standard_options\n',
-diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx
-index 72042ef13d6..cea3071115d 100644
---- a/src/sage/misc/cachefunc.pyx
-+++ b/src/sage/misc/cachefunc.pyx
-@@ -931,9 +931,9 @@ cdef class CachedFunction():
-             sage: I = P*[x,y]
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(I.groebner_basis)   # indirect doctest
--            ArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
--            varargs='args', keywords='kwds', defaults=('', None, None,
--            False))
-+            FullArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
-+                        varargs='args', varkw='kwds', defaults=('', None, None, False),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         """
-         return sage_getargspec(self.f)
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 271e243050f..dd9123f5004 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -93,7 +93,8 @@ def sage_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
-         5
-         sage: from sage.misc.sageinspect import sage_getargspec
-         sage: sage_getargspec(g)
--        ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['x'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Demonstrate that it correctly gets the source lines and the source
-     file, which is essential for interactive code edition; note that we
-@@ -392,7 +393,8 @@ class suboptions():
- 
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(f)
--            ArgSpec(args=['arrow_size'], varargs='args', keywords='kwds', defaults=(2,))
-+            FullArgSpec(args=['arrow_size'], varargs='args', varkw='kwds', defaults=(2,),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         @sage_wraps(func)
-         def wrapper(*args, **kwds):
-@@ -460,7 +462,8 @@ class options():
-             sage: f1 = o(f)
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(f1)
--            ArgSpec(args=['rgbcolor'], varargs='args', keywords='kwds', defaults=((0, 0, 1),))
-+            FullArgSpec(args=['rgbcolor'], varargs='args', varkw='kwds', defaults=((0, 0, 1),),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         self.options = options
-         self.original_opts = options.pop('__original_opts', False)
-diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx
-index 2d4413cd1a3..018078b0cf2 100644
---- a/src/sage/misc/lazy_import.pyx
-+++ b/src/sage/misc/lazy_import.pyx
-@@ -351,7 +351,9 @@ cdef class LazyImport():
-             sage: from sage.misc.lazy_import import LazyImport
-             sage: rm = LazyImport('sage.all', 'random_matrix')
-             sage: rm._sage_argspec_()
--            ArgSpec(args=['ring', 'nrows', 'ncols', 'algorithm', 'implementation'], varargs='args', keywords='kwds', defaults=(None, 'randomize', None))
-+            FullArgSpec(args=['ring', 'nrows', 'ncols', 'algorithm', 'implementation'],
-+                        varargs='args', varkw='kwds', defaults=(None, 'randomize', None),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         return sageinspect.sage_getargspec(self.get_object())
- 
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index ce9a74f931d..619ff6da661 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -109,7 +109,7 @@ defined Cython code, and with rather tricky argument lines::
-     sage: print(sage_getsource(foo))                                                                        # optional - sage.misc.cython
-     def foo(unsigned int x=1, a=')"', b={not (2+1==3):'bar'}, *args, **kwds): return
-     sage: sage_getargspec(foo)                                                                              # optional - sage.misc.cython
--    ArgSpec(args=['x', 'a', 'b'], varargs='args', keywords='kwds', defaults=(1, ')"', {False: 'bar'}))
-+    FullArgSpec(args=['x', 'a', 'b'], varargs='args', varkw='kwds', defaults=(1, ')"', {False: 'bar'}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- """
- 
-@@ -343,7 +343,7 @@ def _extract_embedded_signature(docstring, name):
-         File: sage/misc/nested_class.pyx (starting at line ...)
-         ...
-         sage: _extract_embedded_signature(MainClass.NestedClass.NestedSubClass.dummy.__doc__, 'dummy')[1]
--        ArgSpec(args=['self', 'x', 'r'], varargs='args', keywords='kwds', defaults=((1, 2, 3.4),))
-+        FullArgSpec(args=['self', 'x', 'r'], varargs='args', varkw='kwds', defaults=((1, 2, 3.4),), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _extract_embedded_signature(range.__call__.__doc__, '__call__')
-         ('Call self as a function.', None)
-     """
-@@ -1107,22 +1107,18 @@ def _sage_getargspec_from_ast(source):
- 
-     EXAMPLES::
- 
--        sage: import warnings
--        sage: warnings.filterwarnings('ignore',
--        ....:                         r'inspect.getargspec\(\) is deprecated',
--        ....:                         DeprecationWarning)
-         sage: import inspect, sage.misc.sageinspect as sms
-         sage: from_ast = sms._sage_getargspec_from_ast
-         sage: s = "def f(a, b=2, c={'a': [4, 5.5, False]}, d=(None, True)):\n    return"
-         sage: from_ast(s)
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)))
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: context = {}
-         sage: exec(compile(s, '<string>', 'single'), context)
--        sage: inspect.getargspec(context['f'])
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)))
--        sage: from_ast(s) == inspect.getargspec(context['f'])
-+        sage: inspect.getfullargspec(context['f'])
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)), kwonlyargs=[], kwonlydefaults=None, annotations={})
-+        sage: from_ast(s) == inspect.getfullargspec(context['f'])
-         True
--        sage: set(from_ast(sms.sage_getsource(x)) == inspect.getargspec(x) for x in [factor, identity_matrix, Graph.__init__])
-+        sage: set(from_ast(sms.sage_getsource(x)) == inspect.getfullargspec(x) for x in [factor, identity_matrix, Graph.__init__])
-         {True}
-     """
-     ast_args = ast.parse(source.lstrip()).body[0].args
-@@ -1159,23 +1155,23 @@ def _sage_getargspec_cython(source):
- 
-         sage: from sage.misc.sageinspect import _sage_getargspec_cython as sgc
-         sage: sgc("cpdef double abc(self, Element x=None, Parent base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc("def __init__(self, x=None, unsigned int base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def o(p, r={}, *q, **s) except? -1:')
--        ArgSpec(args=['p', 'r'], varargs='q', keywords='s', defaults=({},))
-+        FullArgSpec(args=['p', 'r'], varargs='q', varkw='s', defaults=({},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('cpdef how(r=(None, "u:doing?")):')
--        ArgSpec(args=['r'], varargs=None, keywords=None, defaults=((None, 'u:doing?'),))
-+        FullArgSpec(args=['r'], varargs=None, varkw=None, defaults=((None, 'u:doing?'),), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def _(x="):"):')
--        ArgSpec(args=['x'], varargs=None, keywords=None, defaults=('):',))
-+        FullArgSpec(args=['x'], varargs=None, varkw=None, defaults=('):',), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(z = {(1, 2, 3): True}):\n    return z')
--        ArgSpec(args=['z'], varargs=None, keywords=None, defaults=({(1, 2, 3): True},))
-+        FullArgSpec(args=['z'], varargs=None, varkw=None, defaults=({(1, 2, 3): True},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(double x, z = {(1, 2, 3): True}):\n    return z')
--        ArgSpec(args=['x', 'z'], varargs=None, keywords=None, defaults=({(1, 2, 3): True},))
-+        FullArgSpec(args=['x', 'z'], varargs=None, varkw=None, defaults=({(1, 2, 3): True},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(*args): pass')
--        ArgSpec(args=[], varargs='args', keywords=None, defaults=None)
-+        FullArgSpec(args=[], varargs='args', varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(**args): pass')
--        ArgSpec(args=[], varargs=None, keywords='args', defaults=None)
-+        FullArgSpec(args=[], varargs=None, varkw='args', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Some malformed input is detected::
- 
-@@ -1207,17 +1203,17 @@ def _sage_getargspec_cython(source):
- 
-         sage: def dummy_python(self, *args, x=1): pass
-         sage: sgc("def dummy_python(self, *args, x=1): pass")
--        ArgSpec(args=['self', 'x'], varargs='args', keywords=None, defaults=(1,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: cython("def dummy_cython(self, *args, x=1): pass")
-         sage: sgc("def dummy_cython(self, *args, x=1): pass")
--        ArgSpec(args=['self', 'x'], varargs='args', keywords=None, defaults=(1,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In some examples above, a syntax error was raised when a type
-     definition contains a pointer. An exception is made for ``char*``,
-     since C strings are acceptable input in public Cython functions::
- 
-         sage: sgc('def f(char *x = "a string", z = {(1,2,3): True}): pass')
--        ArgSpec(args=['x', 'z'], varargs=None, keywords=None, defaults=('a string', {(1, 2, 3): True}))
-+        FullArgSpec(args=['x', 'z'], varargs=None, varkw=None, defaults=('a string', {(1, 2, 3): True}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
-     AUTHORS:
-@@ -1503,40 +1499,40 @@ def sage_getargspec(obj):
-         sage: def f(x, y, z=1, t=2, *args, **keywords):
-         ....:     pass
-         sage: sage_getargspec(f)
--        ArgSpec(args=['x', 'y', 'z', 't'], varargs='args', keywords='keywords', defaults=(1, 2))
-+        FullArgSpec(args=['x', 'y', 'z', 't'], varargs='args', varkw='keywords', defaults=(1, 2), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     We now run sage_getargspec on some functions from the Sage library::
- 
-         sage: sage_getargspec(identity_matrix)
--        ArgSpec(args=['ring', 'n', 'sparse'], varargs=None, keywords=None, defaults=(0, False))
-+        FullArgSpec(args=['ring', 'n', 'sparse'], varargs=None, varkw=None, defaults=(0, False), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(factor)
--        ArgSpec(args=['n', 'proof', 'int_', 'algorithm', 'verbose'], varargs=None, keywords='kwds', defaults=(None, False, 'pari', 0))
-+        FullArgSpec(args=['n', 'proof', 'int_', 'algorithm', 'verbose'], varargs=None, varkw='kwds', defaults=(None, False, 'pari', 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In the case of a class or a class instance, the ``ArgSpec`` of the
-     ``__new__``, ``__init__`` or ``__call__`` method is returned::
- 
-         sage: P.<x,y> = QQ[]
-         sage: sage_getargspec(P)
--        ArgSpec(args=['base_ring', 'n', 'names', 'order'], varargs=None, keywords=None, defaults=('degrevlex',))
-+        FullArgSpec(args=['base_ring', 'n', 'names', 'order'], varargs=None, varkw=None, defaults=('degrevlex',), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(P.__class__)
--        ArgSpec(args=['self', 'x'], varargs='args', keywords='kwds', defaults=(0,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw='kwds', defaults=(0,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following tests against various bugs that were fixed in
-     :trac:`9976`::
- 
-         sage: from sage.rings.polynomial.real_roots import bernstein_polynomial_factory_ratlist
-         sage: sage_getargspec(bernstein_polynomial_factory_ratlist.coeffs_bitsize)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: from sage.rings.polynomial.pbori.pbori import BooleanMonomialMonoid
-         sage: sage_getargspec(BooleanMonomialMonoid.gen)
--        ArgSpec(args=['self', 'i'], varargs=None, keywords=None, defaults=(0,))
-+        FullArgSpec(args=['self', 'i'], varargs=None, varkw=None, defaults=(0,), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.groebner_basis)
--        ArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
--        varargs='args', keywords='kwds', defaults=('', None, None, False))
-+        FullArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
-+        varargs='args', varkw='kwds', defaults=('', None, None, False), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: cython("cpdef int foo(x,y) except -1: return 1")
-         sage: sage_getargspec(foo)
--        ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['x', 'y'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     If a ``functools.partial`` instance is involved, we see no other meaningful solution
-     than to return the argspec of the underlying function::
-@@ -1546,7 +1542,7 @@ def sage_getargspec(obj):
-         sage: import functools
-         sage: f1 = functools.partial(f, 1,c=2)
-         sage: sage_getargspec(f1)
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(1,))
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     TESTS:
- 
-@@ -1572,14 +1568,14 @@ def sage_getargspec(obj):
-         sage: print(sage.misc.sageinspect.sage_getsource(O))
-         def foo(x, a=')"', b={(2+1):'bar', not 1:3, 3<<4:5}): return
-         sage: spec = sage.misc.sageinspect.sage_getargspec(O)
--        sage: spec.args, spec.varargs, spec.keywords
-+        sage: spec.args, spec.varargs, spec.varkw
-         (['x', 'a', 'b'], None, None)
-         sage: spec.defaults[0]
-         ')"'
-         sage: sorted(spec.defaults[1].items(), key=lambda x: str(x))
-         [(3, 'bar'), (48, 5), (False, 3)]
-         sage: sage.misc.sageinspect.sage_getargspec(O.__call__)
--        ArgSpec(args=['self', 'm', 'n'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self', 'm', 'n'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     ::
- 
-@@ -1588,13 +1584,13 @@ def sage_getargspec(obj):
-         def foo(x, a='\')"', b={not (2+1==3):'bar'}): return
-         <BLANKLINE>
-         sage: sage.misc.sageinspect.sage_getargspec(foo)
--        ArgSpec(args=['x', 'a', 'b'], varargs=None, keywords=None, defaults=('\')"', {False: 'bar'}))
-+        FullArgSpec(args=['x', 'a', 'b'], varargs=None, varkw=None, defaults=('\')"', {False: 'bar'}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following produced a syntax error before the patch at :trac:`11913`,
-     see also :trac:`26906`::
- 
-         sage: sage.misc.sageinspect.sage_getargspec(r.lm)                         # optional - rpy2
--        ArgSpec(args=['self'], varargs='args', keywords='kwds', defaults=None)
-+        FullArgSpec(args=['self'], varargs='args', varkw='kwds', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following was fixed in :trac:`16309`::
- 
-@@ -1608,23 +1604,23 @@ def sage_getargspec(obj):
-         ....:     cpdef meet(categories, bint as_list = False, tuple ignore_axioms=(), tuple axioms=()): pass
-         ....: ''')
-         sage: sage_getargspec(Foo.join)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(Bar.join)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(Bar.meet)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test that :trac:`17009` is fixed::
- 
-         sage: sage_getargspec(gap)
--        ArgSpec(args=['self', 'x', 'name'], varargs=None, keywords=None, defaults=(None,))
-+        FullArgSpec(args=['self', 'x', 'name'], varargs=None, varkw=None, defaults=(None,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     By :trac:`17814`, the following gives the correct answer (previously, the
-     defaults would have been found ``None``)::
- 
-         sage: from sage.misc.nested_class import MainClass
-         sage: sage_getargspec(MainClass.NestedClass.NestedSubClass.dummy)
--        ArgSpec(args=['self', 'x', 'r'], varargs='args', keywords='kwds', defaults=((1, 2, 3.4),))
-+        FullArgSpec(args=['self', 'x', 'r'], varargs='args', varkw='kwds', defaults=((1, 2, 3.4),), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In :trac:`18249` was decided to return a generic signature for Python
-     builtin functions, rather than to raise an error (which is what Python's
-@@ -1632,7 +1628,7 @@ def sage_getargspec(obj):
- 
-         sage: import inspect
-         sage: sage_getargspec(range)
--        ArgSpec(args=[], varargs='args', keywords='kwds', defaults=None)
-+        FullArgSpec(args=[], varargs='args', varkw='kwds', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test that :trac:`28524` is fixed::
- 
-@@ -1819,14 +1815,10 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
-     EXAMPLES::
- 
-         sage: from sage.misc.sageinspect import sage_formatargspec
--        sage: from inspect import formatargspec # deprecated in Python 3
-         sage: args = ['a', 'b', 'c']
-         sage: defaults = [3]
-         sage: sage_formatargspec(args, defaults=defaults)
-         '(a, b, c=3)'
--        sage: import warnings; warnings.simplefilter('ignore')  # ignore DeprecationWarning
--        sage: formatargspec(args, defaults=defaults) == sage_formatargspec(args, defaults=defaults)
--        True
-     """
-     def formatargandannotation(arg):
-         result = formatarg(arg)
-@@ -2649,11 +2641,11 @@ def __internal_tests():
-     Test _sage_getargspec_cython with multiple default arguments and a type::
- 
-         sage: _sage_getargspec_cython("def init(self, x=None, base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _sage_getargspec_cython("def __init__(self, x=None, base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _sage_getargspec_cython("def __init__(self, x=None, unsigned int base=0, **keys):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords='keys', defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw='keys', defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test _extract_embedded_position:
- 
-diff --git a/src/sage/parallel/decorate.py b/src/sage/parallel/decorate.py
-index c14518af570..3a7152d5ac9 100644
---- a/src/sage/parallel/decorate.py
-+++ b/src/sage/parallel/decorate.py
-@@ -243,7 +243,8 @@ for a in args[0]))
-             ....:     return x + y
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(p(f))
--            ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['x', 'y'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         from sage.misc.sageinspect import sage_getargspec
-         return sage_getargspec(self.func)
-diff --git a/src/sage/plot/plot3d/plot3d.py b/src/sage/plot/plot3d/plot3d.py
-index 64b11a0442a..174765980f7 100644
---- a/src/sage/plot/plot3d/plot3d.py
-+++ b/src/sage/plot/plot3d/plot3d.py
-@@ -329,19 +329,24 @@ class _Coordinates():
-             sage: t1,t2,t3=T.to_cartesian(lambda a,b: 2*a+b)
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: sage_getargspec(t2)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: sage_getargspec(t3)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-             sage: def g(a,b): return 2*a+b
-             sage: t1,t2,t3=T.to_cartesian(g)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: t1,t2,t3=T.to_cartesian(2*a+b)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         If we cannot guess the right parameter names, then the
-         parameters are named `u` and `v`::
-@@ -352,7 +357,8 @@ class _Coordinates():
-             sage: T = _ArbitraryCoordinates((x + y, x - y, z), z,[x,y])
-             sage: t1,t2,t3=T.to_cartesian(operator.add)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['u', 'v'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['u', 'v'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: [h(1,2) for h in T.to_cartesian(operator.mul)]
-             [3.0, -1.0, 2.0]
-             sage: [h(u=1,v=2) for h in T.to_cartesian(operator.mul)]
-diff --git a/src/sage/sets/set_from_iterator.py b/src/sage/sets/set_from_iterator.py
-index 3a2360383ea..74015c4433d 100644
---- a/src/sage/sets/set_from_iterator.py
-+++ b/src/sage/sets/set_from_iterator.py
-@@ -526,7 +526,9 @@ class Decorator():
-             sage: d = Decorator()
-             sage: d.f = find_local_minimum
-             sage: sage_getargspec(d) # indirect doctest
--            ArgSpec(args=['f', 'a', 'b', 'tol', 'maxfun'], varargs=None, keywords=None, defaults=(1.48e-08, 500))
-+            FullArgSpec(args=['f', 'a', 'b', 'tol', 'maxfun'],
-+                        varargs=None, varkw=None, defaults=(1.48e-08, 500),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         from sage.misc.sageinspect import sage_getargspec
-         return sage_getargspec(self.f)
--- 
-2.38.1
-
-
-From 482dd1ac3d2bcaa94dd935e3add1a5165674b146 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:12:38 -0300
-Subject: [PATCH 10/11] doctests: AssertionError message changed in python 3.11
-
----
- src/sage/misc/lazy_format.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/misc/lazy_format.py b/src/sage/misc/lazy_format.py
-index e3050695b25..b58ea155862 100644
---- a/src/sage/misc/lazy_format.py
-+++ b/src/sage/misc/lazy_format.py
-@@ -78,7 +78,7 @@ class LazyFormat(str):
-         ....:               LazyFormat("%s is wrong")%IDontLikeBeingPrinted())
-         Traceback (most recent call last):
-         ...
--        AssertionError: <unprintable AssertionError object>
-+        AssertionError: ...
-     """
- 
-     def __mod__(self, args):
--- 
-2.38.1
-
-
-From 7b6fa565f426e28e14be3b22c202301f9d530e9e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:13:13 -0300
-Subject: [PATCH 11/11] doctests: message added more info in python 3.11
-
----
- src/sage/repl/attach.py | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/sage/repl/attach.py b/src/sage/repl/attach.py
-index 39da6ee4acd..20b848e4f04 100644
---- a/src/sage/repl/attach.py
-+++ b/src/sage/repl/attach.py
-@@ -54,6 +54,7 @@ character-by-character::
-         exec(code, globals)
-       File ".../foobar.sage....py", line ..., in <module>
-         raise ValueError("third")   # this should appear in the source snippet
-+    ...
-     ValueError: third
-     sage: detach(src)
- """
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch b/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
deleted file mode 100644
index 4c26dfdb6843..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
-index b0c80f61480..1c9a53387a0 100644
---- a/src/sage/arith/long.pxd
-+++ b/src/sage/arith/long.pxd
-@@ -124,7 +124,7 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         ....:         if err == 0:
-         ....:             return value
-         ....:         elif err == ERR_OVERFLOW:
--        ....:             raise OverflowError("integer_check_long: overflow")
-+        ....:             raise OverflowError(f"integer_check_long: overflow ({x})")
-         ....:     elif err == ERR_TYPE:
-         ....:         raise TypeError("integer_check_long: wrong type")
-         ....:     elif err == ERR_INDEX:
-@@ -136,24 +136,23 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         ....: def long_max():
-         ....:     return smallInteger(LONG_MAX)
-         ....: ''')
--        sage: types = (ZZ, QQ, int)
-         sage: L = [1, 12345, 10^9, 2^30, long_max()//9, long_max()//3, long_max()]
-         sage: L += [-x for x in L] + [0, long_min()]
-         sage: for v in L:
--        ....:     for t in (Integer, int):
-+        ....:     for t in (Integer, int, QQ):
-         ....:         assert check_long(t(v)) == v
-         sage: check_long(2^100)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long(long_max() + 1)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long(long_min() - 1)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long("hello")
-         Traceback (most recent call last):
-         ...
-@@ -162,6 +161,36 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         Traceback (most recent call last):
-         ...
-         TypeError: integer_check_long: bad __index__
-+
-+    Repeat the overflow tests with python integers:
-+
-+        sage: check_long(int(2^100))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(int(long_max() + 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(int(long_min() - 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+
-+    And again with rationals:
-+
-+        sage: check_long(QQ(2^100))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(QQ(long_max() + 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(QQ(long_min() - 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-     """
-     cdef int c = integer_check_long_py(x, value, err)
-     if c:
-@@ -193,35 +222,93 @@ cdef inline long dig(const digit* D, int n):
- 
- cdef inline bint integer_check_long_py(x, long* value, int* err):
-     """
--    Part of ``integer_check_long`` in ``long.pxd``, checking only for
--    Python objects of type ``int`` and ``long``. See that function for
--    documentation and tests.
-+    Return whether ``x`` is a python object of type ``int``.
-+
-+    If possible, compute the value of this integer as C long and store
-+    it in ``*value``.
-+
-+    Errors are returned as an error indicator ``*err`` (without raising
-+    any Python exception).
-+
-+    Possible errors when returning ``True``:
-+
-+    - ``0``: ``x`` was successfully converted to a C long and its value
-+      is stored in ``*value``.
-+
-+    - ``ERR_OVERFLOW``: ``x`` is a python object of type ``int`` but
-+      too large to store in a C long.
-+
-+    Possible errors when returning ``False``:
-+
-+    - ``ERR_TYPE``: ``x`` is not a python object of type ``int``.
-+
-+    EXAMPLES:
-+
-+    We create a pure Python wrapper of this function::
-+
-+        sage: cython('''  # optional - sage.misc.cython
-+        ....: from sage.arith.long cimport *
-+        ....: def check_long_py(x):
-+        ....:     cdef long value
-+        ....:     cdef int err
-+        ....:     cdef bint c = integer_check_long_py(x, &value, &err)
-+        ....:     if c:
-+        ....:         if err == 0:
-+        ....:             return value
-+        ....:         elif err == ERR_OVERFLOW:
-+        ....:             return f"Overflow ({x})"
-+        ....:     elif err == ERR_TYPE:
-+        ....:         return f"Bad type ({x})"
-+        ....:     return f"This should never happen ({x})"
-+        ....: from libc.limits cimport LONG_MIN, LONG_MAX
-+        ....: def long_min():
-+        ....:     return LONG_MIN
-+        ....: def long_max():
-+        ....:     return LONG_MAX
-+        ....: ''')
-+        sage: L = [1, 12345, 10^9, 2^30, long_max()//9, long_max()//3, long_max()]
-+        sage: L += [-x for x in L] + [0, long_min()]
-+        sage: for v in L:
-+        ....:     assert check_long_py(int(v)) == v
-+        sage: check_long_py(int(2^100))
-+        'Overflow (...)'
-+        sage: check_long_py(int(long_max() + 1))
-+        'Overflow (...)'
-+        sage: check_long_py(int(long_min() - 1))
-+        'Overflow (...)'
-+        sage: check_long_py(389)
-+        'Bad type (...)'
-+        sage: check_long_py("hello")
-+        'Bad type (...)'
-+        sage: check_long_py(2/3)
-+        'Bad type (...)'
-     """
--    if not isinstance(x, long):
--        if isinstance(x, int):
--            # This can happen only on Python 2
--            value[0] = PyInt_AS_LONG(x)
--            err[0] = 0
--            return 1
-+    if not isinstance(x, int):
-         err[0] = ERR_TYPE
-         return 0
- 
--    # x is a Python "long" (called "int" on Python 3)
-+    # x is a Python "int" (aka PyLongObject or py_long in cython)
-     cdef const digit* D = (<py_long>x).ob_digit
-     cdef Py_ssize_t size = Py_SIZE(x)
- 
--    # We assume that PyLong_SHIFT is 15 on a 32-bit system and 30 on a
--    # 64-bit system. This is not guaranteed by Python, but it is the
--    # default configuration.
-+    # We assume PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT.
-+    # This is true in all the default configurations:
-+    # - BITS_IN_LONG = 63, PyLong_SHIFT = 30
-+    # - BITS_IN_LONG = 31, PyLong_SHIFT = 15 (python <= 3.10)
-+    # - BITS_IN_LONG = 31, PyLong_SHIFT = 30 (new in python 3.11)
-+    # cf. https://trac.sagemath.org/ticket/33842#comment:130
-     #
--    # This way, we know that 1 and 2 digits certainly fit in a C long
--    # and 4 or more digits never fit. For 3 digits, we need an explicit
--    # overflow check.
-+    # This way, we know that 1 digit certainly fits in a C long
-+    # and 4 or more digits never fit.
-+    # For 2 or 3 digits, we need an explicit overflow check.
-     cdef int BITS_IN_LONG = 8 * sizeof(long) - 1
--    if not (2 * PyLong_SHIFT <= BITS_IN_LONG < 4 * PyLong_SHIFT):
--        raise AssertionError
-+    if not (PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT):
-+        raise AssertionError(
-+                f"PyLong_SHIFT = {PyLong_SHIFT}, "
-+                f"BITS_IN_LONG = {BITS_IN_LONG}")
- 
-     cdef long lead
-+    cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
-     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
-     if size == 0:
-         value[0] = 0
-@@ -233,9 +320,20 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
-         value[0] = -dig(D, 0)
-         err[0] = 0
-     elif size == 2:
-+        if BITS_IN_LONG < 2 * PyLong_SHIFT and D[1] >= lead_2_overflow:
-+            err[0] = ERR_OVERFLOW
-+            return 1
-         value[0] = dig(D, 0) + dig(D, 1)
-         err[0] = 0
-     elif size == -2:
-+        if BITS_IN_LONG < 2 * PyLong_SHIFT and D[1] >= lead_2_overflow:
-+            if D[0] == 0 and D[1] == lead_2_overflow:
-+                # Special case for LONG_MIN
-+                value[0] = (<long>-1) << BITS_IN_LONG
-+                err[0] = 0
-+            else:
-+                err[0] = ERR_OVERFLOW
-+            return 1
-         value[0] = -(dig(D, 0) + dig(D, 1))
-         err[0] = 0
-     elif size == 3:
diff --git a/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch b/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
deleted file mode 100644
index 977a42400e59..000000000000
--- a/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-commit 5db5d4e56243c609f44afc1f21c112b026f9e1fe
-Author: Oscar Benjamin <oscar.j.benjamin@gmail.com>
-Date:   Mon Jul 11 21:24:01 2022 +0100
-
-    Update doctests for SymPy 1.11
-    
-    Doctests related to SymPy's rsolve function are updated in:
-    
-    src/sage/calculus/test_sympy.py
-    src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-    
-    The form of the output from SymPy has changed since
-    
-    https://github.com/sympy/sympy/pull/23567
-
-diff --git a/src/sage/calculus/test_sympy.py b/src/sage/calculus/test_sympy.py
-index 7cf7f3f6bfd..927e6ee4fb6 100644
---- a/src/sage/calculus/test_sympy.py
-+++ b/src/sage/calculus/test_sympy.py
-@@ -193,7 +193,7 @@ This was fixed in Sympy, see :trac:`14437`::
-     sage: u = Function('u')
-     sage: n = Symbol('n', integer=True)
-     sage: f = u(n+2) - u(n+1) + u(n)/4
--    sage: 2**n * rsolve(f,u(n))
--    C1*n + C0
-+    sage: expand(2**n * rsolve(f,u(n)))
-+    2*C1*n + C0
- 
- """
-diff --git a/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py b/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-index 1062f4f7e8c..f53f813d793 100644
---- a/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-+++ b/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-@@ -382,7 +382,7 @@ Sage example in ./recequadiff.tex, line 1798::
-   sage: from sympy import rsolve_hyper
-   sage: from sympy.abc import n
-   sage: rsolve_hyper([-2,1],2**(n+2),n)
--  2**n*C0 + 2**(n + 2)*(C0 + n/2)
-+  2**n*C0 + 2**(n + 1)*n
- 
- """
- 
diff --git a/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch b/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
deleted file mode 100644
index b544a3eef7dd..000000000000
--- a/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
+++ /dev/null
@@ -1,526 +0,0 @@
-From aeff992d53a65a705dca5cd5216bcb97c218dce7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:14:03 +0200
-Subject: Adapt to API changes in OpenOutputStream and CloseOutput
-
----
- src/sage/libs/gap/element.pyx      | 5 +++--
- src/sage/libs/gap/gap_includes.pxd | 6 ++++--
- 2 files changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
-index be43c4c..e268116 100644
---- a/src/sage/libs/gap/element.pyx
-+++ b/src/sage/libs/gap/element.pyx
-@@ -130,6 +130,7 @@ cdef char *capture_stdout(Obj func, Obj obj):
-     """
-     cdef Obj s, stream, output_text_string
-     cdef UInt res
-+    cdef TypOutputFile output
-     # The only way to get a string representation of an object that is truly
-     # consistent with how it would be represented at the GAP REPL is to call
-     # ViewObj on it.  Unfortunately, ViewObj *prints* to the output stream,
-@@ -145,12 +146,12 @@ cdef char *capture_stdout(Obj func, Obj obj):
-         output_text_string = GAP_ValueGlobalVariable("OutputTextString")
-         stream = CALL_2ARGS(output_text_string, s, GAP_True)
- 
--        if not OpenOutputStream(stream):
-+        if not OpenOutputStream(&output, stream):
-             raise GAPError("failed to open output capture stream for "
-                            "representing GAP object")
- 
-         CALL_1ARGS(func, obj)
--        CloseOutput()
-+        CloseOutput(&output)
-         return CSTR_STRING(s)
-     finally:
-         GAP_Leave()
-diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd
-index 5a9ab48..34035fe 100644
---- a/src/sage/libs/gap/gap_includes.pxd
-+++ b/src/sage/libs/gap/gap_includes.pxd
-@@ -76,8 +76,10 @@ cdef extern from "gap/intobj.h" nogil:
- 
- 
- cdef extern from "gap/io.h" nogil:
--    UInt OpenOutputStream(Obj stream)
--    UInt CloseOutput()
-+    ctypedef struct TypOutputFile:
-+        pass
-+    UInt OpenOutputStream(TypOutputFile* output, Obj stream)
-+    UInt CloseOutput(TypOutputFile* output)
- 
- 
- cdef extern from "gap/libgap-api.h" nogil:
--- 
-cgit v1.0-1-gd88e
-
-
-From c3367b4290981e5e93b7a30c48b02f1ae3770dc8 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:14:53 +0200
-Subject: Disable colored prompt as it breaks the pexpect interface
-
----
- src/sage/interfaces/gap.py | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
-index c34fe53..569caa2 100644
---- a/src/sage/interfaces/gap.py
-+++ b/src/sage/interfaces/gap.py
-@@ -1512,6 +1512,8 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
-     """
-     # Create new workspace with filename WORKSPACE
-     g = Gap(use_workspace_cache=False, max_workspace_size=None)
-+    g.eval('ColorPrompt(false)')
-+    g.eval('SetUserPreference("UseColorPrompt", false)')
-     g.eval('SetUserPreference("HistoryMaxLines", 30)')
-     from sage.tests.gap_packages import all_installed_packages
-     for pkg in all_installed_packages(gap=g):
--- 
-cgit v1.0-1-gd88e
-
-
-From 3b63e998e4d6118fc86b13b940c8f3d3b8307a50 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:16:03 +0200
-Subject: Port NaturalHomomorphism uses
-
----
- src/sage/groups/abelian_gps/abelian_group_gap.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/sage/groups/abelian_gps/abelian_group_gap.py b/src/sage/groups/abelian_gps/abelian_group_gap.py
-index a4b0471..86090b4 100644
---- a/src/sage/groups/abelian_gps/abelian_group_gap.py
-+++ b/src/sage/groups/abelian_gps/abelian_group_gap.py
-@@ -338,7 +338,7 @@ class AbelianGroup_gap(UniqueRepresentation, GroupMixinLibGAP, ParentLibGAP, Abe
-         if isinstance(x, AbelianGroupElement_gap):
-             try:
-                 if x in self._cover:
--                    x = self.gap().NaturalHomomorphism().Image(x.gap())
-+                    x = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations).Image(x.gap())
-                 else:
-                     x = x.gap()
-             except AttributeError:
-@@ -1043,7 +1043,7 @@ class AbelianGroupQuotient_gap(AbelianGroup_gap):
-             From: Abelian group with gap, generator orders (4,)
-             To:   Quotient abelian group with generator orders (2,)
-         """
--        phi = self.gap().NaturalHomomorphism()
-+        phi = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations)
-         Hom = self._cover.Hom(self)
-         return Hom(phi)
- 
--- 
-cgit v1.0-1-gd88e
-
-
-From bc40764be044653e06f2da3497e1e05da08251f7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:17:36 +0200
-Subject: Fix tests with GAP 4.12
-
----
- src/doc/en/thematic_tutorials/lie/weyl_groups.rst  | 12 ++++++------
- src/sage/coding/codecan/autgroup_can_label.pyx     |  2 +-
- src/sage/coding/linear_code.py                     | 22 +++++++++++-----------
- .../root_system/hecke_algebra_representation.py    |  2 +-
- src/sage/combinat/symmetric_group_algebra.py       |  2 +-
- src/sage/groups/finitely_presented.py              |  6 +++---
- src/sage/groups/fqf_orthogonal.py                  |  2 +-
- src/sage/groups/libgap_wrapper.pyx                 |  6 +++---
- .../perm_gps/partn_ref2/refinement_generic.pyx     |  2 +-
- src/sage/groups/perm_gps/permgroup.py              |  8 ++++----
- src/sage/libs/gap/libgap.pyx                       |  2 +-
- src/sage/libs/gap/util.pyx                         |  8 +-------
- src/sage/tests/gap_packages.py                     |  2 +-
- 13 files changed, 35 insertions(+), 41 deletions(-)
-
-diff --git a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-index c917338..182e74a 100644
---- a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-+++ b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-@@ -139,12 +139,12 @@ string, which you can print::
-     X.1      1  1  1  1  1  1  1  1  1  1  1  1  1
-     X.2      1 -1  1  1 -1  1  1 -1 -1 -1  1  1  1
-     X.3      2  .  2 -1  .  2  2  .  .  . -1  2  2
--    X.4      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
--    X.5      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
--    X.6      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
--    X.7      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
--    X.8      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
--    X.9      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
-+    X.4      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
-+    X.5      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
-+    X.6      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
-+    X.7      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
-+    X.8      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
-+    X.9      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
-     X.10     4 -2  . -1  .  .  .  2  .  .  1  . -4
-     X.11     4  2  . -1  .  .  . -2  .  .  1  . -4
-     X.12     6  . -2  .  . -2 -2  .  .  .  .  2  6
-diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx
-index de5db98..c83b926 100644
---- a/src/sage/coding/codecan/autgroup_can_label.pyx
-+++ b/src/sage/coding/codecan/autgroup_can_label.pyx
-@@ -76,7 +76,7 @@ columns do share the same coloring::
-     ((1,),
-      (2,),
-      (3, 5, 4),
--     (6, 19, 16, 9, 21, 10, 8, 15, 14, 11, 20, 13, 12, 7, 17, 18))
-+     (6, 19, 16, 21, 9, 10, 15, 8, 20, 11, 14, 13, 7, 12, 18, 17))
- 
- We can also restrict the group action to linear isometries::
- 
-diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py
-index e8e32f8..9d45160 100644
---- a/src/sage/coding/linear_code.py
-+++ b/src/sage/coding/linear_code.py
-@@ -466,27 +466,27 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric):
-             0
-             sage: C = codes.HammingCode(GF(4, 'z'), 3)
-             sage: C.automorphism_group_gens()
--            ([((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
-+                Defn: z |--> z + 1),
-+              ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z + 1),
--              ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
--                Defn: z |--> z),
-               ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-              362880)
-             sage: C.automorphism_group_gens(equivalence="linear")
--            ([((z + 1, 1, z + 1, z + 1, z + 1, z, 1, z, 1, 1, 1, 1, z + 1, z + 1, z + 1, z, z, 1, z, z, z); (1,15,2,8,16,18,3)(4,9,12,13,20,10,11)(5,21,14,6,7,19,17), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((z + 1, z + 1, z + 1, z + 1, z + 1, 1, z, 1, z, z, z, 1, z, 1, 1, 1, z + 1, z + 1, z + 1, 1, z); (1,15,21,8,9)(2,18,5,3,11,16,7,10,19,13,12,4,17,6,20), Ring endomorphism of Finite Field in z of size 2^2
-+              ((z + 1, z + 1, z + 1, z, 1, 1, z, z, 1, z + 1, z, 1, 1, z, 1, z + 1, z, z + 1, z + 1, 1, z); (1,3,18,2,17,6,19)(4,15,13,20,7,14,16)(5,11,8,21,12,9,10), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
-               ((z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1); (), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-              181440)
-             sage: C.automorphism_group_gens(equivalence="permutational")
--            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
-+              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,18)(3,19)(4,10)(5,16)(8,13)(9,14)(11,21)(15,20), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,17)(2,8)(3,14)(4,10)(7,12)(9,19)(13,18)(15,20), Ring endomorphism of Finite Field in z of size 2^2
-+              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
-               ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,13)(3,14)(4,20)(5,11)(8,18)(9,19)(10,15)(16,21), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-@@ -692,10 +692,10 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric):
-             sage: C_iso == aut_group_can_label.get_canonical_form()
-             True
-             sage: aut_group_can_label.get_autom_gens()
--            [((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
-+            [((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
-+               Defn: z |--> z + 1),
-+             ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
-                Defn: z |--> z + 1),
--             ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
--               Defn: z |--> z),
-              ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
-                Defn: z |--> z)]
-         """
-diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py
-index bde2823..bffcc85 100644
---- a/src/sage/combinat/root_system/hecke_algebra_representation.py
-+++ b/src/sage/combinat/root_system/hecke_algebra_representation.py
-@@ -355,7 +355,7 @@ class HeckeAlgebraRepresentation(WithEqualityById, SageObject):
-             sage: q1, q2 = K.gens()
-             sage: KW = W.algebra(K)
-             sage: x = KW.an_element(); x
--            123 + 3*32 + 2*3 + e
-+            123 + 3*2312 + 2*31 + e
- 
-             sage: T = KW.demazure_lusztig_operators(q1,q2)
-             sage: T12 = T.Tw( (1,2) )
-diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py
-index c3d6755..da953d2 100644
---- a/src/sage/combinat/symmetric_group_algebra.py
-+++ b/src/sage/combinat/symmetric_group_algebra.py
-@@ -101,7 +101,7 @@ def SymmetricGroupAlgebra(R, W, category=None):
-         sage: SGA.group()
-         Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space)
-         sage: SGA.an_element()
--        s1*s2*s3 + 3*s3*s2 + 2*s3 + 1
-+        s1*s2*s3 + 3*s2*s3*s1*s2 + 2*s3*s1 + 1
- 
-     The preferred way to construct the symmetric group algebra is to
-     go through the usual ``algebra`` method::
-diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
-index 2a61bbf..d26891a 100644
---- a/src/sage/groups/finitely_presented.py
-+++ b/src/sage/groups/finitely_presented.py
-@@ -596,9 +596,9 @@ class RewritingSystem():
-             sage: k = G.rewriting_system()
-             sage: k.gap()
-             Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules
--            [ [ a^2, <identity ...> ], [ a*A, <identity ...> ],
--              [ A*a, <identity ...> ], [ b^2, <identity ...> ],
--              [ b*B, <identity ...> ], [ B*b, <identity ...> ] ]
-+            [ [ a*A, <identity ...> ], [ A*a, <identity ...> ],
-+              [ b*B, <identity ...> ], [ B*b, <identity ...> ],
-+              [ a^2, <identity ...> ], [ b^2, <identity ...> ] ]
-         """
-         return self._gap
- 
-diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
-index 75de408..dd7d84d 100644
---- a/src/sage/groups/fqf_orthogonal.py
-+++ b/src/sage/groups/fqf_orthogonal.py
-@@ -143,7 +143,7 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
-         [2/3   0   0]
-         [  0 2/3   0]
-         [  0   0 4/3]
--        generated by 2 elements
-+        generated by 3 elements
-         sage: q = matrix.diagonal(QQ, [3/2, 1/4, 1/4])
-         sage: T = TorsionQuadraticForm(q)
-         sage: T.orthogonal_group().order()
-diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx
-index a76afc2..9340c0d 100644
---- a/src/sage/groups/libgap_wrapper.pyx
-+++ b/src/sage/groups/libgap_wrapper.pyx
-@@ -25,7 +25,7 @@ Note how we call the constructor of both superclasses to initialize
- its output via LibGAP::
- 
-     sage: FooGroup()
--    <pc group of size 3 with 1 generators>
-+    <pc group of size 3 with 1 generator>
-     sage: type(FooGroup().gap())
-     <class 'sage.libs.gap.element.GapElement'>
- 
-@@ -106,7 +106,7 @@ class ParentLibGAP(SageObject):
-         ....:         ParentLibGAP.__init__(self, lg)
-         ....:         Group.__init__(self)
-         sage: FooGroup()
--        <pc group of size 3 with 1 generators>
-+        <pc group of size 3 with 1 generator>
-     """
- 
-     def __init__(self, libgap_parent, ambient=None):
-@@ -461,7 +461,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement):
-         ....:         ParentLibGAP.__init__(self, lg)
-         ....:         Group.__init__(self)
-         sage: FooGroup()
--        <pc group of size 3 with 1 generators>
-+        <pc group of size 3 with 1 generator>
-         sage: FooGroup().gens()
-         (f1,)
-     """
-diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-index 2fcb036..ca73c6b 100644
---- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-+++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-@@ -427,7 +427,7 @@ cdef class LabelledBranching:
-             sage: from sage.groups.perm_gps.partn_ref2.refinement_generic import LabelledBranching
-             sage: L = LabelledBranching(3)
-             sage: L.small_generating_set()
--            []
-+            [()]
-             sage: L.add_gen(libgap.eval('(1,2,3)'))
-             sage: L.small_generating_set()
-             [(1,2,3)]
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 4908934..34ba0cc 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -913,7 +913,7 @@ class PermutationGroup_generic(FiniteGroup):
-            sage: f = PG._coerce_map_from_(MG)
-            sage: mg = MG.an_element()
-            sage: p = f(mg); p
--           (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60)
-+           (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21)
-            sage: PG(p._gap_()) == p
-            True
- 
-@@ -959,12 +959,12 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: P = G.as_permutation_group(algorithm='smaller', seed=5)
-             sage: P1 = G.as_permutation_group()
-             sage: P == P1
--            False
-+            True
-             sage: g1, g2, g3 = G.gens()
-             sage: P(g1*g2)
--            (1,3,7,12)(2,4,8,10)(5,11)(6,9)
-+            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
-             sage: P1(g1*g2)
--            (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66)
-+            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
- 
-         Another check for :trac:`5583`::
- 
-diff --git a/src/sage/libs/gap/libgap.pyx b/src/sage/libs/gap/libgap.pyx
-index b1a64e5..6a36613 100644
---- a/src/sage/libs/gap/libgap.pyx
-+++ b/src/sage/libs/gap/libgap.pyx
-@@ -695,7 +695,7 @@ class Gap(Parent):
-             sage: libgap.List
-             <Gap function "List">
-             sage: libgap.GlobalRandomSource
--            <RandomSource in IsGlobalRandomSource>
-+            <RandomSource in IsGAPRandomSource>
-         """
-         if name in dir(self.__class__):
-             return getattr(self.__class__, name)
-diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
-index 344ab88..6350987 100644
---- a/src/sage/libs/gap/util.pyx
-+++ b/src/sage/libs/gap/util.pyx
-@@ -362,15 +362,9 @@ cdef Obj gap_eval(str gap_string) except? NULL:
-         GAPError: Error, Variable: 'Complex' must have a value
-         Syntax error: ; expected in stream:1
-         Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^
-+                ^^^^^
-         Error, Variable: 'with' must have a value
--        Syntax error: ; expected in stream:1
--        Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^^^^^^^^^
-         Error, Variable: 'bits' must have a value
--        Syntax error: ; expected in stream:1
--        Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-         Error, Variable: 'precision' must have a value
- 
-     Test that on a subsequent attempt we get the same message (no garbage was
-diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py
-index 2e4518c..c302b16 100644
---- a/src/sage/tests/gap_packages.py
-+++ b/src/sage/tests/gap_packages.py
-@@ -103,7 +103,7 @@ def all_installed_packages(ignore_dot_gap=False, gap=None):
- 
-         sage: from sage.tests.gap_packages import all_installed_packages
-         sage: all_installed_packages()
--        (...'GAPDoc'...)
-+        (...'gapdoc'...)
-         sage: all_installed_packages(ignore_dot_gap=True) == all_installed_packages(gap=gap, ignore_dot_gap=True)
-         True
-     """
--- 
-cgit v1.0-1-gd88e
-
-
-From cbc902a79ff9ec01d4d4eb9a767a1c661fb5dda7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:17:42 +0200
-Subject: Adapt test to new is_transitive and is_primitive behavior
-
----
- src/sage/groups/perm_gps/permgroup.py | 22 ++++++++++++++++------
- 1 file changed, 16 insertions(+), 6 deletions(-)
-
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 34ba0cc..5832b98 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -4359,17 +4359,23 @@ class PermutationGroup_generic(FiniteGroup):
- 
-         ::
- 
--            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
--            sage: G.is_transitive([1,4,5])
-+            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)],[(6,7)]])
-+            sage: G.is_transitive([1,2,3,4,5])
-             True
--            sage: G.is_transitive([2..6])
-+            sage: G.is_transitive([1..7])
-             False
-             sage: G.is_transitive(G.non_fixed_points())
--            True
-+            False
-             sage: H = PermutationGroup([[(1,2,3)],[(4,5,6)]])
-             sage: H.is_transitive(H.non_fixed_points())
-             False
- 
-+        If `G` does not act on the domain, it always returns ``False``::
-+
-+            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
-+            sage: G.is_transitive([1,4,5])
-+            False
-+
-         Note that this differs from the definition in GAP, where
-         ``IsTransitive`` returns whether the group is transitive on the
-         set of points moved by the group.
-@@ -4425,12 +4431,16 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
-             sage: G.is_primitive([1..4])
-             False
--            sage: G.is_primitive([1,2,3])
--            True
-             sage: G = PermutationGroup([[(3,4,5,6)],[(3,4)]]) #S_4 on [3..6]
-             sage: G.is_primitive(G.non_fixed_points())
-             True
- 
-+        If `G` does not act on the domain, it always returns ``False``::
-+
-+            sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
-+            sage: G.is_primitive([1,2,3])
-+            False
-+
-         """
-         #If the domain is not a subset of self.domain(), then the
-         #action isn't primitive.
--- 
-cgit v1.0-1-gd88e
-
-
-From 80dd6b338236f170efca1fc3545df18ce8d8795c Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:18:06 +0200
-Subject: Mark test as random. With gap 4.12 on x86_64 it is no longer 2
-
----
- src/sage/groups/perm_gps/permgroup.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 5832b98..c1230a3 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -1287,7 +1287,7 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: G.gens_small() # random
-             [('b','c'), ('a','c','b')] ## (on 64-bit Linux)
-             [('a','b'), ('a','c','b')] ## (on Solaris)
--            sage: len(G.gens_small()) == 2
-+            sage: len(G.gens_small()) == 2 # random
-             True
-         """
-         gens = self._libgap_().SmallGeneratingSet()
--- 
-cgit v1.0-1-gd88e
-
-
-From a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:18:30 +0200
-Subject: Remove test that is now redundant, all seeds give the same answer
-
----
- src/sage/groups/matrix_gps/finitely_generated.py | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py
-index a6d3dc0..63956ad 100644
---- a/src/sage/groups/matrix_gps/finitely_generated.py
-+++ b/src/sage/groups/matrix_gps/finitely_generated.py
-@@ -563,9 +563,6 @@ class FinitelyGeneratedMatrixGroup_gap(MatrixGroup_gap):
-             21499084800
-             sage: P = G.as_permutation_group()
-             sage: Psmaller = G.as_permutation_group(algorithm="smaller", seed=6)
--            sage: P == Psmaller  # see the note below
--            True
--            sage: Psmaller = G.as_permutation_group(algorithm="smaller")
-             sage: P == Psmaller
-             False
-             sage: P.cardinality()
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch b/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
deleted file mode 100644
index 8fedcb78cf71..000000000000
--- a/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-commit 04971318f032caf8dc1c0de9489346d894409091
-Author: John H. Palmieri <jhpalmieri64@gmail.com>
-Date:   Wed Aug 31 14:22:26 2022 -0700
-
-    trac 34465: fix invalid escape sequence in functions/special.py
-
-diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py
-index 02596e49620..901f02f9bee 100644
---- a/src/sage/functions/special.py
-+++ b/src/sage/functions/special.py
-@@ -849,7 +849,7 @@ class EllipticF(BuiltinFunction):
-     - :wikipedia:`Elliptic_integral#Incomplete_elliptic_integral_of_the_first_kind`
-     """
-     def __init__(self):
--        """
-+        r"""
-         EXAMPLES::
- 
-             sage: loads(dumps(elliptic_f))
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
deleted file mode 100644
index ccafad5070c4..000000000000
--- a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
+++ /dev/null
@@ -1,1750 +0,0 @@
-diff --git a/build/pkgs/giac/patches/pari_2_15.patch b/build/pkgs/giac/patches/pari_2_15.patch
-new file mode 100644
-index 0000000000..d2900a5ffc
---- /dev/null
-+++ b/build/pkgs/giac/patches/pari_2_15.patch
-@@ -0,0 +1,21 @@
-+ANYARG patch
-+
-+diff --git a/src/pari.cc b/src/pari.cc
-+index 76ce8e1..50d08ab 100644
-+--- a/src/pari.cc
-++++ b/src/pari.cc
-+@@ -40,6 +40,13 @@ using namespace std;
-+ 
-+ #ifdef HAVE_LIBPARI
-+ 
-++// Anyarg disappeared from PARI 2.15.0
-++#ifdef __cplusplus
-++#  define ANYARG ...
-++#else
-++#  define ANYARG
-++#endif
-++
-+ #ifdef HAVE_PTHREAD_H
-+ #include <pthread.h>
-+ #endif
-+
-diff --git a/build/pkgs/pari/checksums.ini b/build/pkgs/pari/checksums.ini
-index b736feed31..bafd0f36f4 100644
---- a/build/pkgs/pari/checksums.ini
-+++ b/build/pkgs/pari/checksums.ini
-@@ -1,5 +1,5 @@
- tarball=pari-VERSION.tar.gz
--sha1=e01647aab7e96a8cb4922cf26a4f224337c6647f
--md5=922f740fcdf8630b30d63dc76b58f756
--cksum=297133525
-+sha1=cba9b279f67d5efe2fbbccf3be6e9725f816cf07
-+md5=76d430f1bea1b07fa2ad9712deeaa736
-+cksum=1990743897
- upstream_url=https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-VERSION.tar.gz
-diff --git a/build/pkgs/pari/package-version.txt b/build/pkgs/pari/package-version.txt
-index a1a4224dd5..68e69e405e 100644
---- a/build/pkgs/pari/package-version.txt
-+++ b/build/pkgs/pari/package-version.txt
-@@ -1 +1 @@
--2.13.3
-+2.15.0
-diff --git a/src/doc/de/tutorial/tour_numtheory.rst b/src/doc/de/tutorial/tour_numtheory.rst
-index a012234c99..e3149fe949 100644
---- a/src/doc/de/tutorial/tour_numtheory.rst
-+++ b/src/doc/de/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ implementiert.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/en/tutorial/tour_numtheory.rst b/src/doc/en/tutorial/tour_numtheory.rst
-index 3064d100e2..075e0ac0ad 100644
---- a/src/doc/en/tutorial/tour_numtheory.rst
-+++ b/src/doc/en/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ NumberField class.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/es/tutorial/tour_numtheory.rst b/src/doc/es/tutorial/tour_numtheory.rst
-index a1f7d1a87b..48e5376cfe 100644
---- a/src/doc/es/tutorial/tour_numtheory.rst
-+++ b/src/doc/es/tutorial/tour_numtheory.rst
-@@ -140,7 +140,7 @@ Varios métodos relacionados están implementados en la clase ``NumberField``::
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/fr/tutorial/tour_numtheory.rst b/src/doc/fr/tutorial/tour_numtheory.rst
-index 871092f5fa..d1b2fee883 100644
---- a/src/doc/fr/tutorial/tour_numtheory.rst
-+++ b/src/doc/fr/tutorial/tour_numtheory.rst
-@@ -159,7 +159,7 @@ dans la classe NumberField.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/ja/tutorial/tour_numtheory.rst b/src/doc/ja/tutorial/tour_numtheory.rst
-index 47af68c862..4d4ed52d50 100644
---- a/src/doc/ja/tutorial/tour_numtheory.rst
-+++ b/src/doc/ja/tutorial/tour_numtheory.rst
-@@ -161,7 +161,7 @@ Sageには :math:`p` \-進数体も組込まれている.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/pt/tutorial/tour_numtheory.rst b/src/doc/pt/tutorial/tour_numtheory.rst
-index 6371b491ea..a3dc973a93 100644
---- a/src/doc/pt/tutorial/tour_numtheory.rst
-+++ b/src/doc/pt/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ NumberField.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus 
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/ru/tutorial/tour_numtheory.rst b/src/doc/ru/tutorial/tour_numtheory.rst
-index 652abfbc99..a985d49fbd 100644
---- a/src/doc/ru/tutorial/tour_numtheory.rst
-+++ b/src/doc/ru/tutorial/tour_numtheory.rst
-@@ -150,7 +150,7 @@ Sage содержит стандартные функции теории чис
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py
-index e57076646f..fec75d07c1 100644
---- a/src/sage/arith/misc.py
-+++ b/src/sage/arith/misc.py
-@@ -1465,13 +1465,13 @@ def divisors(n):
- 
-         sage: K.<a> = QuadraticField(7)
-         sage: divisors(K.ideal(7))
--        [Fractional ideal (1), Fractional ideal (-a), Fractional ideal (7)]
-+        [Fractional ideal (1), Fractional ideal (a), Fractional ideal (7)]
-         sage: divisors(K.ideal(3))
-         [Fractional ideal (1), Fractional ideal (3),
--        Fractional ideal (-a + 2), Fractional ideal (-a - 2)]
-+        Fractional ideal (a - 2), Fractional ideal (a + 2)]
-         sage: divisors(K.ideal(35))
--        [Fractional ideal (1), Fractional ideal (5), Fractional ideal (-a),
--        Fractional ideal (7), Fractional ideal (-5*a), Fractional ideal (35)]
-+        [Fractional ideal (1), Fractional ideal (5), Fractional ideal (a),
-+        Fractional ideal (7), Fractional ideal (5*a), Fractional ideal (35)]
- 
-     TESTS::
- 
-@@ -2569,7 +2569,7 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds):
- 
-         sage: K.<i> = QuadraticField(-1)
-         sage: factor(122 - 454*i)
--        (-3*i - 2) * (-i - 2)^3 * (i + 1)^3 * (i + 4)
-+        (-i) * (-i - 2)^3 * (i + 1)^3 * (-2*i + 3) * (i + 4)
- 
-     To access the data in a factorization::
- 
-diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-index cdfc11a9e5..b6e1280d6e 100644
---- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-+++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-@@ -7825,9 +7825,9 @@ class DynamicalSystem_projective_field(DynamicalSystem_projective,
-             sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, y^2, QQbar(sqrt(2))*z^2])
-             sage: f.reduce_base_field()
-             Dynamical System of Projective Space of dimension 2 over Number Field in a with
--            defining polynomial y^4 - 4*y^2 + 1 with a = 1.931851652578137?
-+            defining polynomial y^4 - 4*y^2 + 1 with a = -0.5176380902050415?
-               Defn: Defined on coordinates by sending (x : y : z) to
--                    (x^2 + (a^2 - 2)*y^2 : y^2 : (a^3 - 3*a)*z^2)
-+                    (x^2 + (-a^2 + 2)*y^2 : y^2 : (a^3 - 3*a)*z^2)
- 
-         ::
- 
-diff --git a/src/sage/ext_data/pari/simon/ellQ.gp b/src/sage/ext_data/pari/simon/ellQ.gp
-index 420af8f6a2..65e8386779 100644
---- a/src/sage/ext_data/pari/simon/ellQ.gp
-+++ b/src/sage/ext_data/pari/simon/ellQ.gp
-@@ -40,7 +40,7 @@
-   gp > \r ellcommon.gp
-   gp > \r ellQ.gp
- 
--  The main function is ellrank(), which takes as an argument
-+  The main function is ellQ_ellrank(), which takes as an argument
-   any elliptic curve in the form [a1,a2,a3,a4,a6]
-   the result is a vector [r,s,v], where
-     r is a lower bound for the rank,
-@@ -50,7 +50,7 @@
-   Example:
- 
-   gp > ell = [1,2,3,4,5];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
-   %1 = [1, 1, [[1,2]]
-   In this example, the rank is exactly 1, and [1,2] has infinite order.
- 
-@@ -92,7 +92,7 @@
-   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- 
-   Explications succintes :
--  La fonction ellrank() accepte toutes les courbes sous la forme
-+  La fonction ellQ_ellrank() accepte toutes les courbes sous la forme
-   [a1,a2,a3,a4,a6]
-   Les coefficients peuvent etre entiers ou non.
-   L'algorithme utilise est celui de la 2-descente.
-@@ -100,7 +100,7 @@
-   Il suffit de taper : 
- 
-   gp > ell = [a1,a2,a3,a4,a6];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
- 
-   Retourne un vecteur [r,s,v] ou
-     r est le rang probable (c'est toujours une minoration du rang),
-@@ -110,7 +110,7 @@
-   Exemple :
- 
-   gp > ell = [1,2,3,4,5];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
-   %1 = [1, 1, [[1,2]]
-   Ici, le rang est exactement 1, et le point [1,2] est d'ordre infini.
- 
-@@ -1571,12 +1571,12 @@ if( DEBUGLEVEL_ell >= 4, print("    end of ell2descent_gen"));
-     print("rank(E/Q)    >= ",m1)
-   );
- }
--{ellrank(ell,help=[]) =
-+{ellQ_ellrank(ell,help=[]) =
- \\ Algorithm of 2-descent on the elliptic curve ell.
- \\ help is a list of known points on ell.
- my(urst,urst1,den,eqell,tors2,bnf,rang,time1);
- 
--if( DEBUGLEVEL_ell >= 3, print("   starting ellrank"));
-+if( DEBUGLEVEL_ell >= 3, print("   starting ellQ_ellrank"));
-   if( #ell < 13, ell = ellinit(ell));
- 
- \\ kill the coefficients a1 and a3
-@@ -1630,7 +1630,7 @@ if( DEBUGLEVEL_ell >= 1, print(" Elliptic curve: Y^2 = ",eqell));
-   ));
- 
-   rang[3] = ellchangepoint(rang[3],ellinverturst(urst));
--if( DEBUGLEVEL_ell >= 3, print("   end of ellrank"));
-+if( DEBUGLEVEL_ell >= 3, print("   end of ellQ_ellrank"));
- 
-   return(rang);
- }
-@@ -2106,13 +2106,13 @@ if( DEBUGLEVEL_ell >= 3, print("   end of ell2descent_viaisog"));
- {
- \\                  functions for elliptic curves
-   addhelp(ell2descent_complete,
--    "ell2descent_complete(e1,e2,e3): Performs a complete 2-descent on the elliptic curve y^2 = (x-e1)*(x-e2)*(x-e3). See ?ellrank for the format of the output.");
-+    "ell2descent_complete(e1,e2,e3): Performs a complete 2-descent on the elliptic curve y^2 = (x-e1)*(x-e2)*(x-e3). See ?ellQ_ellrank for the format of the output.");
-   addhelp(ell2descent_gen,
--    "ell2descent_gen((E,bnf,k=1,help=[]): E is a vector of the form [0,A,0,B,C], (or the result of ellinit of such a vector) A,B,C integers such that x^3+A*x^2+B*x+C; bnf is the corresponding bnfinit(,1); Performs 2-descent on the elliptic curve Ek: k*y^2=x^3+A*x^2+B*x+C. See ?ellrank for the format of the output.");
-+    "ell2descent_gen((E,bnf,k=1,help=[]): E is a vector of the form [0,A,0,B,C], (or the result of ellinit of such a vector) A,B,C integers such that x^3+A*x^2+B*x+C; bnf is the corresponding bnfinit(,1); Performs 2-descent on the elliptic curve Ek: k*y^2=x^3+A*x^2+B*x+C. See ?ellQ_ellrank for the format of the output.");
-   addhelp(ell2descent_viaisog,
--    "ell2descent_viaisog(E,help=[]): E is an elliptic curve of the form [0,a,0,b,0], with a, b integers. Performs a 2-descent via isogeny on E. See ?ellrank for the format of the output.");
--  addhelp(ellrank,
--    "ellrank(E,help=[]): E is any elliptic curve defined over Q. Returns a vector [r,s,v], where r is a lower bound for the rank of E, s is the rank of its 2-Selmer group and v is a list of independant points in E(Q)/2E(Q). If help is a vector of nontrivial points on E, the result might be faster. This function might be used in conjunction with elltors2(E). See also ?default_ellQ");
-+    "ell2descent_viaisog(E,help=[]): E is an elliptic curve of the form [0,a,0,b,0], with a, b integers. Performs a 2-descent via isogeny on E. See ?ellQ_ellrank for the format of the output.");
-+  addhelp(ellQ_ellrank,
-+    "ellQ_ellrank(E,help=[]): E is any elliptic curve defined over Q. Returns a vector [r,s,v], where r is a lower bound for the rank of E, s is the rank of its 2-Selmer group and v is a list of independant points in E(Q)/2E(Q). If help is a vector of nontrivial points on E, the result might be faster. This function might be used in conjunction with elltors2(E). See also ?default_ellQ");
-   addhelp(ellhalf,
-     "ellhalf(E,P): returns the vector of all points Q on the elliptic curve E such that 2Q = P");
-   addhelp(ellredgen,
-@@ -2143,7 +2143,7 @@ if( DEBUGLEVEL_ell >= 3, print("   end of ell2descent_viaisog"));
- 
- \\                  others
-   addhelp(default_ellQ,
--    "default_ellQ(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, ELLREDGENFLAG, COMPLETE, MAXPROB, LIMBIGPRIME): set the value of the global variables used for ellrank() and other related functions. DEBUGLEVEL_ell: 0-5: choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; ELLREDGENFLAG: if != 0, try to reduce the generators at the end; COMPLETE: if != 0 and full 2-torsion, use complete 2-descent, otherwise via 2-isogeny; MAXPROB, LIMBIGPRIME: technical.");
-+    "default_ellQ(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, ELLREDGENFLAG, COMPLETE, MAXPROB, LIMBIGPRIME): set the value of the global variables used for ellQ_ellrank() and other related functions. DEBUGLEVEL_ell: 0-5: choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; ELLREDGENFLAG: if != 0, try to reduce the generators at the end; COMPLETE: if != 0 and full 2-torsion, use complete 2-descent, otherwise via 2-isogeny; MAXPROB, LIMBIGPRIME: technical.");
- /*  addhelp(DEBUGLEVEL_ell,
-     "DEBUGLEVEL_ell: Choose a higher value of this global variable to have more details of the computations printed during the 2-descent algorithm. 0 = don't print anything; 1 = (default) just print the result; 2 = print more details including the Selmer group and the nontrivial quartics.");
- */
-diff --git a/src/sage/ext_data/pari/simon/qfsolve.gp b/src/sage/ext_data/pari/simon/qfsolve.gp
-index 501fb50828..2107288c1d 100644
---- a/src/sage/ext_data/pari/simon/qfsolve.gp
-+++ b/src/sage/ext_data/pari/simon/qfsolve.gp
-@@ -434,146 +434,6 @@ my(cc);
- return([U3~*G3*U3,red[2]*U1*U2*U3]);
- }
- 
--\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
--\\        QUADRATIC FORMS MINIMIZATION         \\
--\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
--
--\\ Minimization of the quadratic form G, with nonzero determinant.
--\\ of dimension n>=2.
--\\ G must by symmetric and have integral coefficients.
--\\ Returns [G',U,factd] with U in GLn(Q) such that G'=U~*G*U*constant
--\\ is integral and has minimal determinant.
--\\ In dimension 3 or 4, may return a prime p
--\\ if the reduction at p is impossible because of the local non solvability.
--\\ If given, factdetG must be equal to factor(abs(det(G))).
--{qfminimize(G,factdetG) =
--my(factd,U,Ker,Ker2,sol,aux,di);
--my(p);
--my(n,lf,i,vp,dimKer,dimKer2,m);
--
--  n = length(G);
--  factd = matrix(0,2);
--  if( !factdetG, factdetG = factor(matdet(G)));
--
--  lf = length(factdetG[,1]);
--  i = 1; U = matid(n);
--
--  while(i <= lf,
--    vp = factdetG[i,2];
--    if( vp == 0, i++; next);
--    p = factdetG[i,1];
--    if( p == -1, i++; next);
--if( DEBUGLEVEL_qfsolve >= 4, print("    p = ",p,"^",vp));
--
--\\ The case vp = 1 can be minimized only if n is odd.
--    if( vp == 1 && n%2 == 0,
--      factd = concat(factd~, Mat([p,1])~)~;
--      i++; next
--    );
--    Ker = kermodp(G,p); dimKer = Ker[1]; Ker = Ker[2];
--
--\\ Rem: we must have dimKer <= vp
--if( DEBUGLEVEL_qfsolve >= 4, print("    dimKer = ",dimKer));
--\\ trivial case: dimKer = n
--    if( dimKer == n, 
--if( DEBUGLEVEL_qfsolve >= 4, print("     case 0: dimKer = n"));
--      G /= p;
--      factdetG[i,2] -= n;
--      next
--    );
--    G = Ker~*G*Ker;
--    U = U*Ker;
--
--\\ 1st case: dimKer < vp
--\\ then the kernel mod p contains a kernel mod p^2
--    if( dimKer < vp,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 1: dimker < vp"));
--      if( dimKer == 1,
--\\        G[,1] /= p; G[1,] /= p;
--        G[,1] /= p; G[1,] = G[1,]/p;
--        U[,1] /= p;
--        factdetG[i,2] -= 2
--      , 
--        Ker2 = kermodp(matrix(dimKer,dimKer,j,k,G[j,k]/p),p);
--        dimKer2 = Ker2[1]; Ker2 = Ker2[2];
--        for( j = 1, dimKer2, Ker2[,j] /= p);
--        Ker2 = matdiagonalblock([Ker2,matid(n-dimKer)]);
--        G = Ker2~*G*Ker2;
--        U = U*Ker2;
--        factdetG[i,2] -= 2*dimKer2
--);
--
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 1"));
--      next
--    );
--
--\\ Now, we have vp = dimKer 
--\\ 2nd case: the dimension of the kernel is >=2
--\\ and contains an element of norm 0 mod p^2
--
--\\ search for an element of norm p^2... in the kernel
--    if( dimKer > 2 || 
--       (dimKer == 2 && issquare( di = Mod((G[1,2]^2-G[1,1]*G[2,2])/p^2,p))),
--      if( dimKer > 2,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 2.1"));
--        dimKer = 3;
--        sol = qfsolvemodp(matrix(3,3,j,k,G[j,k]/p),p)
--      ,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 2.2"));
--        if( G[1,1]%p^2 == 0, 
--          sol = [1,0]~
--        , sol = [-G[1,2]/p+sqrt(di),Mod(G[1,1]/p,p)]~
--        )
--      );
--      sol = centerlift(sol);
--      sol /= content(sol);
--if( DEBUGLEVEL_qfsolve >= 4, print("    sol = ",sol));
--      Ker = vectorv(n, j, if( j<= dimKer, sol[j], 0)); \\ fill with 0's
--      Ker = completebasis(Ker,1);
--      Ker[,n] /= p;
--      G = Ker~*G*Ker;
--      U = U*Ker;
--      factdetG[i,2] -= 2;
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 2"));
--      next
--    );
--
--\\ Now, we have vp = dimKer <= 2 
--\\   and the kernel contains no vector with norm p^2...
--
--\\ In some cases, exchanging the kernel and the image
--\\ makes the minimization easy.
--
--    m = (n-1)\2-1;
--    if( ( vp == 1 && issquare(Mod(-(-1)^m*matdet(G)/G[1,1],p)))
--     || ( vp == 2 && n%2 == 1 && n >= 5)
--     || ( vp == 2 && n%2 == 0 && !issquare(Mod((-1)^m*matdet(G)/p^2,p)))
--    , 
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 3"));
--      Ker = matid(n);
--      for( j = dimKer+1, n, Ker[j,j] = p);
--      G = Ker~*G*Ker/p;
--      U = U*Ker;
--      factdetG[i,2] -= 2*dimKer-n;
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 3"));
--      next
--    );
--
--\\ Minimization was not possible se far.
--\\ If n == 3 or 4, this proves the local non-solubility at p.
--    if( n == 3 || n == 4, 
--if( DEBUGLEVEL_qfsolve >= 1, print(" no local solution at ",p));
--      return(p));
--
--if( DEBUGLEVEL_qfsolve >= 4, print("    prime ",p," finished"));
--    factd = concat(factd~,Mat([p,vp])~)~;
--    i++
--  );
--\\ apply LLL to avoid coefficients explosion
--  aux = qflll(U/content(U));
--return([aux~*G*aux,U*aux,factd]);
--}
--
- \\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- \\          CLASS GROUP COMPUTATIONS           \\
- \\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-diff --git a/src/sage/geometry/polyhedron/backend_field.py b/src/sage/geometry/polyhedron/backend_field.py
-index 6b921d23a6..2f32c58b1e 100644
---- a/src/sage/geometry/polyhedron/backend_field.py
-+++ b/src/sage/geometry/polyhedron/backend_field.py
-@@ -265,7 +265,7 @@ class Polyhedron_field(Polyhedron_base):
-              An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0,
-              An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0)
-             sage: p.Vrepresentation()                                           # optional - sage.rings.number_field
--            (A vertex at (0.?e-15, 0.707106781186548?),
-+            (A vertex at (0.?e-16, 0.7071067811865475?),
-              A vertex at (1.414213562373095?, 0),
-              A vertex at (4.000000000000000?, 0.372677996249965?))
-         """
-@@ -308,7 +308,7 @@ class Polyhedron_field(Polyhedron_base):
-              An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0,
-              An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0)
-             sage: p.Vrepresentation()                                           # optional - sage.rings.number_field
--            (A vertex at (0.?e-15, 0.707106781186548?),
-+            (A vertex at (0.?e-16, 0.7071067811865475?),
-              A vertex at (1.414213562373095?, 0),
-              A vertex at (4.000000000000000?, 0.372677996249965?))
-         """
-diff --git a/src/sage/geometry/polyhedron/backend_normaliz.py b/src/sage/geometry/polyhedron/backend_normaliz.py
-index 86b89632a5..ca8a43b248 100644
---- a/src/sage/geometry/polyhedron/backend_normaliz.py
-+++ b/src/sage/geometry/polyhedron/backend_normaliz.py
-@@ -53,7 +53,7 @@ def _number_field_elements_from_algebraics_list_of_lists_of_lists(listss, **kwds
-         1.732050807568878?
-         sage: from sage.geometry.polyhedron.backend_normaliz import _number_field_elements_from_algebraics_list_of_lists_of_lists
-         sage: K, results, hom = _number_field_elements_from_algebraics_list_of_lists_of_lists([[[rt2], [1]], [[rt3]], [[1], []]]); results  # optional - sage.rings.number_field
--        [[[-a^3 + 3*a], [1]], [[-a^2 + 2]], [[1], []]]
-+        [[[-a^3 + 3*a], [1]], [[a^2 - 2]], [[1], []]]
-     """
-     from sage.rings.qqbar import number_field_elements_from_algebraics
-     numbers = []
-diff --git a/src/sage/groups/matrix_gps/isometries.py b/src/sage/groups/matrix_gps/isometries.py
-index f9111a2c92..cca45e7175 100644
---- a/src/sage/groups/matrix_gps/isometries.py
-+++ b/src/sage/groups/matrix_gps/isometries.py
-@@ -11,11 +11,11 @@ EXAMPLES::
-     sage: L = IntegralLattice("D4")
-     sage: O = L.orthogonal_group()
-     sage: O
--    Group of isometries with 5 generators (
--    [-1  0  0  0]  [0 0 0 1]  [-1 -1 -1 -1]  [ 1  1  0  0]  [ 1  0  0  0]
--    [ 0 -1  0  0]  [0 1 0 0]  [ 0  0  1  0]  [ 0  0  1  0]  [-1 -1 -1 -1]
--    [ 0  0 -1  0]  [0 0 1 0]  [ 0  1  0  1]  [ 0  1  0  1]  [ 0  0  1  0]
--    [ 0  0  0 -1], [1 0 0 0], [ 0 -1 -1  0], [ 0 -1 -1  0], [ 0  0  0  1]
-+    Group of isometries with 3 generators (
-+    [0 0 0 1]  [ 1  1  0  0]  [ 1  0  0  0]
-+    [0 1 0 0]  [ 0  0  1  0]  [-1 -1 -1 -1]
-+    [0 0 1 0]  [ 0  1  0  1]  [ 0  0  1  0]
-+    [1 0 0 0], [ 0 -1 -1  0], [ 0  0  0  1]
-     )
- 
- Basic functionality is provided by GAP::
-diff --git a/src/sage/interfaces/genus2reduction.py b/src/sage/interfaces/genus2reduction.py
-index 56ae04b235..7a4794daf2 100644
---- a/src/sage/interfaces/genus2reduction.py
-+++ b/src/sage/interfaces/genus2reduction.py
-@@ -143,31 +143,31 @@ class ReductionData(SageObject):
-        sur un corps de valuation discrète", Trans. AMS 348 (1996),
-        4577-4610, Section 7.2, Proposition 4).
-     """
--    def __init__(self, pari_result, P, Q, minimal_equation, minimal_disc,
--                 local_data, conductor, prime_to_2_conductor_only):
-+    def __init__(self, pari_result, P, Q, Pmin, Qmin, minimal_disc,
-+                 local_data, conductor):
-         self.pari_result = pari_result
-         self.P = P
-         self.Q = Q
--        self.minimal_equation = minimal_equation
-+        self.Pmin = Pmin
-+        self.Qmin = Qmin
-         self.minimal_disc = minimal_disc
-         self.local_data = local_data
-         self.conductor = conductor
--        self.prime_to_2_conductor_only = prime_to_2_conductor_only
- 
-     def _repr_(self):
--        if self.prime_to_2_conductor_only:
--            ex = ' (away from 2)'
--        else:
--            ex = ''
-         if self.Q == 0:
-             yterm = ''
-         else:
-             yterm = '+ (%s)*y '%self.Q
-+
-         s = 'Reduction data about this proper smooth genus 2 curve:\n'
-         s += '\ty^2 %s= %s\n'%(yterm, self.P)
--        s += 'A Minimal Equation (away from 2):\n\ty^2 = %s\n'%self.minimal_equation
--        s += 'Minimal Discriminant (away from 2):  %s\n'%self.minimal_disc
--        s += 'Conductor%s: %s\n'%(ex, self.conductor)
-+        if self.Qmin:
-+            s += 'A Minimal Equation:\n\ty^2 + (%s)y = %s\n'%(self.Qmin, self.Pmin)
-+        else:
-+            s += 'A Minimal Equation:\n\ty^2 = %s\n'%self.Pmin
-+        s += 'Minimal Discriminant: %s\n'%self.minimal_disc
-+        s += 'Conductor: %s\n'%self.conductor
-         s += 'Local Data:\n%s'%self._local_data_str()
-         return s
- 
-@@ -242,17 +242,7 @@ class Genus2reduction(SageObject):
-         sage: factor(R.conductor)
-         5^4 * 2267
- 
--    This means that only the odd part of the conductor is known.
--
--    ::
--
--        sage: R.prime_to_2_conductor_only
--        True
--
--    The discriminant is always minimal away from 2, but possibly not at
--    2.
--
--    ::
-+    The discriminant is always minimal::
- 
-         sage: factor(R.minimal_disc)
-         2^3 * 5^5 * 2267
-@@ -264,10 +254,10 @@ class Genus2reduction(SageObject):
-         sage: R
-         Reduction data about this proper smooth genus 2 curve:
-             y^2 + (x^3 - 2*x^2 - 2*x + 1)*y = -5*x^5
--        A Minimal Equation (away from 2):
--            y^2 = x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855
--        Minimal Discriminant (away from 2):  56675000
--        Conductor (away from 2): 1416875
-+        A Minimal Equation:
-+            y^2 ...
-+        Minimal Discriminant: 56675000
-+        Conductor: 1416875
-         Local Data:
-             p=2
-             (potential) stable reduction:  (II), j=1
-@@ -293,10 +283,10 @@ class Genus2reduction(SageObject):
-         sage: genus2reduction(0, x^6 + 3*x^3 + 63)
-         Reduction data about this proper smooth genus 2 curve:
-                 y^2 = x^6 + 3*x^3 + 63
--        A Minimal Equation (away from 2):
--                y^2 = x^6 + 3*x^3 + 63
--        Minimal Discriminant (away from 2):  10628388316852992
--        Conductor (away from 2): 2893401
-+        A Minimal Equation:
-+                y^2 ...
-+        Minimal Discriminant: -10628388316852992
-+        Conductor: 2893401
-         Local Data:
-                 p=2
-                 (potential) stable reduction:  (V), j1+j2=0, j1*j2=0
-@@ -327,9 +317,9 @@ class Genus2reduction(SageObject):
-         sage: genus2reduction(x^3-x^2-1, x^2 - x)
-         Reduction data about this proper smooth genus 2 curve:
-                 y^2 + (x^3 - x^2 - 1)*y = x^2 - x
--        A Minimal Equation (away from 2):
--                y^2 = x^6 + 58*x^5 + 1401*x^4 + 18038*x^3 + 130546*x^2 + 503516*x + 808561
--        Minimal Discriminant (away from 2):  169
-+        A Minimal Equation:
-+                y^2 ...
-+        Minimal Discriminant: -169
-         Conductor: 169
-         Local Data:
-                 p=13
-@@ -370,10 +360,10 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^3 - 2*x^2 - 2*x + 1, -5*x^5)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^3 - 2*x^2 - 2*x + 1)*y = -5*x^5
--            A Minimal Equation (away from 2):
--                    y^2 = x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855
--            Minimal Discriminant (away from 2):  56675000
--            Conductor (away from 2): 1416875
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 56675000
-+            Conductor: 1416875
-             Local Data:
-                     p=2
-                     (potential) stable reduction:  (II), j=1
-@@ -389,9 +379,9 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^2 + 1, -5*x^5)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^2 + 1)*y = -5*x^5
--            A Minimal Equation (away from 2):
--                    y^2 = -20*x^5 + x^4 + 2*x^2 + 1
--            Minimal Discriminant (away from 2):  48838125
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 48838125
-             Conductor: 32025
-             Local Data:
-                     p=3
-@@ -412,9 +402,9 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^3 + x^2 + x,-2*x^5 + 3*x^4 - x^3 - x^2 - 6*x - 2)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^3 + x^2 + x)*y = -2*x^5 + 3*x^4 - x^3 - x^2 - 6*x - 2
--            A Minimal Equation (away from 2):
--                    y^2 = x^6 + 18*x^3 + 36*x^2 - 27
--            Minimal Discriminant (away from 2):  1520984142
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 1520984142
-             Conductor: 954
-             Local Data:
-                     p=2
-@@ -436,18 +426,10 @@ class Genus2reduction(SageObject):
-             raise ValueError("Q (=%s) must have degree at most 3" % Q)
- 
-         res = pari.genus2red([P, Q])
--
-         conductor = ZZ(res[0])
--        minimal_equation = R(res[2])
--
--        minimal_disc = QQ(res[2].poldisc()).abs()
--        if minimal_equation.degree() == 5:
--            minimal_disc *= minimal_equation[5]**2
--        # Multiply with suitable power of 2 of the form 2^(2*(d-1) - 12)
--        b = 2 * (minimal_equation.degree() - 1)
--        k = QQ((12 - minimal_disc.valuation(2), b)).ceil()
--        minimal_disc >>= 12 - b*k
--        minimal_disc = ZZ(minimal_disc)
-+        Pmin = R(res[2][0])
-+        Qmin = R(res[2][1])
-+        minimal_disc = ZZ(pari.hyperelldisc(res[2]))
- 
-         local_data = {}
-         for red in res[3]:
-@@ -468,9 +450,7 @@ class Genus2reduction(SageObject):
- 
-             local_data[p] = data
- 
--        prime_to_2_conductor_only = (-1 in res[1].component(2))
--        return ReductionData(res, P, Q, minimal_equation, minimal_disc, local_data,
--                             conductor, prime_to_2_conductor_only)
-+        return ReductionData(res, P, Q, Pmin, Qmin, minimal_disc, local_data, conductor)
- 
-     def __reduce__(self):
-         return _reduce_load_genus2reduction, tuple([])
-diff --git a/src/sage/lfunctions/dokchitser.py b/src/sage/lfunctions/dokchitser.py
-index fec450d7bc..236402c293 100644
---- a/src/sage/lfunctions/dokchitser.py
-+++ b/src/sage/lfunctions/dokchitser.py
-@@ -337,6 +337,7 @@ class Dokchitser(SageObject):
-             # After init_coeffs is called, future calls to this method should
-             # return the full output for further parsing
-             raise RuntimeError("unable to create L-series, due to precision or other limits in PARI")
-+        t = t.replace("  *** _^_: Warning: normalizing a series with 0 leading term.\n", "")
-         return t
- 
-     def __check_init(self):
-diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
-index d2b20f1891..6c31efe239 100644
---- a/src/sage/lfunctions/pari.py
-+++ b/src/sage/lfunctions/pari.py
-@@ -339,7 +339,7 @@ def lfun_eta_quotient(scalings, exponents):
-         0.0374412812685155
- 
-         sage: lfun_eta_quotient([6],[4])
--        [[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4])]], 0, [0, 1], 2, 36, 1]
-+        [[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4]), 0]], 0, [0, 1], 2, 36, 1]
- 
-         sage: lfun_eta_quotient([2,1,4], [5,-2,-2])
-         Traceback (most recent call last):
-diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py
-index e5a2aa2517..0efcb15de0 100644
---- a/src/sage/libs/pari/tests.py
-+++ b/src/sage/libs/pari/tests.py
-@@ -356,7 +356,7 @@ Constructors::
-     [2, 4]~*x + [1, 3]~
- 
-     sage: pari(3).Qfb(7, 1)
--    Qfb(3, 7, 1, 0.E-19)
-+    Qfb(3, 7, 1)
-     sage: pari(3).Qfb(7, 2)
-     Traceback (most recent call last):
-     ...
-@@ -512,7 +512,7 @@ Basic functions::
-     sage: pari('sqrt(-2)').frac()
-     Traceback (most recent call last):
-     ...
--    PariError: incorrect type in gfloor (t_COMPLEX)
-+    PariError: incorrect type in gfrac (t_COMPLEX)
- 
-     sage: pari('1+2*I').imag()
-     2
-diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py
-index 25d93cac92..157ebabe29 100644
---- a/src/sage/modular/cusps_nf.py
-+++ b/src/sage/modular/cusps_nf.py
-@@ -1220,7 +1220,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/modform_hecketriangle/hecke_triangle_group_element.py b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-index a881336596..090d1bfaf0 100644
---- a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-+++ b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-@@ -43,7 +43,7 @@ def coerce_AA(p):
-         sage: AA(p)._exact_field()
-         Number Field in a with defining polynomial y^8 ... with a in ...
-         sage: coerce_AA(p)._exact_field()
--        Number Field in a with defining polynomial y^4 - 1910*y^2 - 3924*y + 681058 with a in 39.710518724...?
-+        Number Field in a with defining polynomial y^4 - 1910*y^2 - 3924*y + 681058 with a in ...?
-     """
-     el = AA(p)
-     el.simplify()
-diff --git a/src/sage/modular/modsym/p1list_nf.py b/src/sage/modular/modsym/p1list_nf.py
-index 222caacca8..f9d969732c 100644
---- a/src/sage/modular/modsym/p1list_nf.py
-+++ b/src/sage/modular/modsym/p1list_nf.py
-@@ -58,7 +58,7 @@ Lift an MSymbol to a matrix in `SL(2, R)`:
- 
-     sage: alpha = MSymbol(N, a + 2, 3*a^2)
-     sage: alpha.lift_to_sl2_Ok()
--    [-3*a^2 + a + 12, 25*a^2 - 50*a + 100, a + 2, a^2 - 3*a + 3]
-+    [-1, 4*a^2 - 13*a + 23, a + 2, 5*a^2 + 3*a - 3]
-     sage: Ok = k.ring_of_integers()
-     sage: M = Matrix(Ok, 2, alpha.lift_to_sl2_Ok())
-     sage: det(M)
-@@ -945,11 +945,11 @@ class P1NFList(SageObject):
-             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])
--            1
-+            5
- 
-         ::
- 
-diff --git a/src/sage/modules/free_quadratic_module_integer_symmetric.py b/src/sage/modules/free_quadratic_module_integer_symmetric.py
-index a206f0c721..aeb19ab669 100644
---- a/src/sage/modules/free_quadratic_module_integer_symmetric.py
-+++ b/src/sage/modules/free_quadratic_module_integer_symmetric.py
-@@ -1168,11 +1168,11 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
-             sage: A4 = IntegralLattice("A4")
-             sage: Aut = A4.orthogonal_group()
-             sage: Aut
--            Group of isometries with 5 generators (
--            [-1  0  0  0]  [0 0 0 1]  [-1 -1 -1  0]  [ 1  0  0  0]  [ 1  0  0  0]
--            [ 0 -1  0  0]  [0 0 1 0]  [ 0  0  0 -1]  [-1 -1 -1 -1]  [ 0  1  0  0]
--            [ 0  0 -1  0]  [0 1 0 0]  [ 0  0  1  1]  [ 0  0  0  1]  [ 0  0  1  1]
--            [ 0  0  0 -1], [1 0 0 0], [ 0  1  0  0], [ 0  0  1  0], [ 0  0  0 -1]
-+            Group of isometries with 4 generators (
-+            [0 0 0 1]  [-1 -1 -1  0]  [ 1  0  0  0]  [ 1  0  0  0]
-+            [0 0 1 0]  [ 0  0  0 -1]  [-1 -1 -1 -1]  [ 0  1  0  0]
-+            [0 1 0 0]  [ 0  0  1  1]  [ 0  0  0  1]  [ 0  0  1  1]
-+            [1 0 0 0], [ 0  1  0  0], [ 0  0  1  0], [ 0  0  0 -1]
-             )
- 
-         The group acts from the right on the lattice and its discriminant group::
-@@ -1180,19 +1180,19 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
-             sage: x = A4.an_element()
-             sage: g = Aut.an_element()
-             sage: g
--            [ 1  1  1  0]
--            [ 0  0 -1  0]
--            [ 0  0  1  1]
--            [ 0 -1 -1 -1]
-+            [-1 -1 -1  0]
-+            [ 0  0  1  0]
-+            [ 0  0 -1 -1]
-+            [ 0  1  1  1]
-             sage: x*g
--            (1, 1, 1, 0)
-+            (-1, -1, -1, 0)
-             sage: (x*g).parent()==A4
-             True
-             sage: (g*x).parent()
-             Vector space of dimension 4 over Rational Field
-             sage: y = A4.discriminant_group().an_element()
-             sage: y*g
--            (1)
-+            (4)
- 
-         If the group is finite we can compute the usual things::
- 
-@@ -1208,10 +1208,10 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
- 
-             sage: A2 = IntegralLattice(matrix.identity(3),Matrix(ZZ,2,3,[1,-1,0,0,1,-1]))
-             sage: A2.orthogonal_group()
--            Group of isometries with 3 generators (
--            [-1/3  2/3  2/3]  [ 2/3  2/3 -1/3]  [1 0 0]
--            [ 2/3 -1/3  2/3]  [ 2/3 -1/3  2/3]  [0 0 1]
--            [ 2/3  2/3 -1/3], [-1/3  2/3  2/3], [0 1 0]
-+            Group of isometries with 2 generators (
-+            [ 2/3  2/3 -1/3]  [1 0 0]
-+            [ 2/3 -1/3  2/3]  [0 0 1]
-+            [-1/3  2/3  2/3], [0 1 0]
-             )
- 
-         It can be negative definite as well::
-diff --git a/src/sage/quadratic_forms/binary_qf.py b/src/sage/quadratic_forms/binary_qf.py
-index cfa3ada73e..5ac823bc6c 100755
---- a/src/sage/quadratic_forms/binary_qf.py
-+++ b/src/sage/quadratic_forms/binary_qf.py
-@@ -141,7 +141,7 @@ class BinaryQF(SageObject):
-                   and a.degree() == 2 and a.parent().ngens() == 2):
-                 x, y = a.parent().gens()
-                 a, b, c = [a.monomial_coefficient(mon) for mon in [x**2, x*y, y**2]]
--            elif isinstance(a, pari_gen) and a.type() in ('t_QFI', 't_QFR'):
-+            elif isinstance(a, pari_gen) and a.type() in ('t_QFI', 't_QFR', 't_QFB'):
-                 # a has 3 or 4 components
-                 a, b, c = a[0], a[1], a[2]
-         try:
-diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py
-index 8290b6c4fa..0fc43f33c6 100644
---- a/src/sage/quadratic_forms/genera/genus.py
-+++ b/src/sage/quadratic_forms/genera/genus.py
-@@ -3088,8 +3088,8 @@ class GenusSymbol_global_ring():
-             sage: G = Genus(matrix(ZZ, 3, [6,3,0, 3,6,0, 0,0,2]))
-             sage: G.representatives()
-             (
--            [2 0 0]  [ 2 -1  0]
--            [0 6 3]  [-1  2  0]
-+            [2 0 0]  [ 2  1  0]
-+            [0 6 3]  [ 1  2  0]
-             [0 3 6], [ 0  0 18]
-             )
- 
-diff --git a/src/sage/quadratic_forms/qfsolve.py b/src/sage/quadratic_forms/qfsolve.py
-index ddde95e04f..d5e15d9f83 100644
---- a/src/sage/quadratic_forms/qfsolve.py
-+++ b/src/sage/quadratic_forms/qfsolve.py
-@@ -70,7 +70,7 @@ def qfsolve(G):
- 
-         sage: M = Matrix(QQ, [[3, 0, 0, 0], [0, 5, 0, 0], [0, 0, -7, 0], [0, 0, 0, -11]])
-         sage: qfsolve(M)
--        (3, -4, -3, -2)
-+        (3, 4, -3, -2)
-     """
-     ret = G.__pari__().qfsolve()
-     if ret.type() == 't_COL':
-diff --git a/src/sage/quadratic_forms/quadratic_form__automorphisms.py b/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-index c36c667e3b..3d72cf3be1 100644
---- a/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-+++ b/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-@@ -300,9 +300,9 @@ def automorphism_group(self):
-         sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
-         sage: Q.automorphism_group()
-         Matrix group over Rational Field with 3 generators (
--        [-1  0  0]  [0 0 1]  [ 0  0  1]
--        [ 0 -1  0]  [0 1 0]  [-1  0  0]
--        [ 0  0 -1], [1 0 0], [ 0  1  0]
-+        [ 0  0  1]  [1 0 0]  [ 1  0  0]
-+        [-1  0  0]  [0 0 1]  [ 0 -1  0]
-+        [ 0  1  0], [0 1 0], [ 0  0  1]
-         )
- 
-     ::
-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 9129ecb56a..d5a4cb8f22 100644
---- a/src/sage/rings/finite_rings/finite_field_prime_modn.py
-+++ b/src/sage/rings/finite_rings/finite_field_prime_modn.py
-@@ -111,7 +111,7 @@ class FiniteField_prime_modn(FiniteField_generic, integer_mod_ring.IntegerModRin
-             sage: RF13 = K.residue_field(pp)
-             sage: RF13.hom([GF(13)(1)])
-             Ring morphism:
--             From: Residue field of Fractional ideal (w + 18)
-+             From: Residue field of Fractional ideal (-w - 18)
-              To:   Finite Field of size 13
-              Defn: 1 |--> 1
- 
-diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx
-index 7596f2a302..1e1869f1b1 100644
---- a/src/sage/rings/finite_rings/residue_field.pyx
-+++ b/src/sage/rings/finite_rings/residue_field.pyx
-@@ -20,13 +20,13 @@ monogenic (i.e., 2 is an essential discriminant divisor)::
- 
-     sage: K.<a> = 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)
-+    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)
-     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`::
- 
-@@ -258,9 +258,9 @@ class ResidueFieldFactory(UniqueFactory):
-     the index of ``ZZ[a]`` in the maximal order for all ``a``::
- 
-         sage: K.<a> = NumberField(x^3 + x^2 - 2*x + 8); P = K.ideal(2).factor()[0][0]; P
--        Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F = K.residue_field(P); F
--        Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F(a)
-         0
-         sage: B = K.maximal_order().basis(); B
-@@ -270,7 +270,7 @@ class ResidueFieldFactory(UniqueFactory):
-         sage: F(B[2])
-         0
-         sage: F
--        Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F.degree()
-         1
- 
-@@ -730,15 +730,15 @@ class ResidueField_generic(Field):
-         EXAMPLES::
- 
-             sage: I = QQ[3^(1/3)].factor(5)[1][0]; I
--            Fractional ideal (-a + 2)
-+            Fractional ideal (a - 2)
-             sage: k = I.residue_field(); k
--            Residue field of Fractional ideal (-a + 2)
-+            Residue field of Fractional ideal (a - 2)
-             sage: f = k.lift_map(); f
-             Lifting map:
--              From: Residue field of Fractional ideal (-a + 2)
-+              From: Residue field of Fractional ideal (a - 2)
-               To:   Maximal Order in Number Field in a with defining polynomial x^3 - 3 with a = 1.442249570307409?
-             sage: f.domain()
--            Residue field of Fractional ideal (-a + 2)
-+            Residue field of Fractional ideal (a - 2)
-             sage: f.codomain()
-             Maximal Order in Number Field in a with defining polynomial x^3 - 3 with a = 1.442249570307409?
-             sage: f(k.0)
-@@ -768,7 +768,7 @@ class ResidueField_generic(Field):
- 
-             sage: K.<a> = NumberField(x^3-11)
-             sage: F = K.ideal(37).factor(); F
--            (Fractional ideal (37, a + 9)) * (Fractional ideal (37, a + 12)) * (Fractional ideal (2*a - 5))
-+            (Fractional ideal (37, a + 9)) * (Fractional ideal (37, a + 12)) * (Fractional ideal (-2*a + 5))
-             sage: k = K.residue_field(F[0][0])
-             sage: l = K.residue_field(F[1][0])
-             sage: k == l
-@@ -846,7 +846,7 @@ cdef class ReductionMap(Map):
-             sage: F.reduction_map()
-             Partially defined reduction map:
-               From: Number Field in a with defining polynomial x^3 + x^2 - 2*x + 8
--              To:   Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+              To:   Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
- 
-             sage: K.<theta_5> = CyclotomicField(5)
-             sage: F = K.factor(7)[0][0].residue_field()
-diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py
-index e99dff850f..759cbfb334 100644
---- a/src/sage/rings/number_field/S_unit_solver.py
-+++ b/src/sage/rings/number_field/S_unit_solver.py
-@@ -1781,20 +1781,20 @@ def sieve_ordering(SUK, q):
-         sage: SUK = K.S_unit_group(S=3)
-         sage: sieve_data = list(sieve_ordering(SUK, 19))
-         sage: sieve_data[0]
--        (Fractional ideal (xi - 3),
--         Fractional ideal (-2*xi^2 + 3),
-+        (Fractional ideal (-2*xi^2 + 3),
-+         Fractional ideal (-xi + 3),
-          Fractional ideal (2*xi + 1))
- 
-         sage: sieve_data[1]
--        (Residue field of Fractional ideal (xi - 3),
--         Residue field of Fractional ideal (-2*xi^2 + 3),
-+        (Residue field of Fractional ideal (-2*xi^2 + 3),
-+         Residue field of Fractional ideal (-xi + 3),
-          Residue field of Fractional ideal (2*xi + 1))
- 
-         sage: sieve_data[2]
--        ([18, 7, 16, 4], [18, 9, 12, 8], [18, 3, 10, 10])
-+        ([18, 12, 16, 8], [18, 16, 10, 4], [18, 10, 12, 10])
- 
-         sage: sieve_data[3]
--        (486, 648, 11664)
-+        (648, 2916, 3888)
-     """
- 
-     K = SUK.number_field()
-diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py
-index beb047ae02..b7c8c33d0b 100644
---- a/src/sage/rings/number_field/bdd_height.py
-+++ b/src/sage/rings/number_field/bdd_height.py
-@@ -248,7 +248,7 @@ def bdd_norm_pr_ideal_gens(K, norm_list):
-         sage: from sage.rings.number_field.bdd_height import bdd_norm_pr_ideal_gens
-         sage: K.<g> = QuadraticField(123)
-         sage: bdd_norm_pr_ideal_gens(K, range(5))
--        {0: [0], 1: [1], 2: [-g - 11], 3: [], 4: [2]}
-+        {0: [0], 1: [1], 2: [g + 11], 3: [], 4: [2]}
- 
-     ::
- 
-diff --git a/src/sage/rings/number_field/class_group.py b/src/sage/rings/number_field/class_group.py
-index 018ff5f5c6..73c0462cd1 100644
---- a/src/sage/rings/number_field/class_group.py
-+++ b/src/sage/rings/number_field/class_group.py
-@@ -221,11 +221,11 @@ class FractionalIdealClass(AbelianGroupWithValuesElement):
-             Class group of order 76 with structure C38 x C2
-             of Number Field in a with defining polynomial x^2 + 20072
-             sage: I = (G.0)^11; I
--            Fractional ideal class (41, 1/2*a + 5)
-+            Fractional ideal class (33, 1/2*a + 8)
-             sage: J = G(I.ideal()^5); J
--            Fractional ideal class (115856201, 1/2*a + 40407883)
-+            Fractional ideal class (39135393, 1/2*a + 13654253)
-             sage: J.reduce()
--            Fractional ideal class (57, 1/2*a + 44)
-+            Fractional ideal class (73, 1/2*a + 47)
-             sage: J == I^5
-             True
-         """
-diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py
-index 79acd053bb..e060148e4d 100644
---- a/src/sage/rings/number_field/galois_group.py
-+++ b/src/sage/rings/number_field/galois_group.py
-@@ -944,7 +944,7 @@ class GaloisGroup_v2(GaloisGroup_perm):
-             sage: K.<b> = 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,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)]
-+            [(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)]
-             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 58463d570d..ff65634e99 100644
---- a/src/sage/rings/number_field/number_field.py
-+++ b/src/sage/rings/number_field/number_field.py
-@@ -3643,7 +3643,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: L.<b> = K.extension(x^2 - 3, x^2 + 1)
-             sage: M.<c> = 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
- 
-@@ -4227,7 +4227,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             (y^2 + 6, Mod(1/6*y, y^2 + 6), Mod(6*y, y^2 + 1/6))
-         """
-         f = self.absolute_polynomial()._pari_with_name('y')
--        if f.pollead() == f.content().denominator() == 1:
-+        f = f * f.content().denominator()
-+        if f.pollead() == 1:
-             g = f
-             alpha = beta = g.variable().Mod(g)
-         else:
-@@ -4821,7 +4822,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: K.<a> = 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))]
-@@ -5166,7 +5167,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: [K.ideal(g).factor() for g in gens]
-             [(Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1)),
--            Fractional ideal (-a),
-+            Fractional ideal (a),
-             (Fractional ideal (2, a + 1))^2,
-             1]
- 
-@@ -5751,7 +5752,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: K.elements_of_norm(3)
-             []
-             sage: K.elements_of_norm(50)
--            [-7*a + 1, 5*a - 5, 7*a + 1]
-+            [-a - 7, 5*a - 5, 7*a + 1]
- 
-         TESTS:
- 
-@@ -5863,7 +5864,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             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 (-3*a - 2))
-+            (Fractional ideal (a + 1)) * (Fractional ideal (-a - 2))^-1 * (Fractional ideal (2*a + 1))^-1 * (Fractional ideal (-2*a + 3))
- 
-         An example over a relative number field::
- 
-@@ -6460,9 +6461,9 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: new_basis = k.reduced_basis(prec=120)
-             sage: [c.minpoly() for c in new_basis]
-             [x - 1,
--             x^2 - 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^6 - 3*x^5 - 102*x^4 + 315*x^3 + 10254*x^2 - 80955*x + 198147,
-              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)
-@@ -7058,7 +7059,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-              -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,
--             -a^14 - a^13 + a^12 + 2*a^10 + a^8 - 2*a^7 - 2*a^6 + 2*a^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)
- 
-         TESTS:
- 
-@@ -7067,7 +7068,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: K.<a> = NumberField(1/2*x^2 - 1/6)
-             sage: K.units()
--            (-3*a + 2,)
-+            (3*a - 2,)
-         """
-         proof = proof_flag(proof)
- 
-@@ -7146,7 +7147,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: U.gens()
-             (u0, u1, u2, u3, u4, u5, u6, u7, u8)
-             sage: U.gens_values()  # result not independently verified
--            [-1, -a^9 - a + 1, -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, -a^14 - a^13 + a^12 + 2*a^10 + a^8 - 2*a^7 - 2*a^6 + 2*a^3 - a^2 + 2*a - 2]
-+            [-1, -a^9 - a + 1, -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]
-         """
-         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 784c239dc1..aa740069dc 100644
---- a/src/sage/rings/number_field/number_field_element.pyx
-+++ b/src/sage/rings/number_field/number_field_element.pyx
-@@ -4446,7 +4446,7 @@ cdef class NumberFieldElement(FieldElement):
-             sage: f = Qi.embeddings(K)[0]
-             sage: a = f(2+3*i) * (2-zeta)^2
-             sage: a.descend_mod_power(Qi,2)
--            [-3*i - 2, -2*i + 3]
-+            [-2*i + 3, 3*i + 2]
- 
-         An absolute example::
- 
-@@ -5124,7 +5124,7 @@ cdef class NumberFieldElement_relative(NumberFieldElement):
-         EXAMPLES::
- 
-             sage: K.<a, b, c> = NumberField([x^2 - 2, x^2 - 3, x^2 - 5])
--            sage: P = K.prime_factors(5)[0]
-+            sage: P = K.prime_factors(5)[1]
-             sage: (2*a + b - c).valuation(P)
-             1
-         """
-diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
-index 5f587556a4..33481fead0 100644
---- a/src/sage/rings/number_field/number_field_ideal.py
-+++ b/src/sage/rings/number_field/number_field_ideal.py
-@@ -3355,7 +3355,7 @@ def quotient_char_p(I, p):
-         []
- 
-         sage: I = K.factor(13)[0][0]; I
--        Fractional ideal (-3*i - 2)
-+        Fractional ideal (-2*i + 3)
-         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 bae36d4b9c..f64bd5b761 100644
---- a/src/sage/rings/number_field/number_field_ideal_rel.py
-+++ b/src/sage/rings/number_field/number_field_ideal_rel.py
-@@ -272,7 +272,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = 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
-@@ -401,7 +401,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = K.extension(5*x^2 + 1)
-             sage: P = L.primes_above(2)[0]
-             sage: P.relative_norm()
--            Fractional ideal (-6*a + 2)
-+            Fractional ideal (6*a + 2)
-         """
-         L = self.number_field()
-         K = L.base_field()
-@@ -518,7 +518,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = K.extension(5*x^2 + 1)
-             sage: P = L.primes_above(2)[0]
-             sage: P.ideal_below()
--            Fractional ideal (-6*a + 2)
-+            Fractional ideal (6*a + 2)
-         """
-         L = self.number_field()
-         K = L.base_field()
-diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py
-index d33980c4b1..50e846b205 100644
---- a/src/sage/rings/number_field/number_field_rel.py
-+++ b/src/sage/rings/number_field/number_field_rel.py
-@@ -213,14 +213,14 @@ class NumberField_relative(NumberField_generic):
-             sage: l.<b> = 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 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4), ..., y^4 + 6*y^2 + 1, x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4)], [0, 0]]
-+            [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]]
-             sage: b
-             b
- 
-             sage: l.<b> = 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 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4), ..., y^4 + 6*y^2 + 1, x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4)], [0, 0]]
-+            [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]]
-             sage: b
-             b
- 
-diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py
-index 6eca89ed8d..78ef4c3b33 100644
---- a/src/sage/rings/number_field/order.py
-+++ b/src/sage/rings/number_field/order.py
-@@ -520,7 +520,7 @@ class Order(IntegralDomain, sage.rings.abc.Order):
-             sage: k.<a> = 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 (11, a + 7)
-+            Fractional ideal class (43, a + 13)
-             sage: Ok = k.maximal_order(); Ok
-             Maximal Order in Number Field in a with defining polynomial x^2 + 5077
-             sage: Ok * (11, a + 7)
-diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py
-index c534aaa9f6..6bc67565d2 100644
---- a/src/sage/rings/number_field/selmer_group.py
-+++ b/src/sage/rings/number_field/selmer_group.py
-@@ -491,7 +491,7 @@ 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 (a),
-         (Fractional ideal (2, a + 1))^2,
-         1]
- 
-diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py
-index bb5d8356be..8a7e5fa66f 100644
---- a/src/sage/rings/polynomial/polynomial_quotient_ring.py
-+++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py
-@@ -1791,7 +1791,7 @@ class PolynomialQuotientRing_generic(CommutativeRing):
-             sage: D.selmer_generators([K.ideal(2, -a+1), K.ideal(3, a+1)], 3)
-             [2, a + 1]
-             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))
-diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
-index 704b77ce5f..83ee4549e4 100644
---- a/src/sage/rings/qqbar.py
-+++ b/src/sage/rings/qqbar.py
-@@ -312,8 +312,8 @@ and we get a way to produce the number directly::
-     True
-     sage: sage_input(n)
-     R.<y> = QQ[]
--    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(RR(0.51763809020504148), RR(0.51763809020504159)))
--    -109*v^3 - 89*v^2 + 327*v + 178
-+    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(-RR(1.9318516525781366), -RR(1.9318516525781364)))
-+    -109*v^3 + 89*v^2 + 327*v - 178
- 
- We can also see that some computations (basically, those which are
- easy to perform exactly) are performed directly, instead of storing
-@@ -362,7 +362,7 @@ algorithms in :trac:`10255`::
-     # Verified
-     R1.<x> = QQbar[]
-     R2.<y> = QQ[]
--    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(RR(0.51763809020504148), RR(0.51763809020504159)))
-+    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(-RR(1.9318516525781366), -RR(1.9318516525781364)))
-     AA.polynomial_root(AA.common_polynomial(x^4 + QQbar(v^3 - 3*v - 1)*x^3 + QQbar(-v^3 + 3*v - 3)*x^2 + QQbar(-3*v^3 + 9*v + 3)*x + QQbar(3*v^3 - 9*v)), RIF(RR(0.99999999999999989), RR(1.0000000000000002)))
-     sage: one
-     1
-@@ -2310,7 +2310,7 @@ def do_polred(poly, threshold=32):
-     cost = 2 * bitsize.nbits() + 5 * poly.degree().nbits()
-     if cost > threshold:
-         return parent.gen(), parent.gen(), poly
--    new_poly, elt_back = poly.__pari__().polredbest(flag=1)
-+    new_poly, elt_back = poly.numerator().__pari__().polredbest(flag=1)
-     elt_fwd = elt_back.modreverse()
-     return parent(elt_fwd.lift()), parent(elt_back.lift()), parent(new_poly)
- 
-@@ -2542,10 +2542,10 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-            Defn: a |--> 1.414213562373095?)
- 
-         sage: number_field_elements_from_algebraics((rt2,rt3))
--        (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, -a^2 + 2], Ring morphism:
-+        (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, a^2 - 2], Ring morphism:
-             From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-             To:   Algebraic Real Field
--            Defn: a |--> 0.5176380902050415?)
-+            Defn: a |--> -1.931851652578137?)
- 
-     ``rt3a`` is a real number in ``QQbar``.  Ordinarily, we'd get a homomorphism
-     to ``AA`` (because all elements are real), but if we specify ``same_field=True``,
-@@ -2570,7 +2570,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^3 + 3*a, Ring morphism:
-             From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-             To:   Algebraic Real Field
--            Defn: a |--> 0.5176380902050415?)
-+            Defn: a |--> -1.931851652578137?)
- 
-     We can specify ``minimal=True`` if we want the smallest number field::
- 
-@@ -2618,7 +2618,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         sage: nfI^2
-         -1
-         sage: sum = nfrt2 + nfrt3 + nfI + nfz3; sum
--        2*a^6 + a^5 - a^4 - a^3 - 2*a^2 - a
-+        a^5 + a^4 - a^3 + 2*a^2 - a - 1
-         sage: hom(sum)
-         2.646264369941973? + 1.866025403784439?*I
-         sage: hom(sum) == rt2 + rt3 + qqI + z3
-@@ -2658,7 +2658,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
-         sage: nf
-         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
--          with a = 0.2598678911433438? + 0.0572892247058457?*I
-+          with a = 0.2598679? + 0.0572892?*I
-         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
-         True
- 
-@@ -2725,7 +2725,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-                          sqrt(2), AA.polynomial_root(x^3-3, RIF(0,3)), 11/9, 1]
-         sage: res = number_field_elements_from_algebraics(my_nums, embedded=True)
-         sage: res[0]
--        Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = -95.5053039433554?
-+        Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = 93.32530798172420?
-     """
-     gen = qq_generator
- 
-@@ -3129,7 +3129,7 @@ class AlgebraicGenerator(SageObject):
-             sage: root = ANRoot(x^2 - x - 1, RIF(1, 2))
-             sage: gen = AlgebraicGenerator(nf, root)
-             sage: gen.pari_field()
--             [y^2 - y - 1, [2, 0], ...]
-+            [[y^2 - y - 1, [2, 0], ...]
-         """
-         if self.is_trivial():
-             raise ValueError("No PARI field attached to trivial generator")
-@@ -3213,7 +3213,7 @@ class AlgebraicGenerator(SageObject):
-             sage: qq_generator.union(gen3) is gen3
-             True
-             sage: gen2.union(gen3)
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-         """
-         if self._trivial:
-             return other
-@@ -3306,13 +3306,13 @@ class AlgebraicGenerator(SageObject):
-             Number Field in a with defining polynomial y^2 - 3 with a in 1.732050807568878?
-             sage: gen2_3 = gen2.union(gen3)
-             sage: gen2_3
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-             sage: qq_generator.super_poly(gen2) is None
-             True
-             sage: gen2.super_poly(gen2_3)
-             -a^3 + 3*a
-             sage: gen3.super_poly(gen2_3)
--            -a^2 + 2
-+            a^2 - 2
- 
-         """
-         if checked is None:
-@@ -3360,13 +3360,13 @@ class AlgebraicGenerator(SageObject):
-             sage: sqrt3 = ANExtensionElement(gen3, nf3.gen())
-             sage: gen2_3 = gen2.union(gen3)
-             sage: gen2_3
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-             sage: gen2_3(sqrt2)
-             -a^3 + 3*a
-             sage: gen2_3(ANRational(1/7))
-             1/7
-             sage: gen2_3(sqrt3)
--            -a^2 + 2
-+            a^2 - 2
-         """
-         if self._trivial:
-             return elt._value
-@@ -4336,10 +4336,10 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: rt3 = AA(sqrt(3))
-             sage: rt3b = rt2 + rt3 - rt2
-             sage: rt3b.as_number_field_element()
--            (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^2 + 2, Ring morphism:
-+            (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, a^2 - 2, Ring morphism:
-                 From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-                 To:   Algebraic Real Field
--                Defn: a |--> 0.5176380902050415?)
-+                Defn: a |--> -1.931851652578137?)
-             sage: rt3b.as_number_field_element(minimal=True)
-             (Number Field in a with defining polynomial y^2 - 3, a, Ring morphism:
-                From: Number Field in a with defining polynomial y^2 - 3
-@@ -4401,7 +4401,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: rt2b = rt3 + rt2 - rt3
-             sage: rt2b.exactify()
-             sage: rt2b._exact_value()
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b.simplify()
-             sage: rt2b._exact_value()
-             a where a^2 - 2 = 0 and a in 1.414213562373095?
-@@ -4422,7 +4422,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: QQbar(2)._exact_field()
-             Trivial generator
-             sage: (sqrt(QQbar(2)) + sqrt(QQbar(19)))._exact_field()
--            Number Field in a with defining polynomial y^4 - 20*y^2 + 81 with a in 2.375100220297941?
-+            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?
-         """
-@@ -4442,7 +4442,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: QQbar(2)._exact_value()
-             2
-             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 2.375100220297941?
-+            -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?
-         """
-@@ -6857,7 +6857,7 @@ class AlgebraicPolynomialTracker(SageObject):
-             sage: p = sqrt(AA(2)) * x^2 - sqrt(AA(3))
-             sage: cp = AA.common_polynomial(p)
-             sage: cp.generator()
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 1.931851652578137?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -0.5176380902050415?
-         """
-         self.exactify()
-         return self._gen
-@@ -7706,7 +7706,7 @@ class ANExtensionElement(ANDescr):
- 
-             sage: rt2b.exactify()
-             sage: rt2b._descr
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b._descr.is_simple()
-             False
-         """
-@@ -7791,7 +7791,7 @@ class ANExtensionElement(ANDescr):
-             sage: rt2b = rt3 + rt2 - rt3
-             sage: rt2b.exactify()
-             sage: rt2b._descr
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b._descr.simplify(rt2b)
-             a where a^2 - 2 = 0 and a in 1.414213562373095?
-         """
-@@ -7830,9 +7830,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.neg(a)
--            1/3*a^3 - 2/3*a^2 + 4/3*a - 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-             sage: b.neg("ham spam and eggs")
--            1/3*a^3 - 2/3*a^2 + 4/3*a - 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-         """
-         return ANExtensionElement(self._generator, -self._value)
- 
-@@ -7848,9 +7848,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.invert(a)
--            7/3*a^3 - 2/3*a^2 + 4/3*a - 12 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-             sage: b.invert("ham spam and eggs")
--            7/3*a^3 - 2/3*a^2 + 4/3*a - 12 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-         """
-         return ANExtensionElement(self._generator, ~self._value)
- 
-@@ -7866,9 +7866,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.conjugate(a)
--            -1/3*a^3 + 2/3*a^2 - 4/3*a + 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? + 1.573132184970987?*I
-+            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
-             sage: b.conjugate("ham spam and eggs")
--            -1/3*a^3 + 2/3*a^2 - 4/3*a + 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? + 1.573132184970987?*I
-+            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
-         """
-         if self._exactly_real:
-             return self
-@@ -8501,7 +8501,7 @@ def an_binop_expr(a, b, op):
-         sage: x = an_binop_expr(a, b, operator.add); x
-         <sage.rings.qqbar.ANBinaryExpr object at ...>
-         sage: x.exactify()
--        -6/7*a^7 + 2/7*a^6 + 71/7*a^5 - 26/7*a^4 - 125/7*a^3 + 72/7*a^2 + 43/7*a - 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in 3.12580...?
-+        6/7*a^7 - 2/7*a^6 - 71/7*a^5 + 26/7*a^4 + 125/7*a^3 - 72/7*a^2 - 43/7*a + 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997?
- 
-         sage: a = QQbar(sqrt(2)) + QQbar(sqrt(3))
-         sage: b = QQbar(sqrt(3)) + QQbar(sqrt(5))
-@@ -8510,7 +8510,7 @@ def an_binop_expr(a, b, op):
-         sage: x = an_binop_expr(a, b, operator.mul); x
-         <sage.rings.qqbar.ANBinaryExpr object at ...>
-         sage: x.exactify()
--        2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in 3.1258...?
-+        2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997?
-     """
-     return ANBinaryExpr(a, b, op)
- 
-diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py
-index 1c4f2dff18..32c2e47e49 100644
---- a/src/sage/schemes/affine/affine_morphism.py
-+++ b/src/sage/schemes/affine/affine_morphism.py
-@@ -1148,9 +1148,9 @@ class SchemeMorphism_polynomial_affine_space_field(SchemeMorphism_polynomial_aff
-             sage: H = End(A)
-             sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)])
-             sage: f.reduce_base_field()
--            Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = 1.931851652578137?
-+            Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = ...?
-               Defn: Defined on coordinates by sending (x) to
--                    (((a^3 - 3*a)*x^2 + (1/3*a^2 - 2/3))/(5*x))
-+                    (((a^3 - 3*a)*x^2 + (-1/3*a^2 + 2/3))/(5*x))
- 
-         ::
- 
-diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py
-index 68b8375dae..48f358ea6a 100644
---- a/src/sage/schemes/elliptic_curves/ell_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_field.py
-@@ -845,7 +845,7 @@ class EllipticCurve_field(ell_generic.EllipticCurve_generic, ProjectivePlaneCurv
-             sage: E = E.base_extend(G).quadratic_twist(c); E
-             Elliptic Curve defined 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.<b> = E.division_field(3, simplify_all=True); K
--            Number Field in b with defining polynomial x^12 - 10*x^10 + 55*x^8 - 60*x^6 + 75*x^4 + 1350*x^2 + 2025
-+            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_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py
-index 926ae310ea..3bae819fb0 100644
---- a/src/sage/schemes/elliptic_curves/ell_generic.py
-+++ b/src/sage/schemes/elliptic_curves/ell_generic.py
-@@ -3324,8 +3324,8 @@ class EllipticCurve_generic(WithEqualityById, plane_curve.ProjectivePlaneCurve):
-             sage: K.<a> = QuadraticField(2)
-             sage: E = EllipticCurve([1,a])
-             sage: E.pari_curve()
--            [Mod(0, y^2 - 2), Mod(0, y^2 - 2), Mod(0, y^2 - 2), Mod(1, y^2 - 2),
--            Mod(y, y^2 - 2), Mod(0, y^2 - 2), Mod(2, y^2 - 2), Mod(4*y, y^2 - 2),
-+            [0, 0, 0, Mod(1, y^2 - 2),
-+            Mod(y, y^2 - 2), 0, Mod(2, y^2 - 2), Mod(4*y, y^2 - 2),
-             Mod(-1, y^2 - 2), Mod(-48, y^2 - 2), Mod(-864*y, y^2 - 2),
-             Mod(-928, y^2 - 2), Mod(3456/29, y^2 - 2), Vecsmall([5]),
-             [[y^2 - 2, [2, 0], 8, 1, [[1, -1.41421356237310;
-diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
-index edbd196090..c44c803aa8 100644
---- a/src/sage/schemes/elliptic_curves/ell_number_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
-@@ -218,7 +218,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: E == loads(dumps(E))
-             True
-             sage: E.simon_two_descent()
--            (2, 2, [(0 : 0 : 1)])
-+            (2, 2, [(0 : 0 : 1), (1/18*a + 7/18 : -5/54*a - 17/54 : 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)])
- 
-@@ -274,7 +274,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: E.simon_two_descent()  # long time (4s on sage.math, 2013)
-             (3,
-              3,
--             [(5/8*zeta43_0^2 + 17/8*zeta43_0 - 9/4 : -27/16*zeta43_0^2 - 103/16*zeta43_0 + 39/8 : 1),
-+             [(1/8*zeta43_0^2 - 3/8*zeta43_0 - 1/4 : -5/16*zeta43_0^2 + 7/16*zeta43_0 + 1/8 : 1),
-               (0 : 0 : 1)])
-         """
-         verbose = int(verbose)
-@@ -865,7 +865,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             Conductor exponent: 1
-             Kodaira Symbol: I1
-             Tamagawa Number: 1,
--            Local data at Fractional ideal (-3*i - 2):
-+            Local data at Fractional ideal (-2*i + 3):
-             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
-             Minimal discriminant valuation: 2
-@@ -2645,12 +2645,12 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             [-92, -23, -23]
- 
-             sage: C.matrix()  # long time
--            [1 2 2 4 2 4]
--            [2 1 2 2 4 4]
--            [2 2 1 4 4 2]
--            [4 2 4 1 3 3]
--            [2 4 4 3 1 3]
--            [4 4 2 3 3 1]
-+            [1 2 2 4 4 2]
-+            [2 1 2 4 2 4]
-+            [2 2 1 2 4 4]
-+            [4 4 2 1 3 3]
-+            [4 2 4 3 1 3]
-+            [2 4 4 3 3 1]
- 
-         The graph of this isogeny class has a shape which does not
-         occur over `\QQ`: a triangular prism.  Note that for curves
-@@ -2677,12 +2677,12 @@ class EllipticCurve_number_field(EllipticCurve_field):
- 
-             sage: G = C.graph()  # long time
-             sage: G.adjacency_matrix()  # long time
--            [0 1 1 0 1 0]
--            [1 0 1 1 0 0]
--            [1 1 0 0 0 1]
--            [0 1 0 0 1 1]
--            [1 0 0 1 0 1]
--            [0 0 1 1 1 0]
-+            [0 1 1 0 0 1]
-+            [1 0 1 0 1 0]
-+            [1 1 0 1 0 0]
-+            [0 0 1 0 1 1]
-+            [0 1 0 1 0 1]
-+            [1 0 0 1 1 0]
- 
-         To display the graph without any edge labels::
- 
-@@ -3316,7 +3316,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: points = [E.lift_x(x) for x in xi]
-             sage: newpoints, U = E.lll_reduce(points)  # long time (35s on sage.math, 2011)
-             sage: [P[0] for P in newpoints]            # long time
--            [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 175620639884534615751/25, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7404442636649562303, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297]
-+            [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 11465667352242779838, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7041412654828066743, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297]
- 
-         An example to show the explicit use of the height pairing matrix::
- 
-diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py
-index 3808822812..a75290ea35 100644
---- a/src/sage/schemes/elliptic_curves/ell_rational_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py
-@@ -1827,7 +1827,7 @@ class EllipticCurve_rational_field(EllipticCurve_number_field):
-             sage: E = EllipticCurve('389a1')
-             sage: E._known_points = []  # clear cached points
-             sage: E.simon_two_descent()
--            (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)])
-+            (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/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 81ad295160..d484a4a18b 100644
---- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
-+++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
-@@ -780,12 +780,12 @@ 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 (a),
-          Fractional ideal (-2*a + 3),
-          Fractional ideal (2*a + 3),
-          Fractional ideal (a + 6),
-diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py
-index 28b97f34af..9f7d1b6020 100644
---- a/src/sage/schemes/elliptic_curves/gp_simon.py
-+++ b/src/sage/schemes/elliptic_curves/gp_simon.py
-@@ -56,7 +56,7 @@ 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)
--        (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)])
-+        (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)])
- 
-     TESTS::
- 
-@@ -117,7 +117,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
-     # The block below mimics the defaults in Simon's scripts, and needs to be changed
-     # when these are updated.
-     if K is QQ:
--        cmd = 'ellrank(%s, %s);' % (list(E.ainvs()), [P.__pari__() for P in known_points])
-+        cmd = 'ellQ_ellrank(%s, %s);' % (list(E.ainvs()), [P.__pari__() for P in known_points])
-         if lim1 is None:
-             lim1 = 5
-         if lim3 is None:
-@@ -144,7 +144,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
-     if verbose > 0:
-         print(s)
-     v = gp.eval('ans')
--    if v=='ans': # then the call to ellrank() or bnfellrank() failed
-+    if v=='ans': # then the call to ellQ_ellrank() or bnfellrank() failed
-         raise RuntimeError("An error occurred while running Simon's 2-descent program")
-     if verbose >= 2:
-         print("v = %s" % v)
-diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-index a936deb74f..dc19254d8c 100644
---- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-+++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-@@ -1208,14 +1208,14 @@ def isogenies_13_0(E, minimal_models=True):
-         sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
-         [(0,
-           0,
--          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645,
-+          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
-           -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
--          579363345221/13763747804451840*a^11 + 371192377511/860234237778240*a^10 + 8855090365657/1146978983704320*a^9 + 5367261541663/1633873196160*a^8 + 614883554332193/15930263662560*a^7 + 30485197378483/68078049840*a^6 - 131000897588387/2450809794240*a^5 - 203628705777949/306351224280*a^4 - 1587619388190379/204234149520*a^3 + 14435069706551/11346341640*a^2 + 7537273048614/472764235*a + 89198980034806/472764235),
-+          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
-          (0,
-           0,
--          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645,
-+          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
-           -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
--          -132601797212627/3440936951112960*a^11 - 6212467020502021/13763747804451840*a^10 - 1515926454902497/286744745926080*a^9 - 15154913741799637/4901619588480*a^8 - 576888119803859263/15930263662560*a^7 - 86626751639648671/204234149520*a^6 + 16436657569218427/306351224280*a^5 + 1540027900265659087/2450809794240*a^4 + 375782662805915809/51058537380*a^3 - 14831920924677883/11346341640*a^2 - 7237947774817724/472764235*a - 84773764066089509/472764235)]
-+          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
-     """
-     if E.j_invariant()!=0:
-         raise ValueError("j-invariant must be 0.")
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
deleted file mode 100644
index 762bb2612632..000000000000
--- a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From f0365f30834b6890313790b3845c647d0160fa6a Mon Sep 17 00:00:00 2001
-From: Vincent Delecroix <20100.delecroix@gmail.com*>
-Date: Fri, 30 Sep 2022 16:31:08 +0200
-Subject: fix doctest if fqf_orthogonal
-
----
- src/sage/groups/fqf_orthogonal.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
-index 75de408..7fc4dbe 100644
---- a/src/sage/groups/fqf_orthogonal.py
-+++ b/src/sage/groups/fqf_orthogonal.py
-@@ -245,10 +245,10 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
-             sage: all(x*f==x*fbar for x in q.gens())
-             True
-             sage: L = IntegralLattice("A2").twist(3)
--            sage: q = L.discriminant_group()
-             sage: OL = L.orthogonal_group()
-+            sage: assert OL(OL.0.matrix()) == OL.0
-+            sage: q = L.discriminant_group()
-             sage: Oq = q.orthogonal_group()
--            sage: assert Oq(OL.0) == Oq(OL.0.matrix())
-             sage: assert Oq(Oq.0.matrix()) == Oq.0
-         """
-         from sage.libs.gap.element import GapElement
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch b/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
deleted file mode 100644
index 6afaf1b7162f..000000000000
--- a/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-commit 5501e0de0dca1cff0355326dd42bd8c7e5749568
-Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
-Date:   Tue Oct 11 17:25:04 2022 -0300
-
-    Support matplotlib 3.6
-
-diff --git a/src/sage/plot/arc.py b/src/sage/plot/arc.py
-index bb834763afc..f65973bcbd5 100644
---- a/src/sage/plot/arc.py
-+++ b/src/sage/plot/arc.py
-@@ -273,9 +273,9 @@ class Arc(GraphicPrimitive):
-         p = patches.Arc((self.x, self.y),
-                         2. * self.r1,
-                         2. * self.r2,
--                        fmod(self.angle, 2 * pi) * (180. / pi),
--                        self.s1 * (180. / pi),
--                        self.s2 * (180. / pi))
-+                        angle=fmod(self.angle, 2 * pi) * (180. / pi),
-+                        theta1=self.s1 * (180. / pi),
-+                        theta2=self.s2 * (180. / pi))
-         return p
- 
-     def bezier_path(self):
-diff --git a/src/sage/plot/ellipse.py b/src/sage/plot/ellipse.py
-index a77e6fe640a..c35bed574ef 100644
---- a/src/sage/plot/ellipse.py
-+++ b/src/sage/plot/ellipse.py
-@@ -192,7 +192,8 @@ class Ellipse(GraphicPrimitive):
-         options = self.options()
-         p = patches.Ellipse(
-                 (self.x,self.y),
--                self.r1*2.,self.r2*2.,self.angle/pi*180.)
-+                self.r1*2.,self.r2*2.,
-+                angle=self.angle/pi*180.)
-         p.set_linewidth(float(options['thickness']))
-         p.set_fill(options['fill'])
-         a = float(options['alpha'])
-diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py
-index e779e1210e3..8d620b5c625 100644
---- a/src/sage/plot/graphics.py
-+++ b/src/sage/plot/graphics.py
-@@ -2007,7 +2007,7 @@ class Graphics(WithEqualityById, SageObject):
-         We can also do custom formatting if you need it.  See above for full
-         details::
- 
--            sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex")
-+            sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") # not tested (broken with matplotlib 3.6)
-             Graphics object consisting of 1 graphics primitive
- 
-         This is particularly useful when setting custom ticks in multiples
-@@ -2341,7 +2341,7 @@ class Graphics(WithEqualityById, SageObject):
-             sage: subplot = Figure().add_subplot(111)
-             sage: p._objects[0]._render_on_subplot(subplot)
-             sage: p._matplotlib_tick_formatter(subplot, **d)
--            (<AxesSubplot:>,
-+            (<AxesSubplot:...>,
-             <matplotlib.ticker.MaxNLocator object at ...>,
-             <matplotlib.ticker.MaxNLocator object at ...>,
-             <matplotlib.ticker.ScalarFormatter object at ...>,
-diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py
-index b36ee57227c..5301a05c3dc 100644
---- a/src/sage/plot/plot.py
-+++ b/src/sage/plot/plot.py
-@@ -1741,7 +1741,7 @@ def plot(funcs, *args, **kwds):
- 
-     ::
- 
--        sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex")
-+        sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") # not tested (broken with matplotlib 3.6)
-         Graphics object consisting of 1 graphics primitive
- 
-     .. PLOT::
diff --git a/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch b/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
new file mode 100644
index 000000000000..f2f825e4fb10
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
@@ -0,0 +1,205 @@
+diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini
+index 2e33a405d36..313463d2fea 100644
+--- a/build/pkgs/singular/checksums.ini
++++ b/build/pkgs/singular/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=singular-VERSION.tar.gz
+-sha1=6c2b622d3681e2de3d58d30c654d43d3e32b720c
+-md5=abb1e37c794472e7760655358ab66054
+-cksum=17455733
++sha1=28bb3ee97ef48d04dfa96de182fd93eebe08426c
++md5=fc0a4f5720dadba45a52ee94324ce00c
++cksum=1573851737
+ upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz
+diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt
+index 11300c77e7d..66e2bede53a 100644
+--- a/build/pkgs/singular/package-version.txt
++++ b/build/pkgs/singular/package-version.txt
+@@ -1 +1 @@
+-4.3.1p1
++4.3.1p3
+diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd
+index 8e3ac314b67..747a6b1e2fb 100644
+--- a/src/sage/libs/singular/decl.pxd
++++ b/src/sage/libs/singular/decl.pxd
+@@ -574,7 +574,7 @@ cdef extern from "singular/Singular/libsingular.h":
+ 
+     # gets a component out of a polynomial vector
+ 
+-    poly *pTakeOutComp1(poly **, int)
++    poly *pTakeOutComp(poly **, int)
+ 
+     # deep copy p
+ 
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index d8ea7b07f3c..3a1271cd59f 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -1726,20 +1726,21 @@ cdef int overflow_check(unsigned long e, ring *_ring) except -1:
+ 
+     Whether an overflow occurs or not partially depends
+     on the number of variables in the ring. See trac ticket
+-    :trac:`11856`. With Singular 4, it is by default optimized
+-    for at least 4 variables on 64-bit and 2 variables on 32-bit,
+-    which in both cases makes a maximal default exponent of
+-    2^16-1.
++    :trac:`11856`.
+ 
+     EXAMPLES::
+ 
+         sage: P.<x,y> = QQ[]
+-        sage: y^(2^16-1)
+-        y^65535
+-        sage: y^2^16
++        sage: y^(2^30)
++        Traceback (most recent call last):             # 32-bit
++        ...                                            # 32-bit
++        OverflowError: exponent overflow (1073741824)  # 32-bit
++        y^1073741824  # 64-bit
++        sage: y^2^32
+         Traceback (most recent call last):
+         ...
+-        OverflowError: exponent overflow (65536)
++        OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++        OverflowError: exponent overflow (4294967296)  # 64-bit
+     """
+     if unlikely(e > _ring.bitmask):
+         raise OverflowError("exponent overflow (%d)"%(e))
+diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+index 7dc058a22f0..71494eddbc0 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_ideal.py
++++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+@@ -60,7 +60,7 @@
+ Note that the result of a computation is not necessarily reduced::
+ 
+     sage: (a+b)^17
+-    256*a*b^16 + 256*b^17
++    a*b^16 + b^17
+     sage: S(17) == 0
+     True
+ 
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index 4dad016b33f..9bf67dd1425 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -193,7 +193,7 @@ from sage.libs.singular.decl cimport (
+     p_IsUnit, p_IsOne, p_Series, p_Head, idInit, fast_map_common_subexp, id_Delete,
+     p_IsHomogeneous, p_Homogen, p_Totaldegree,pLDeg1_Totaldegree, singclap_pdivide, singclap_factorize,
+     idLift, IDELEMS, On, Off, SW_USE_CHINREM_GCD, SW_USE_EZGCD,
+-    p_LmIsConstant, pTakeOutComp1, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
++    p_LmIsConstant, pTakeOutComp, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
+     pLength, kNF, p_Neg, p_Minus_mm_Mult_qq, p_Plus_mm_Mult_qq,
+     pDiff, singclap_resultant, p_Normalize,
+     prCopyR, prCopyR_NoSort)
+@@ -1587,7 +1587,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
+             9/4
+ 
+             sage: P.monomial_quotient(x,y) # Note the wrong result
+-            x*y^65535*z^65535
++            x*y^65535*z^65535      # 32-bit
++            x*y^1048575*z^1048575  # 64-bit
+ 
+             sage: P.monomial_quotient(x,P(1))
+             x
+@@ -2247,10 +2248,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             9/4*x^2 - 1/4*y^2 - y - 1
+ 
+             sage: P.<x,y> = PolynomialRing(QQ,order='lex')
+-            sage: (x^2^15) * x^2^15
++            sage: (x^2^32) * x^2^32
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (...)
++            OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++            OverflowError: exponent overflow (...)  # 64-bit
+         """
+         # all currently implemented rings are commutative
+         cdef poly *_p
+@@ -2371,10 +2373,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             ValueError: not a 2nd power
+ 
+             sage: P.<x,y> = PolynomialRing(QQ,order='lex')
+-            sage: (x+y^2^15)^10
++            sage: (x+y^2^32)^10
+             Traceback (most recent call last):
+             ....
+-            OverflowError: exponent overflow (...)
++            OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++            OverflowError: exponent overflow (...)  # 64-bit
+ 
+         Test fractional powers (:trac:`22329`)::
+ 
+@@ -3461,7 +3464,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             x^10000
+             no overflow
+ 
+-            sage: n = 1000
++            sage: n = 100000
+             sage: try:
+             ....:     f = x^n
+             ....:     f.subs(x = x^n)
+@@ -4567,7 +4570,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         l = []
+         for i from 0 <= i < IDELEMS(res):
+             for j from 1 <= j <= IDELEMS(_I):
+-                l.append( new_MP(parent, pTakeOutComp1(&res.m[i], j)) )
++                l.append( new_MP(parent, pTakeOutComp(&res.m[i], 1)) )
+ 
+         id_Delete(&fI, r)
+         id_Delete(&_I, r)
+@@ -4635,7 +4638,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+ 
+             sage: f = 3*x
+             sage: f.reduce([2*x,y])
+-            3*x
++            x
+ 
+         The reduction is not canonical when ``I`` is not a Groebner
+         basis::
+diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx
+index 1c9f35e56ba..587511c3888 100644
+--- a/src/sage/rings/polynomial/plural.pyx
++++ b/src/sage/rings/polynomial/plural.pyx
+@@ -1619,10 +1619,10 @@ cdef class NCPolynomial_plural(RingElement):
+             sage: P = A.g_algebra(relations={y*x:-x*y + z},  order='lex')
+             sage: P.inject_variables()
+             Defining x, z, y
+-            sage: (x^2^15) * x^2^15
++            sage: (x^2^31) * x^2^31
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (65536)
++            OverflowError: exponent overflow (2147483648)
+         """
+         # all currently implemented rings are commutative
+         cdef poly *_p
+@@ -1689,10 +1689,10 @@ cdef class NCPolynomial_plural(RingElement):
+             sage: P = A.g_algebra(relations={y*x:-x*y + z},  order='lex')
+             sage: P.inject_variables()
+             Defining x, z, y
+-            sage: (x+y^2^15)^10
++            sage: (x+y^2^31)^10
+             Traceback (most recent call last):
+             ....
+-            OverflowError: exponent overflow (327680)
++            OverflowError: exponent overflow (2147483648)
+         """
+         if type(exp) is not Integer:
+             try:
+diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx
+index b5d83ef71b6..5c45b3fb528 100644
+--- a/src/sage/structure/element.pyx
++++ b/src/sage/structure/element.pyx
+@@ -2705,10 +2705,10 @@ cdef class RingElement(ModuleElement):
+         with Singular 4::
+ 
+             sage: K.<x,y> = ZZ[]
+-            sage: (x^12345)^54321
++            sage: (x^123456)^654321
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (670592745)
++            OverflowError: exponent overflow (...)
+         """
+         return arith_generic_power(self, n)
+ 
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..75695f0e5f87 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.7
-revision=4
+version=9.8
+revision=1
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -14,7 +14,7 @@ makedepends="arb-devel boost-devel brial-devel cliquer-devel ecl eclib-devel
  libpng-devel linbox-devel m4ri-devel m4rie-devel mpfi-devel
  mpfr-devel ntl-devel openblas-devel pari-devel planarity-devel python3-cypari2
  python3-cysignals python3-devel python3-gmpy2 python3-memory_allocator
- python3-numpy rankwidth-devel singular symmetrica-devel zn_poly"
+ python3-numpy rankwidth-devel singular symmetrica-devel"
 depends="FlintQS eclib-devel fflas-ffpack flintlib-devel gcc-fortran gd-devel
  gfan giac gsl-devel gzip libpng-devel linbox-devel m4ri-devel maxima-ecl
  mpfr-devel nauty ntl-devel palp pari-devel pari-elldata-small pari-galdata
@@ -32,7 +32,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+checksum=2aff28bd1d18c2d526581f5298acb8336f5b92db5675a7403dec8eaf9a86bc4c
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (22 preceding siblings ...)
  2023-02-13 18:31 ` [PR PATCH] [Updated] " tornaria
@ 2023-02-14  0:11 ` tornaria
  2023-02-14  0:17 ` tornaria
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-14  0:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1748 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: rebuild for dep updates and fixes
<!-- Uncomment relevant sections and delete options which are not applicable -->

- rebuild for boost update in sync with brial (same PR)
- fixes for numpy 1.24 (already updated in void)
- fixes to support updating giac to 1.9.0.37
- fixes to support updating tachyon to 0.99.5
- fixes to doctest failures in 32 bit after upgrade of pari to 2.15.2
- fix an edge case of python 3.11 integer conversion on 32 bit
- fix singular interface bug that triggers under very heavy load (e.g. on CI)
- tarball was moved; sha256 changed only b/c of main dirname change

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 315941 bytes --]

From fa571f4eeb8391e934526ad2045b293ee119c4a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 23:11:04 -0300
Subject: [PATCH 1/3] singular: update to 4.3.1p3.

---
 srcpkgs/singular/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/singular/template b/srcpkgs/singular/template
index 2dc38af826be..c73a020dcf15 100644
--- a/srcpkgs/singular/template
+++ b/srcpkgs/singular/template
@@ -1,6 +1,6 @@
 # Template file for 'singular'
 pkgname=singular
-version=4.3.1p2
+version=4.3.1p3
 revision=1
 _majver=${version%p*}
 build_style=gnu-configure
@@ -20,7 +20,7 @@ maintainer="dkwo <npiazza@disroot.org>"
 license="GPL-2.0-or-later"
 homepage="https://www.singular.uni-kl.de"
 distfiles="https://www.singular.uni-kl.de/ftp/pub/Math/Singular/SOURCES/${_majver//./-}/singular-${version}.tar.gz"
-checksum=95814bba0f0bd0290cd9799ec1d2ecc6f4c8a4e6429d9a02eb7f9c4e5649682a
+checksum=66cfaeee7ab909272fd81050a09cae3ec115652a01adde014a5128a54b97397a
 
 if [ -z "$CROSS_BUILD" ]; then
 	makedepends+=" ntl-devel"

From ff325c71faef9ef266fa2e74966d7236ed142db7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 2/3] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From 7ed9dc72d3ca19ab9dd421328e7b2d1483ff0433 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 3/3] sagemath: update to 9.8.

Also:
 - fix edge case of python 3.11 integer conversion on 32 bit
 - support tachyon 0.99.5
 - support singular 4.3.1p3
 - fix tests for giac 1.9.0.35
 - fix tests for numpy 1.24
 - skip unstable tests in klyachko.py
 - remove zn_poly dependency
---
 srcpkgs/sagemath/files/sage_conf.py           |    3 +-
 .../patches/09-doctest_numerical_fix.patch    |   14 -
 .../34980-avoid_factoring_in_is_prime.patch   |   47 +
 .../patches/34994-fix_tests_numpy_1.24.patch  |   58 +
 .../34995-support_tachyon_0.99.2.patch        |   57 +
 ...34997-fix_edge_case_of_integer_check.patch |   36 +
 .../35058-skip_unstable_tests_klyachko.patch  |   22 +
 .../35068-fix_tests_giac_1.9.0.35.patch       |   62 +
 .../patches/35094-support_gap_4.12.patch      | 1303 ++++++++++++
 srcpkgs/sagemath/patches/get_patches          |   40 +
 ...cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch |   53 -
 ...fc4ec8b8687bccd22d2e3161c86cf5553e06.patch |  427 ----
 ...rac-33842-01-python_3.11-de38bac21e2.patch |   66 -
 ...-python_3.11-argspec-fix-9eb08f3afde.patch |  168 --
 ...3-python3.11-final_fixes-7b6fa565f42.patch | 1279 ------------
 .../trac-33842-04-python3.11_fix_32_bit.patch |  212 --
 ...d4e56243c609f44afc1f21c112b026f9e1fe.patch |   42 -
 ...93d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch |  526 -----
 ...1318f032caf8dc1c0de9489346d894409091.patch |   19 -
 .../trac-34537-sagemath-pari-2.15.patch       | 1750 -----------------
 .../trac-34537-sagemath-pari-2.15b.patch      |   29 -
 ...e0de0dca1cff0355326dd42bd8c7e5749568.patch |   72 -
 ...-support_singular_4.3.1.p3-5e5737a0c.patch |  205 ++
 srcpkgs/sagemath/template                     |    8 +-
 srcpkgs/sagemath/update                       |    2 +
 25 files changed, 1838 insertions(+), 4662 deletions(-)
 delete mode 100644 srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
 create mode 100644 srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
 create mode 100644 srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
 create mode 100644 srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
 create mode 100644 srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
 create mode 100644 srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
 create mode 100755 srcpkgs/sagemath/patches/get_patches
 delete mode 100644 srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/files/sage_conf.py b/srcpkgs/sagemath/files/sage_conf.py
index 85ec37dfb50e..00de40f1ee4f 100644
--- a/srcpkgs/sagemath/files/sage_conf.py
+++ b/srcpkgs/sagemath/files/sage_conf.py
@@ -1,3 +1,4 @@
 # configuration for sage on void linux
 SAGE_SHARE = "/usr/share/sagemath"
-GAP_ROOT_DIR = "/usr/share/gap"
+GAP_SHARE_DIR = "/usr/share/gap"
+GAP_LIB_DIR = "/usr/lib/gap"
diff --git a/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch b/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
deleted file mode 100644
index 8780c8a97efa..000000000000
--- a/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
+++ /dev/null
@@ -1,14 +0,0 @@
- - This fixes a doctest failure due to a small numerical issue when running
-   maxima-sbcl on 32 bit
-
---- a/src/sage/interfaces/maxima_abstract.py
-+++ b/src/sage/interfaces/maxima_abstract.py
-@@ -1525,7 +1525,7 @@ class MaximaAbstractElement(ExtraTabCompletion, InterfaceElement):
-         EXAMPLES::
- 
-             sage: maxima('exp(-sqrt(x))').nintegral('x',0,1)
--            (0.5284822353142306, 4.1633141378838...e-11, 231, 0)
-+            (0.5284822353142306, 4.163...e-11, 231, 0)
- 
-         Note that GP also does numerical integration, and can do so to very
-         high precision very quickly::
diff --git a/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch b/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
new file mode 100644
index 000000000000..b1cf0eac41ae
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
@@ -0,0 +1,47 @@
+diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
+index 33481fead06..afea852bd56 100644
+--- a/src/sage/rings/number_field/number_field_ideal.py
++++ b/src/sage/rings/number_field/number_field_ideal.py
+@@ -995,16 +995,36 @@ def is_prime(self):
+             False
+             sage: K.ideal(17).is_prime()  # ramified
+             False
++
++        TESTS:
++
++        Check that we do not factor the norm of the ideal, this used
++        to take half an hour, see :trac:`33360`::
++
++            sage: K.<a,b,c> = NumberField([x^2-2,x^2-3,x^2-5])
++            sage: t = (((-2611940*c + 1925290/7653)*b - 1537130/7653*c
++            ....:       + 10130950)*a + (1343014/7653*c - 8349770)*b
++            ....:       + 6477058*c - 2801449990/4002519)
++            sage: t.is_prime()
++            False
+         """
+         try:
+             return self._pari_prime is not None
+         except AttributeError:
+-            F = self.factor()  # factorization with caching
+-            if len(F) != 1 or F[0][1] != 1:
+-                self._pari_prime = None
+-            else:
+-                self._pari_prime = F[0][0]._pari_prime
+-            return self._pari_prime is not None
++            pass
++
++        K = self.number_field().pari_nf()
++        I = self.pari_hnf()
++
++        self._pari_prime = K.idealismaximal(I) or None
++
++        # PARI uses probabilistic primality testing inside idealismaximal().
++        if self._pari_prime \
++                and get_flag(None, 'arithmetic') \
++                and not self._pari_prime[0].isprime():
++            self._pari_prime = None
++
++        return self._pari_prime is not None
+ 
+     def pari_prime(self):
+         r"""
diff --git a/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch b/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
new file mode 100644
index 000000000000..91f06fd4d173
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
@@ -0,0 +1,58 @@
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ def get_minmax_data(self):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ def fortran(self, line, cell):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch b/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
new file mode 100644
index 000000000000..2769e87f6a4b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
@@ -0,0 +1,57 @@
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e50892..ce1d50f71bc 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ def __call__(self, model, outfile='sage.png', verbose=1, extra_opts=''):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,25 @@ def usage(self, use_pager=True):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # random
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.readline()
++        res = re.search(r"Version ([\d.]*)", r)
++        # debian patches tachyon so it won't report the version
++        # we hardcode '0.99' since that's indeed the version they ship
++        return res[1] if res else '0.99'
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
diff --git a/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..11eb20d4f735
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,36 @@
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..d96b98f247c 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -309,7 +320,12 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+ 
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+-    cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    cdef long lead_3_overflow
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
++    else:
++        lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch b/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
new file mode 100644
index 000000000000..c4d7d5c779d1
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
@@ -0,0 +1,22 @@
+diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py
+index b1304a16913..77fae4b7545 100644
+--- a/src/sage/schemes/toric/sheaf/klyachko.py
++++ b/src/sage/schemes/toric/sheaf/klyachko.py
+@@ -26,7 +26,7 @@
+     (0, 0, 18, 16, 1)
+     sage: Gtilde = G_sum.random_deformation()
+     sage: V = Gtilde.wedge(2) * K                     # long time
+-    sage: V.cohomology(dim=True, weight=(0,0,0,0))    # long time
++    sage: V.cohomology(dim=True, weight=(0,0,0,0))    # long time  # random failure (see #32773)
+     (0, 0, 3, 0, 0)
+ 
+ REFERENCES:
+@@ -948,7 +948,7 @@ def random_deformation(self, epsilon=None):
+            sage: V.cohomology(dim=True, weight=(0,))
+            (1, 0)
+            sage: Vtilde = V.random_deformation()
+-           sage: Vtilde.cohomology(dim=True, weight=(0,))
++           sage: Vtilde.cohomology(dim=True, weight=(0,))  # random failure (see #32773)
+            (1, 0)
+         """
+         filt = self._filt.random_deformation(epsilon)
diff --git a/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch b/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
new file mode 100644
index 000000000000..d9a9835c696b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
@@ -0,0 +1,62 @@
+From 9ac7840134054155545e24fa3e66402d42b91c0f Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: [PATCH] Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451dba5e7..ccad5169836 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0fea30..b8896a94be9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
diff --git a/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch b/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
new file mode 100644
index 000000000000..499e0c71e256
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
@@ -0,0 +1,1303 @@
+diff --git a/build/pkgs/gap/checksums.ini b/build/pkgs/gap/checksums.ini
+index 066e943308a..b0ea8ba8818 100644
+--- a/build/pkgs/gap/checksums.ini
++++ b/build/pkgs/gap/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=gap-VERSION.tar.gz
+-sha1=4ecdd281b8f430282fb9b12690b06e0a26abde10
+-md5=85dc9e459d5b6c66fcad9f468afd3e3e
+-cksum=1351843158
++sha1=a6e36f3f874a2c46f51561402634497eab705cca
++md5=c5cd9f272f2703d7a3649ad7193b2d90
++cksum=2760477284
+ upstream_url=https://github.com/gap-system/gap/releases/download/vVERSION/gap-VERSION.tar.gz
+diff --git a/build/pkgs/gap/package-version.txt b/build/pkgs/gap/package-version.txt
+index d782fca8f64..f1cd7de1de5 100644
+--- a/build/pkgs/gap/package-version.txt
++++ b/build/pkgs/gap/package-version.txt
+@@ -1 +1 @@
+-4.11.1
++4.12.2
+diff --git a/build/pkgs/gap/spkg-check.in b/build/pkgs/gap/spkg-check.in
+index d9791d33293..d2fccda6e04 100644
+--- a/build/pkgs/gap/spkg-check.in
++++ b/build/pkgs/gap/spkg-check.in
+@@ -3,6 +3,13 @@ cd src
+ # #28728: Fix test failure in tst/testinstall/strings.tst
+ export LC_CTYPE=en_US.UTF-8
+ 
++# #34391: in GAP 4.12 some packages need GAP package io
++#         to let tests run, otherwise this hangs. Thus we install io here.
++cd pkg/io
++./configure --with-gaproot=../..
++make
++cd ../..
++
+ make testinstall
+ if [[ $? -ne 0 ]]; then
+     exit 1
+diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in
+index 2ceadf99db4..e2c8b4dca54 100644
+--- a/build/pkgs/gap/spkg-install.in
++++ b/build/pkgs/gap/spkg-install.in
+@@ -8,8 +8,7 @@ export CFLAGS=$CFLAGS_NON_NATIVE
+ export CXXFLAGS=$CXXFLAGS_NON_NATIVE
+ 
+ GAP_BUILD_ROOT="$(pwd)"
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
+-DESTDIR_GAP_ROOT="$SAGE_DESTDIR$GAP_ROOT"
++GAP_ROOT="$SAGE_LOCAL/lib/gap"
+ 
+ # Enable debug info if requested.
+ # Note that -g3 allows you to use preprocessor macros in gdb which are widely used
+@@ -17,37 +16,17 @@ if [ "$SAGE_DEBUG" = yes ] ; then
+     export CFLAGS="-O0 -g3 -DDEBUG_MASTERPOINTERS -DDEBUG_GLOBAL_BAGS -DDEBUG_FUNCTIONS_BAGS $CFLAGS"
+ fi
+ 
+-sdh_configure $SAGE_CONFIGURE_GMP
+-sdh_make -j1
++# LDFLAGS hack below needed by Semigroups package
++sdh_configure $SAGE_CONFIGURE_GMP LDFLAGS="-pthread" --prefix=$SAGE_LOCAL
++sdh_make
+ 
+-# GAP's "make install" is work in progress; we use bits and pieces of it
+-# but we install many things manually.
+-sdh_make install-headers install-libgap
+-
+-# Install config.h, which is not currently handled by `make install-headers`
+-sdh_install gen/config.h "$SAGE_LOCAL/include/gap"
+-
+-# Now install the gap executable as "gap-bin"; it will be called normally
+-# through our wrapper script that sets the appropriate GAP_ROOT
+-SAGE_BIN="$SAGE_LOCAL/bin"
+-mkdir -p "$SAGE_DESTDIR$SAGE_BIN" || sdh_die "Failed to create the directory $SAGE_BIN"
+-
+-./libtool --mode=install install gap "$SAGE_DESTDIR$SAGE_BIN/gap-bin" || \
+-    sdh_die "Failed to install gap-bin to $SAGE_BIN"
+-
+-./libtool --mode=install install gac "$SAGE_DESTDIR$SAGE_BIN/gac" || \
+-    sdh_die "Failed to install gac to $SAGE_BIN"
+-
+-# Now copy additional files GAP needs to run (and a few optional bits) into
+-# GAP_ROOT; we don't need everything from the source tree
+-sdh_install bin doc gen grp lib src tst sysinfo.gap "$GAP_ROOT"
+-
+-# GAP's copy of libtool is also used by the toolchain for build GAP packages
+-# (i.e. by gac)
+-sdh_install libtool "$GAP_ROOT"
++sdh_make_install
++# sdh_make install-headers install-libgap
++# The 'packagemanager' package expects this https://github.com/gap-packages/PackageManager/issues/105
++mkdir -p "$SAGE_LOCAL/lib/gap/bin"
+ 
+ # Install only the minimal packages GAP needs to run
+-sdh_install pkg/GAPDoc-* pkg/primgrp-* pkg/SmallGrp-* pkg/transgrp "$GAP_ROOT"/pkg
++sdh_install pkg/gapdoc pkg/primgrp pkg/smallgrp pkg/transgrp "$GAP_ROOT"/pkg
+ 
+ # Install additional packages that are not strictly required, but that are
+ # typically "expected" to be loaded: These are the default packages that are
+@@ -58,50 +37,25 @@ sdh_install pkg/GAPDoc-* pkg/primgrp-* pkg/SmallGrp-* pkg/transgrp "$GAP_ROOT"/p
+ # Also include atlasrep which is a dependency of tomlib
+ sdh_install \
+     pkg/atlasrep \
+-    pkg/autpgrp-* \
+-    pkg/alnuth-* \
+-    pkg/crisp-* \
+-    pkg/ctbllib-* \
+-    pkg/FactInt-* \
++    pkg/autodoc \
++    pkg/autpgrp \
++    pkg/alnuth \
++    pkg/crisp \
++    pkg/ctbllib \
++    pkg/factint \
+     pkg/fga \
+-    pkg/irredsol-* \
+-    pkg/laguna-* \
+-    pkg/PackageManager-* \
+-    pkg/polenta-* \
+-    pkg/polycyclic-* \
+-    pkg/resclasses-* \
+-    pkg/sophus-* \
+-    pkg/tomlib-* \
++    pkg/irredsol \
++    pkg/laguna \
++    pkg/packagemanager \
++    pkg/polenta \
++    pkg/polycyclic \
++    pkg/radiroot \
++    pkg/resclasses \
++    pkg/sophus \
++    pkg/tomlib \
++    pkg/utils \
+     "$GAP_ROOT"/pkg
+ 
+-# Install the GAP startup script; ensure it is executable
+-sdh_install -T ../gap "$SAGE_BIN/gap"
+-chmod +x "$SAGE_DESTDIR$SAGE_BIN/gap"
+-
+-# Create symlinks under $GAP_ROOT for these executables, as they are expected
+-# (especially when building kernel packages) to exist
+-ln -sf "../../bin/gap-bin" "$DESTDIR_GAP_ROOT/gap"
+-ln -sf "../../bin/gac" "$DESTDIR_GAP_ROOT/gac"
+-
+-# Fix the $GAP_ROOT/bin/<arch>/src symlink to be relative (otherwise it links
+-# to the actual path of the sources GAP was compiled from)
+-for srclink in "$DESTDIR_GAP_ROOT"/bin/*/src; do
+-    rm -f "$srclink"
+-    ln -s "../../src" "$srclink"
+-done
+-
+-# Additional fixups for some files after they have been copied into their
+-# destination directory.  gac and sysinfo.gap are generated files that contain
+-# in them hard-coded references to the GAP build directory, which will soon
+-# be going away.  This breaks the build toolchain for some compiled GAP
+-# packages.  We need to replace these paths with the final GAP_ROOT path.  The
+-# below will work so long as neither of these paths contain '|', and if they do
+-# then god help you.  https://trac.sagemath.org/ticket/27218
+-sed -i -e "s|$GAP_BUILD_ROOT|$GAP_ROOT|g" \
+-    "$SAGE_DESTDIR$SAGE_BIN/gac" "$DESTDIR_GAP_ROOT/sysinfo.gap" \
+-    "$DESTDIR_GAP_ROOT/bin/gap.sh" "$DESTDIR_GAP_ROOT/doc/make_doc" || \
+-    sdh_die "Failed to fix up hard-coded paths in GAP build tools."
+-
+ # TODO: This seems unnecessary--we are already installing all of doc/ to
+ # GAP_ROOT, which is necessary for some functionality in GAP to work.  Do
+ # we need this?  Maybe doc/gap could just be a symlink to gap/doc??
+diff --git a/build/pkgs/gap/spkg-legacy-uninstall b/build/pkgs/gap/spkg-legacy-uninstall
+index d17eb939eb7..a8e5c59e1fb 100755
+--- a/build/pkgs/gap/spkg-legacy-uninstall
++++ b/build/pkgs/gap/spkg-legacy-uninstall
+@@ -4,6 +4,8 @@ rm -rf "$SAGE_LOCAL/gap/gap-4."*
+ rm -rf "$SAGE_SHARE/gap"
+ rm -f "$SAGE_LOCAL/gap/latest"
+ rm -f "$SAGE_LOCAL/bin/gap"
++rm -f "$SAGE_LOCAL/bin/gac"
+ 
+-# Remove old libgap headers
++# Remove old libgap headers and library
+ rm -rf "$SAGE_LOCAL/include/gap"
++rm -rf "$SAGE_LOCAL/lib/gap"
+diff --git a/build/pkgs/gap/spkg-prerm.in b/build/pkgs/gap/spkg-prerm.in
+deleted file mode 100644
+index 661d92621fa..00000000000
+--- a/build/pkgs/gap/spkg-prerm.in
++++ /dev/null
+@@ -1,6 +0,0 @@
+-# These generated files are placed in directory provided by the SPKG, so
+-# delete the generated files first so that their parent directories can be
+-# removed during installation
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
+-rm -f "$GAP_ROOT/pkg/atlasrep/datagens/"*.*
+-rm -f "$GAP_ROOT/pkg/atlasrep/dataword/"*.*
+diff --git a/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch b/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch
+deleted file mode 100644
+index e45fe7d9c6f..00000000000
+--- a/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch
++++ /dev/null
+@@ -1,150 +0,0 @@
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c b/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-index 3bbdc45..7df699f 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-@@ -8,9 +8,8 @@ extern short sp[],**mat[],*psp[],**imcos[],**cpco[],lorb[],
+- short *cst,**cpst,***cdpst,**svptr,*cp,*rel;
+- short *spst,**pspst,**pptr,**cpptr,npt,nb,nph,nph2,npg,npg2,
+-       rno,orno,coh_index,*invg;
+--FILE  *ip,*op;
+- 
+--void seeknln (void) { while (getc(ip)!='\n'); }
+-+void seeknln (FILE *ip) { while (getc(ip)!='\n'); }
+- 
+- /* This program differs from most other permutation programs in that perms are
+-    all stored in the single array sp. Schreier vectors are stored in the short
+-@@ -23,13 +22,14 @@ void seeknln (void) { while (getc(ip)!='\n'); }
+- int 
+- crprog1 (void)
+- { short *pc,*qc,ex,neg; int x;
+-+  FILE  *ip,*op;
+-   short i,j,k,l,m,n,cl,rl,*p,ocl,im,pt,pt1,pn,ipt;
+-   if ((ip=fopen(inf2,"r"))== 0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf2); return(-1);}
+-   fscanf(ip,"%hd%hd%hd%hd",&npt,&nph,&nb,&k);
+-   if (nb>=mb) {fprintf(stderr,"nb too big. Increase MB.\n"); return(-1);}
+-   if (k<=2) {fprintf(stderr,"inf2 has illegal format.\n"); return(-1); }
+--  seeknln(); seeknln();
+-+  seeknln(ip); seeknln(ip);
+-   for (i=1;i<=nb;i++) fscanf(ip,"%hd",lorb+i);
+-   pptr=psp-1; pspst=psp+nph; svptr=cpsp-1;  cpst=cpsp+nb;
+-   invg=sp; nph2=2*nph; spst=sp+nph2;
+-@@ -37,7 +37,7 @@ crprog1 (void)
+-   { pptr[i]=spst+(i-1)*npt-1; p=pptr[i];
+-     for (j=1;j<=npt;j++) {fscanf(ip,"%hd",&k); p[k]=j; }
+-     invg[2*i-2]=2*i-1; invg[2*i-1]=2*i-2;
+--    seeknln();
+-+    seeknln(ip);
+-   }
+-   spst+=(npt*nph);
+-   for (i=1;i<=nb;i++)
+-@@ -75,7 +75,7 @@ crprog1 (void)
+-   strcpy(inf1,inf0); strcat(inf1,".rel");
+-   if ((ip=fopen(inf1,"r"))==0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf1); return(-1);}
+--  fscanf(ip,"%hd%hd",&k,&rno); seeknln();
+-+  fscanf(ip,"%hd%hd",&k,&rno); seeknln(ip);
+-   op=fopen(outft,"w");
+- /* Now we have read everything in, and the computation can start */
+-   orno=0;
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-index a7396b2..658496f 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-@@ -20,8 +20,6 @@ short  mexp=MEXP,mcl=MCL,no,rel[RSP],wt[MEXP],exp,*rpf,*rpb,
+- extern short  prime,dim,*spv,**spm,mspace[],*vec[],**mat[],cp[],pinv[],opmats,
+-         mm,mv;
+- extern int msp;
+--FILE *ip,*op;
+--
+- 
+- int 
+- calcmats (void)
+-@@ -59,7 +57,7 @@ calcmats (void)
+-   }
+-   for (i=1;i<=exp;i++) trans(mat[i+exp],mat[i]);
+-   if (opmats)
+--  { op=fopen(outf,"w");
+-+  { FILE *op=fopen(outf,"w");
+-     fprintf(op,"%4d%4d%4d\n",prime,dim,exp);
+-     for (i=1;i<=exp;i++) printmat(mat[i]); 
+-     fclose(op);
+-@@ -71,6 +69,7 @@ int
+- rdmats (void)
+- /* reads matrices of generators of P */
+- { short i; int quot;
+-+  FILE *ip;
+-   ip=fopen(inf4,"r");
+-   if (ip==0)
+-   { fprintf(stderr,"Cannot open %s\n ",inf4); return(-1); }
+-@@ -90,12 +89,12 @@ rdmats (void)
+-   fclose(ip);
+-   return(0);
+- }
+--FILE *ip;
+- 
+- int 
+- ingp (int inp)
+- /* Read in output of respcrun -s */
+- { short i,j,k,l,m,*orpf,**pcp;
+-+  FILE *ip;
+-   ip=fopen(inf3,"r");
+-   if (ip==0) { fprintf(stderr,"Cannot open %s\n",inf3); return(-1); }
+-   fscanf(ip,"%hd%hd%hd%hd%hd%hd",&prime,&exp,&i,&no,&j,&m);
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-index 0896551..6841bc8 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-@@ -9,7 +9,6 @@ extern short  intexp,mexp,mng,wksp,
+-        spugen[],*tlintg[];
+- extern int ptrsp,rsp;
+- short  fac;
+--FILE *ip,*op;
+- 
+- int 
+- ingp (void)
+-@@ -18,6 +17,7 @@ ingp (void)
+-    of nqrun, and tails are also read in.
+- */
+- { short i,j,k,l,m,x,y,no,*orpf,*orpb,**pcp;  char tails;
+-+  FILE *ip;
+-   if ((ip=fopen(inf1,"r"))==0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf1); return(-1); }
+-   fscanf(ip,"%hd%hd%hd%hd%hd%hd",&prime,&exp,&nng,&no,&class,&m);
+-@@ -89,6 +89,7 @@ int
+- outgp (void)
+- /* The PCP is output, together with tails */
+- { short i,k,l,**pcp,*b,*e,*c;
+-+  FILE *op;
+-   op=fopen(outf,"w");
+-   fprintf(op,"%4d%4d%4d%4d%4d%4d\n",prime,exp,nng,exp,class,1);
+-   for (i=1;i<=exp;i++) fprintf(op,"%4d",wt[i]); fprintf(op,"\n");
+-@@ -379,7 +380,7 @@ restart:
+-     nng--; mnng--; enexpnt--;
+-     if (nng==0)
+-     { if (gap)
+--      { op=fopen(outfm,"w"); fprintf(op,"COHOMOLO.Multiplier:=[];\n");
+-+      { FILE *op=fopen(outfm,"w"); fprintf(op,"COHOMOLO.Multiplier:=[];\n");
+-         fclose(op);
+-         printf("All new generators eliminated. Multiplier is trivial.\n");
+-       }
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-index 01cf914..0144883 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-@@ -9,7 +9,6 @@ extern short  intexp,mng,mexp,wksp,
+-        spugen[],*intg[],*imintg[],*tlintg[];
+- extern int ptrsp,rsp;
+- short  *wf,*wc; char norm;
+--FILE *ip,*op;
+- 
+- /* The data structures for this program and for nqrun are similar.
+-    d1 and d2 contain definitions of generators. (Def. comes from commutator
+-@@ -35,6 +34,7 @@ nqmprog (void)
+- { short i,j,k,l,m,d,*gi,*gj,*ti,*tj,cl,def,*ps,*pf,**dp,*nrpb,*p,*orpf,*orpb,
+-         nb,np,k1,*rno,*covrel,**pgen,tdef,sgn;
+-   char nt;
+-+  FILE *ip,*op;
+-   if (ingp() == -1) {fprintf(stderr,"Input error.\n"); return(-1); }
+-   eexpnt=expnt+exp; enexpnt=nexpnt+nng;
+- 
+diff --git a/build/pkgs/gap_packages/patches/guava_leon_includes.patch b/build/pkgs/gap_packages/patches/guava_leon_includes.patch
+deleted file mode 100644
+index cdcd19cc3e8..00000000000
+--- a/build/pkgs/gap_packages/patches/guava_leon_includes.patch
++++ /dev/null
+@@ -1,13 +0,0 @@
+---- a/pkg/guava-3.15/src/leon/src/generate.c	Sat Feb 29 09:02:10 2020
+---- b/pkg/guava-3.15/src/leon/src/generate.c	Thu Sep 24 13:58:36 2020
+-***************
+-*** 115,120 ****
+---- 115,122 ----
+-  #include "groupio.h"
+-  #include "enum.h"
+-  #include "storage.h"
+-+ #include "chbase.h"
+-+ #include "inform.h"
+-  
+-  #ifdef ALT_TIME_HEADER
+-  #include "cputime.h"
+diff --git a/build/pkgs/gap_packages/spkg-install.in b/build/pkgs/gap_packages/spkg-install.in
+index 168e6b11532..6dff182a48f 100644
+--- a/build/pkgs/gap_packages/spkg-install.in
++++ b/build/pkgs/gap_packages/spkg-install.in
+@@ -1,4 +1,4 @@
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
++GAP_ROOT="$SAGE_LOCAL/lib/gap"
+ PKG_DIR="$GAP_ROOT/pkg"
+ 
+ PKG_SRC_DIR="$(pwd)/src/pkg"
+@@ -11,33 +11,31 @@ cd "$PKG_SRC_DIR"
+ #    (GAP 4.8.6 still had it, but this is gone in 4.10)
+ 
+ sdh_install \
+-    aclib-* \
+-    AutoDoc-* \
+-    corelg-* \
+-    crime-* \
++    aclib \
++    corelg \
++    crime \
+     cryst \
+     crystcat \
+-    design-* \
++    design \
+     gbnp \
+-    genss-* \
+-    hap-* \
+-    hapcryst-* \
+-    hecke-* \
+-    images-* \
+-    liealgdb-* \
+-    liepring-* \
+-    liering-* \
+-    loops-* \
+-    MapClass-* \
+-    polymaking-* \
+-    qpa-* \
+-    quagroup-* \
+-    radiroot-* \
+-    repsn-* \
+-    sla-* \
+-    sonata-* \
+-    Toric-* \
+-    utils-* \
++    genss \
++    hap \
++    hapcryst \
++    hecke \
++    images \
++    liealgdb \
++    liepring \
++    liering \
++    loops \
++    mapclass \
++    polymaking \
++    qpa \
++    quagroup \
++    repsn \
++    singular \
++    sla \
++    sonata \
++    toric \
+     "$PKG_DIR"
+ 
+ install_compiled_pkg()
+@@ -45,27 +43,23 @@ install_compiled_pkg()
+     local pkg="$1"
+     # Install the bin/ dir (where compiled modules should end up)
+     # under <prefix>/lib/gap; we then symlink to it later
+-    sdh_install bin "$SAGE_LOCAL/lib/gap/pkg/$pkg"
++    sdh_install * "$SAGE_LOCAL/lib/gap/pkg/$pkg"
+ 
++    # TODO:
+     # Clean up any build artificts before installing the rest of the package
+     # Also remove configure/Makefiles
+     # Note: None, if any of the packages really have a proper install target
+-    make clean  # Works for some packages but not all
+-    rm -rf bin/
+-    rm -rf configure configure.* config.* autogen.sh *.m4 Makefile* m4/
++    #make clean  # Works for some packages but not all
++    #rm -rf bin/
++    #rm -rf configure configure.* config.* autogen.sh *.m4 Makefile* m4/
+ 
+-    # Create the bin/ symlink
+-    ln -s "$SAGE_LOCAL/lib/gap/pkg/$pkg/bin" bin
+-
+-    # Install the rest of the package files
+-    sdh_install * "$PKG_DIR/$pkg"
+ }
+ 
+ # Build and install compiled packages:
+ #
+ # These packages have an old ./configure that take the GAP_ROOT as a positional
+ # argument
+-for pkg in cohomolo-* crypting-* grape-* guava-* orb-* datastructures-*
++for pkg in cohomolo crypting grape guava orb datastructures
+ do
+     echo "Building GAP package $pkg"
+     CFLAGS="$CFLAGS -Wno-implicit-function-declaration"
+@@ -91,7 +85,7 @@ pararr=( " " " " "--with-external-planarity" "--with-external-libsemigroups" )
+ ##############################################################################
+ 
+ parind=0
+-for pkg in nq-* io-* digraphs-* semigroups-*
++for pkg in nq io digraphs semigroups
+ do
+     echo "Building GAP package $pkg"
+     cd "$PKG_SRC_DIR/$pkg"
+diff --git a/build/pkgs/libsemigroups/checksums.ini b/build/pkgs/libsemigroups/checksums.ini
+index 62c4268515f..4e13a36cb35 100644
+--- a/build/pkgs/libsemigroups/checksums.ini
++++ b/build/pkgs/libsemigroups/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=libsemigroups-VERSION.tar.gz
+-sha1=2b16c095cc5ffd3f77a71dfbf48cce188e054c03
+-md5=7082cadcf7a195ccb93175cd72b6db95
+-cksum=1501022358
++sha1=86375824b47ce4b0e23570122e873f67136d0c0a
++md5=ff79ad5fbc8bfeb64d48faaf24106b98
++cksum=2845045455
+ upstream_url=https://github.com/libsemigroups/libsemigroups/releases/download/vVERSION/libsemigroups-VERSION.tar.gz
+diff --git a/build/pkgs/libsemigroups/package-version.txt b/build/pkgs/libsemigroups/package-version.txt
+index 9084fa2f716..f90b1afc082 100644
+--- a/build/pkgs/libsemigroups/package-version.txt
++++ b/build/pkgs/libsemigroups/package-version.txt
+@@ -1 +1 @@
+-1.1.0
++2.3.2
+diff --git a/build/pkgs/libsemigroups/spkg-install.in b/build/pkgs/libsemigroups/spkg-install.in
+index 2aaf0e99043..128b54d2f99 100644
+--- a/build/pkgs/libsemigroups/spkg-install.in
++++ b/build/pkgs/libsemigroups/spkg-install.in
+@@ -1,4 +1,4 @@
+ cd src
+-sdh_configure
++sdh_configure --disable-eigen
+ sdh_make
+ sdh_make_install
+diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4
+index d4d145defe3..6a85631f624 100644
+--- a/build/pkgs/singular/spkg-configure.m4
++++ b/build/pkgs/singular/spkg-configure.m4
+@@ -9,52 +9,7 @@ SAGE_SPKG_CONFIGURE([singular], [
+        AC_MSG_CHECKING([that Singular's help is working])
+        AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error occurred"` = x], [
+         AC_MSG_RESULT(yes)
+-        dnl We have Singular. Now determine the shared library path on
+-        dnl platforms on which sage.libs.singular needs to reload the library with RTLD_GLOBAL.
+-        AS_CASE([$host_os],
+-          [cygwin*], [dnl Nothing to do
+-                     ],
+-                     [dnl Use pkg-config to get singular's libdir while we're at it. As a
+-                      dnl moral compromise for using pkg-config, this ultimately allows us
+-                      dnl to pass an absolute path to dlopen(), which is the only approach
+-                      dnl that POSIX guarantees will work.
+-                      PKG_CHECK_VAR([SINGULAR_LIB_DIR], [Singular], [libdir])
+-                      dnl The acl_shlibext variable is set in the top-level configure.ac.
+-                      AC_LANG_PUSH(C)
+-                      ORIG_LIBS="${LIBS}"
+-                      LIBS="${LIBS} -ldl"
+-                      AC_MSG_CHECKING([if we can dlopen($LIBSINGULAR_PATH)])
+-                      LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libSingular.${acl_shlibext}"
+-
+-                      dnl if we can dlopen() it, substitute the name for sage_conf;
+-                      dnl otherwise, fall back to using the SPKG.
+-                      AC_RUN_IFELSE(
+-                        [AC_LANG_PROGRAM(
+-                          [[#include <dlfcn.h>]],
+-                          [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
+-                            if (h == 0) { return 1; } else { return dlclose(h); }]]
+-                        )], [
+-                          AC_MSG_RESULT(yes)
+-                        ], [
+-                          dnl try Debian-specific name
+-                          LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libsingular-Singular.${acl_shlibext}"
+-                          AC_RUN_IFELSE(
+-                           [AC_LANG_PROGRAM(
+-                             [[#include <dlfcn.h>]],
+-                             [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
+-                               if (h == 0) { return 1; } else { return dlclose(h); }]]
+-                           )], [
+-                             AC_MSG_RESULT(yes)
+-                           ], [
+-                            AC_MSG_RESULT(no)
+-                            sage_spkg_install_singular=yes
+-                          ], [AC_MSG_RESULT(yes)])
+-                        ], [AC_MSG_RESULT(yes)])
+-
+-                      AC_LANG_POP()
+-                      LIBS="${ORIG_LIBS}"
+-                     ]
+-       )], [
++       ], [
+        AC_MSG_RESULT(no)
+        sage_spkg_install_singular=yes
+        ]
+@@ -64,20 +19,4 @@ SAGE_SPKG_CONFIGURE([singular], [
+       ])
+     ])
+   ])
+-],[],[],[
+-  dnl Post-check phase
+-  dnl We make the sage_conf substitutions here, because the "default"
+-  dnl substitution needs to be made even if we skipped the system-Singular
+-  dnl checks themselves.
+-  AS_IF([test "x${sage_spkg_install_singular}" = "xyes"], [
+-    AS_CASE([$host_os],
+-      [cygwin*], [dnl Nothing to do
+-                 ],
+-                 [dnl Set shared library path, needed for reloading the library with RTLD_GLOBAL
+-                  LIBSINGULAR_PATH="\$SAGE_LOCAL/lib/libSingular.${acl_shlibext}"
+-                 ]
+-    )
+-  ])
+-
+-  AC_SUBST(LIBSINGULAR_PATH, "${LIBSINGULAR_PATH}")
+ ])
+diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in
+index 6cd28f558a8..d66bdb3d264 100644
+--- a/pkgs/sage-conf/_sage_conf/_conf.py.in
++++ b/pkgs/sage-conf/_sage_conf/_conf.py.in
+@@ -55,9 +55,6 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"
+ OPENMP_CFLAGS = "@OPENMP_CFLAGS@"
+ OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"
+ 
+-# The full absolute path to the main Singular library.
+-LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)
+-
+ # Installation location of wheels. This is determined at configuration time
+ # and does not depend on the installation location of sage-conf.
+ SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels"
+diff --git a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
+index c917338e444..182e74aad20 100644
+--- a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
++++ b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
+@@ -139,12 +139,12 @@ string, which you can print::
+     X.1      1  1  1  1  1  1  1  1  1  1  1  1  1
+     X.2      1 -1  1  1 -1  1  1 -1 -1 -1  1  1  1
+     X.3      2  .  2 -1  .  2  2  .  .  . -1  2  2
+-    X.4      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
+-    X.5      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
+-    X.6      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
+-    X.7      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
+-    X.8      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
+-    X.9      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
++    X.4      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
++    X.5      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
++    X.6      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
++    X.7      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
++    X.8      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
++    X.9      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
+     X.10     4 -2  . -1  .  .  .  2  .  .  1  . -4
+     X.11     4  2  . -1  .  .  . -2  .  .  1  . -4
+     X.12     6  . -2  .  . -2 -2  .  .  .  .  2  6
+diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx
+index de5db985e0b..c83b9264e44 100644
+--- a/src/sage/coding/codecan/autgroup_can_label.pyx
++++ b/src/sage/coding/codecan/autgroup_can_label.pyx
+@@ -76,7 +76,7 @@ columns do share the same coloring::
+     ((1,),
+      (2,),
+      (3, 5, 4),
+-     (6, 19, 16, 9, 21, 10, 8, 15, 14, 11, 20, 13, 12, 7, 17, 18))
++     (6, 19, 16, 21, 9, 10, 15, 8, 20, 11, 14, 13, 7, 12, 18, 17))
+ 
+ We can also restrict the group action to linear isometries::
+ 
+diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py
+index a3ac3ca1547..bfb9f8696e8 100644
+--- a/src/sage/coding/linear_code.py
++++ b/src/sage/coding/linear_code.py
+@@ -465,27 +465,27 @@ def automorphism_group_gens(self, equivalence="semilinear"):
+             0
+             sage: C = codes.HammingCode(GF(4, 'z'), 3)
+             sage: C.automorphism_group_gens()
+-            ([((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
++            ([((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
++                Defn: z |--> z + 1),
++              ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z + 1),
+-              ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
+-                Defn: z |--> z),
+               ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+              362880)
+             sage: C.automorphism_group_gens(equivalence="linear")
+-            ([((z + 1, 1, z + 1, z + 1, z + 1, z, 1, z, 1, 1, 1, 1, z + 1, z + 1, z + 1, z, z, 1, z, z, z); (1,15,2,8,16,18,3)(4,9,12,13,20,10,11)(5,21,14,6,7,19,17), Ring endomorphism of Finite Field in z of size 2^2
++            ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((z + 1, z + 1, z + 1, z + 1, z + 1, 1, z, 1, z, z, z, 1, z, 1, 1, 1, z + 1, z + 1, z + 1, 1, z); (1,15,21,8,9)(2,18,5,3,11,16,7,10,19,13,12,4,17,6,20), Ring endomorphism of Finite Field in z of size 2^2
++              ((z + 1, z + 1, z + 1, z, 1, 1, z, z, 1, z + 1, z, 1, 1, z, 1, z + 1, z, z + 1, z + 1, 1, z); (1,3,18,2,17,6,19)(4,15,13,20,7,14,16)(5,11,8,21,12,9,10), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+               ((z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1); (), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+              181440)
+             sage: C.automorphism_group_gens(equivalence="permutational")
+-            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
++            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
++              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,18)(3,19)(4,10)(5,16)(8,13)(9,14)(11,21)(15,20), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,17)(2,8)(3,14)(4,10)(7,12)(9,19)(13,18)(15,20), Ring endomorphism of Finite Field in z of size 2^2
++              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+               ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,13)(3,14)(4,20)(5,11)(8,18)(9,19)(10,15)(16,21), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+@@ -691,10 +691,10 @@ def _canonize(self, equivalence):
+             sage: C_iso == aut_group_can_label.get_canonical_form()
+             True
+             sage: aut_group_can_label.get_autom_gens()
+-            [((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
++            [((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
++               Defn: z |--> z + 1),
++             ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
+                Defn: z |--> z + 1),
+-             ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
+-               Defn: z |--> z),
+              ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
+                Defn: z |--> z)]
+         """
+diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py
+index 2836d59d960..8c882d5ac3b 100644
+--- a/src/sage/combinat/posets/posets.py
++++ b/src/sage/combinat/posets/posets.py
+@@ -8813,7 +8813,7 @@ def _libgap_(self):
+             sage: libgap(P)  # optional - gap_packages
+             <A poset on 5 points>
+             sage: A = libgap(GF(2)).PosetAlgebra(P); A  # optional - gap_packages
+-            <GF(2)[<quiver with 5 vertices and 5 arrows>]/<two-sided ideal in <GF(2)[<quiver with 5 vertices and 5 arrows>]>, (1 generators)>>
++            <GF(2)[<quiver with 5 vertices and 5 arrows>]/<two-sided ideal in <GF(2)[<quiver with 5 vertices and 5 arrows>]>, (1 generator)>>
+             sage: A.Dimension()  # optional - gap_packages
+             13
+         """
+diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py
+index 6b756bafc30..8ac99319bec 100644
+--- a/src/sage/combinat/root_system/hecke_algebra_representation.py
++++ b/src/sage/combinat/root_system/hecke_algebra_representation.py
+@@ -357,7 +357,7 @@ def Tw(self, word, signs=None, scalar=None):
+             sage: q1, q2 = K.gens()
+             sage: KW = W.algebra(K)
+             sage: x = KW.an_element(); x
+-            123 + 3*32 + 2*3 + e
++            123 + 3*2312 + 2*31 + e
+ 
+             sage: T = KW.demazure_lusztig_operators(q1,q2)
+             sage: T12 = T.Tw( (1,2) )
+diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py
+index b8a0bebab44..9bccba124c8 100644
+--- a/src/sage/combinat/symmetric_group_algebra.py
++++ b/src/sage/combinat/symmetric_group_algebra.py
+@@ -101,7 +101,7 @@ def SymmetricGroupAlgebra(R, W, category=None):
+         sage: SGA.group()
+         Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space)
+         sage: SGA.an_element()
+-        s1*s2*s3 + 3*s3*s2 + 2*s3 + 1
++        s1*s2*s3 + 3*s2*s3*s1*s2 + 2*s3*s1 + 1
+ 
+     The preferred way to construct the symmetric group algebra is to
+     go through the usual ``algebra`` method::
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 911f34b1bc6..5f7aca8599c 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -197,7 +197,8 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ GRAPHS_DATA_DIR = var("GRAPHS_DATA_DIR", join(SAGE_SHARE, "graphs"))
+ ELLCURVE_DATA_DIR = var("ELLCURVE_DATA_DIR", join(SAGE_SHARE, "ellcurves"))
+ POLYTOPE_DATA_DIR = var("POLYTOPE_DATA_DIR", join(SAGE_SHARE, "reflexive_polytopes"))
+-GAP_ROOT_DIR = var("GAP_ROOT_DIR", join(SAGE_SHARE, "gap"))
++GAP_LIB_DIR = var("GAP_LIB_DIR", join(SAGE_LOCAL, "lib", "gap"))
++GAP_SHARE_DIR = var("GAP_SHARE_DIR", join(SAGE_SHARE, "gap"))
+ THEBE_DIR = var("THEBE_DIR", join(SAGE_SHARE, "thebe"))
+ COMBINATORIAL_DESIGN_DATA_DIR = var("COMBINATORIAL_DESIGN_DATA_DIR", join(SAGE_SHARE, "combinatorial_designs"))
+ CREMONA_MINI_DATA_DIR = var("CREMONA_MINI_DATA_DIR", join(SAGE_SHARE, "cremona"))
+@@ -229,12 +230,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ LIE_INFO_DIR = var("LIE_INFO_DIR", join(SAGE_LOCAL, "lib", "LiE"))
+ SINGULAR_BIN = var("SINGULAR_BIN") or "Singular"
+ 
+-# The path to libSingular, to be passed to dlopen(). This will
+-# typically be set to an absolute path in sage_conf, but the relative
+-# fallback path here works on systems where dlopen() searches the
+-# system's library locations.
+-LIBSINGULAR_PATH = var("LIBSINGULAR_PATH", "libSingular.so")
+-
+ # OpenMP
+ OPENMP_CFLAGS = var("OPENMP_CFLAGS", "")
+ OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
+@@ -255,81 +250,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ SAGE_GAP_COMMAND = var('SAGE_GAP_COMMAND', _gap_cmd)
+ 
+ 
+-def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+-    """
+-    Return the full path to a shared library file installed in
+-    ``$SAGE_LOCAL/lib`` or the directories associated with the
+-    Python sysconfig.
+-
+-    This can also be passed more than one library name (e.g. for cases where
+-    some library may have multiple names depending on the platform) in which
+-    case the first one found is returned.
+-
+-    This supports most *NIX variants (in which ``lib<libname>.so`` is found
+-    under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
+-    extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
+-    or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
+-
+-    For distributions like Debian that use a multiarch layout, we also try the
+-    multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
+-
+-    This returns ``None`` if no matching library file could be found.
+-
+-    EXAMPLES::
+-
+-        sage: from sage.env import _get_shared_lib_path
+-        sage: "gap" in _get_shared_lib_path("gap")
+-        True
+-        sage: _get_shared_lib_path("an_absurd_lib") is None
+-        True
+-
+-    """
+-
+-    for libname in libnames:
+-        search_directories: List[Path] = []
+-        patterns: List[str] = []
+-        if sys.platform == 'cygwin':
+-            # Later down we take the first matching DLL found, so search
+-            # SAGE_LOCAL first so that it takes precedence
+-            if SAGE_LOCAL:
+-                search_directories.append(Path(SAGE_LOCAL) / 'bin')
+-            search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
+-            # Note: The following is not very robust, since if there are multible
+-            # versions for the same library this just selects one more or less
+-            # at arbitrary. However, practically speaking, on Cygwin, there
+-            # will only ever be one version
+-            patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
+-        else:
+-            if sys.platform == 'darwin':
+-                ext = 'dylib'
+-            else:
+-                ext = 'so'
+-
+-            if SAGE_LOCAL:
+-                search_directories.append(Path(SAGE_LOCAL) / 'lib')
+-            libdir = sysconfig.get_config_var('LIBDIR')
+-            if libdir is not None:
+-                libdir = Path(libdir)
+-                search_directories.append(libdir)
+-
+-                multiarchlib = sysconfig.get_config_var('MULTIARCH')
+-                if multiarchlib is not None:
+-                    search_directories.append(libdir / multiarchlib),
+-
+-            patterns = [f'lib{libname}.{ext}']
+-
+-        for directory in search_directories:
+-            for pattern in patterns:
+-                path = next(directory.glob(pattern), None)
+-                if path is not None:
+-                    return str(path.resolve())
+-
+-    # Just return None if no files were found
+-    return None
+-
+-# locate libgap shared object
+-GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
+-
+ # post process
+ if DOT_SAGE is not None and ' ' in DOT_SAGE:
+     if UNAME[:6] == 'CYGWIN':
+diff --git a/src/sage/groups/abelian_gps/abelian_group_gap.py b/src/sage/groups/abelian_gps/abelian_group_gap.py
+index a4b047113c5..86090b43535 100644
+--- a/src/sage/groups/abelian_gps/abelian_group_gap.py
++++ b/src/sage/groups/abelian_gps/abelian_group_gap.py
+@@ -338,7 +338,7 @@ def _element_constructor_(self, x, check=True):
+         if isinstance(x, AbelianGroupElement_gap):
+             try:
+                 if x in self._cover:
+-                    x = self.gap().NaturalHomomorphism().Image(x.gap())
++                    x = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations).Image(x.gap())
+                 else:
+                     x = x.gap()
+             except AttributeError:
+@@ -1043,7 +1043,7 @@ def natural_homomorphism(self):
+             From: Abelian group with gap, generator orders (4,)
+             To:   Quotient abelian group with generator orders (2,)
+         """
+-        phi = self.gap().NaturalHomomorphism()
++        phi = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations)
+         Hom = self._cover.Hom(self)
+         return Hom(phi)
+ 
+diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
+index 8d6e443683c..1beb01af87f 100644
+--- a/src/sage/groups/finitely_presented.py
++++ b/src/sage/groups/finitely_presented.py
+@@ -596,9 +596,9 @@ def gap(self):
+             sage: k = G.rewriting_system()
+             sage: k.gap()
+             Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules
+-            [ [ a^2, <identity ...> ], [ a*A, <identity ...> ],
+-              [ A*a, <identity ...> ], [ b^2, <identity ...> ],
+-              [ b*B, <identity ...> ], [ B*b, <identity ...> ] ]
++            [ [ a*A, <identity ...> ], [ A*a, <identity ...> ],
++              [ b*B, <identity ...> ], [ B*b, <identity ...> ],
++              [ a^2, <identity ...> ], [ b^2, <identity ...> ] ]
+         """
+         return self._gap
+ 
+diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
+index 7fc4dbe7548..e5eccd45942 100644
+--- a/src/sage/groups/fqf_orthogonal.py
++++ b/src/sage/groups/fqf_orthogonal.py
+@@ -143,7 +143,7 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
+         [2/3   0   0]
+         [  0 2/3   0]
+         [  0   0 4/3]
+-        generated by 2 elements
++        generated by 3 elements
+         sage: q = matrix.diagonal(QQ, [3/2, 1/4, 1/4])
+         sage: T = TorsionQuadraticForm(q)
+         sage: T.orthogonal_group().order()
+diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx
+index d25121aa792..dc81b71635b 100644
+--- a/src/sage/groups/libgap_wrapper.pyx
++++ b/src/sage/groups/libgap_wrapper.pyx
+@@ -25,7 +25,7 @@ Note how we call the constructor of both superclasses to initialize
+ its output via LibGAP::
+ 
+     sage: FooGroup()
+-    <pc group of size 3 with 1 generators>
++    <pc group of size 3 with 1 generator>
+     sage: type(FooGroup().gap())
+     <class 'sage.libs.gap.element.GapElement'>
+ 
+@@ -106,7 +106,7 @@ class ParentLibGAP(SageObject):
+         ....:         ParentLibGAP.__init__(self, lg)
+         ....:         Group.__init__(self)
+         sage: FooGroup()
+-        <pc group of size 3 with 1 generators>
++        <pc group of size 3 with 1 generator>
+     """
+ 
+     def __init__(self, libgap_parent, ambient=None):
+@@ -461,7 +461,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement):
+         ....:         ParentLibGAP.__init__(self, lg)
+         ....:         Group.__init__(self)
+         sage: FooGroup()
+-        <pc group of size 3 with 1 generators>
++        <pc group of size 3 with 1 generator>
+         sage: FooGroup().gens()
+         (f1,)
+     """
+diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py
+index a6d3dc02513..63956ad5f10 100644
+--- a/src/sage/groups/matrix_gps/finitely_generated.py
++++ b/src/sage/groups/matrix_gps/finitely_generated.py
+@@ -563,9 +563,6 @@ def as_permutation_group(self, algorithm=None, seed=None):
+             21499084800
+             sage: P = G.as_permutation_group()
+             sage: Psmaller = G.as_permutation_group(algorithm="smaller", seed=6)
+-            sage: P == Psmaller  # see the note below
+-            True
+-            sage: Psmaller = G.as_permutation_group(algorithm="smaller")
+             sage: P == Psmaller
+             False
+             sage: P.cardinality()
+diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
+index f2ccca042ac..47d6862333c 100644
+--- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
++++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
+@@ -427,7 +427,7 @@ cdef class LabelledBranching:
+             sage: from sage.groups.perm_gps.partn_ref2.refinement_generic import LabelledBranching
+             sage: L = LabelledBranching(3)
+             sage: L.small_generating_set()
+-            []
++            [()]
+             sage: L.add_gen(libgap.eval('(1,2,3)'))
+             sage: L.small_generating_set()
+             [(1,2,3)]
+diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
+index ebdf7c4c6eb..fb14008c8e0 100644
+--- a/src/sage/groups/perm_gps/permgroup.py
++++ b/src/sage/groups/perm_gps/permgroup.py
+@@ -926,7 +926,7 @@ def _coerce_map_from_(self, G):
+            sage: f = PG._coerce_map_from_(MG)
+            sage: mg = MG.an_element()
+            sage: p = f(mg); p
+-           (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60)
++           (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21)
+            sage: PG(p._gap_()) == p
+            True
+ 
+@@ -972,12 +972,12 @@ def _coerce_map_from_(self, G):
+             sage: P = G.as_permutation_group(algorithm='smaller', seed=5)
+             sage: P1 = G.as_permutation_group()
+             sage: P == P1
+-            False
++            True
+             sage: g1, g2, g3 = G.gens()
+             sage: P(g1*g2)
+-            (1,3,7,12)(2,4,8,10)(5,11)(6,9)
++            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
+             sage: P1(g1*g2)
+-            (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66)
++            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
+ 
+         Another check for :trac:`5583`::
+ 
+@@ -1302,7 +1302,7 @@ def gens_small(self):
+             sage: G.gens_small() # random
+             [('b','c'), ('a','c','b')] ## (on 64-bit Linux)
+             [('a','b'), ('a','c','b')] ## (on Solaris)
+-            sage: len(G.gens_small()) == 2
++            sage: len(G.gens_small()) == 2 # random
+             True
+         """
+         gens = self._libgap_().SmallGeneratingSet()
+@@ -4370,17 +4370,23 @@ def is_transitive(self, domain=None):
+ 
+         ::
+ 
+-            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
+-            sage: G.is_transitive([1,4,5])
++            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)],[(6,7)]])
++            sage: G.is_transitive([1,2,3,4,5])
+             True
+-            sage: G.is_transitive([2..6])
++            sage: G.is_transitive([1..7])
+             False
+             sage: G.is_transitive(G.non_fixed_points())
+-            True
++            False
+             sage: H = PermutationGroup([[(1,2,3)],[(4,5,6)]])
+             sage: H.is_transitive(H.non_fixed_points())
+             False
+ 
++        If `G` does not act on the domain, it always returns ``False``::
++
++            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
++            sage: G.is_transitive([1,4,5])
++            False
++
+         Note that this differs from the definition in GAP, where
+         ``IsTransitive`` returns whether the group is transitive on the
+         set of points moved by the group.
+@@ -4436,12 +4442,16 @@ def is_primitive(self, domain=None):
+             sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
+             sage: G.is_primitive([1..4])
+             False
+-            sage: G.is_primitive([1,2,3])
+-            True
+             sage: G = PermutationGroup([[(3,4,5,6)],[(3,4)]]) #S_4 on [3..6]
+             sage: G.is_primitive(G.non_fixed_points())
+             True
+ 
++        If `G` does not act on the domain, it always returns ``False``::
++
++            sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
++            sage: G.is_primitive([1,2,3])
++            False
++
+         """
+         #If the domain is not a subset of self.domain(), then the
+         #action isn't primitive.
+diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
+index 7ae1792e9de..ecaa9fd2341 100644
+--- a/src/sage/interfaces/gap.py
++++ b/src/sage/interfaces/gap.py
+@@ -1512,6 +1512,8 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
+     """
+     # Create new workspace with filename WORKSPACE
+     g = Gap(use_workspace_cache=False, max_workspace_size=None)
++    g.eval('ColorPrompt(false)')
++    g.eval('SetUserPreference("UseColorPrompt", false)')
+     g.eval('SetUserPreference("HistoryMaxLines", 30)')
+     from sage.tests.gap_packages import all_installed_packages
+     for pkg in all_installed_packages(gap=g):
+diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
+index 33a87dd5076..03b40be6856 100644
+--- a/src/sage/interfaces/gap_workspace.py
++++ b/src/sage/interfaces/gap_workspace.py
+@@ -16,7 +16,8 @@
+ import os
+ import time
+ import hashlib
+-from sage.env import DOT_SAGE, GAP_SO
++import subprocess
++from sage.env import DOT_SAGE, HOSTNAME, GAP_LIB_DIR, GAP_SHARE_DIR
+ 
+ 
+ def gap_workspace_file(system="gap", name="workspace", dir=None):
+@@ -59,11 +60,13 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
+     if dir is None:
+         dir = os.path.join(DOT_SAGE, 'gap')
+ 
+-    if GAP_SO:
+-        h = hashlib.sha1(GAP_SO.encode('utf-8')).hexdigest()
+-    else:
+-        h = 'unknown'
+-    return os.path.join(dir, '%s-%s-%s' % (system, name, h))
++    data = f'{GAP_LIB_DIR}:{GAP_SHARE_DIR}'
++    for path in GAP_LIB_DIR, GAP_SHARE_DIR:
++        sysinfo = os.path.join(path, "sysinfo.gap")
++        if os.path.exists(sysinfo):
++            data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
++    h = hashlib.sha1(data.encode('utf-8')).hexdigest()
++    return os.path.join(dir, f'{system}-{name}-{HOSTNAME}-{h}')
+ 
+ 
+ def prepare_workspace_dir(dir=None):
+diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
+index c555ea0333c..e3db3934baf 100644
+--- a/src/sage/libs/gap/element.pyx
++++ b/src/sage/libs/gap/element.pyx
+@@ -130,6 +130,7 @@ cdef char *capture_stdout(Obj func, Obj obj):
+     """
+     cdef Obj s, stream, output_text_string
+     cdef UInt res
++    cdef TypOutputFile output
+     # The only way to get a string representation of an object that is truly
+     # consistent with how it would be represented at the GAP REPL is to call
+     # ViewObj on it.  Unfortunately, ViewObj *prints* to the output stream,
+@@ -145,12 +146,12 @@ cdef char *capture_stdout(Obj func, Obj obj):
+         output_text_string = GAP_ValueGlobalVariable("OutputTextString")
+         stream = CALL_2ARGS(output_text_string, s, GAP_True)
+ 
+-        if not OpenOutputStream(stream):
++        if not OpenOutputStream(&output, stream):
+             raise GAPError("failed to open output capture stream for "
+                            "representing GAP object")
+ 
+         CALL_1ARGS(func, obj)
+-        CloseOutput()
++        CloseOutput(&output)
+         return CSTR_STRING(s)
+     finally:
+         GAP_Leave()
+diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd
+index 6d22e32540b..6111d18a5c7 100644
+--- a/src/sage/libs/gap/gap_includes.pxd
++++ b/src/sage/libs/gap/gap_includes.pxd
+@@ -76,8 +76,10 @@ cdef extern from "gap/intobj.h" nogil:
+ 
+ 
+ cdef extern from "gap/io.h" nogil:
+-    UInt OpenOutputStream(Obj stream)
+-    UInt CloseOutput()
++    ctypedef struct TypOutputFile:
++        pass
++    UInt OpenOutputStream(TypOutputFile* output, Obj stream)
++    UInt CloseOutput(TypOutputFile* output)
+ 
+ 
+ cdef extern from "gap/libgap-api.h" nogil:
+diff --git a/src/sage/libs/gap/libgap.pyx b/src/sage/libs/gap/libgap.pyx
+index b1a64e57939..6a36613aa8c 100644
+--- a/src/sage/libs/gap/libgap.pyx
++++ b/src/sage/libs/gap/libgap.pyx
+@@ -695,7 +695,7 @@ class Gap(Parent):
+             sage: libgap.List
+             <Gap function "List">
+             sage: libgap.GlobalRandomSource
+-            <RandomSource in IsGlobalRandomSource>
++            <RandomSource in IsGAPRandomSource>
+         """
+         if name in dir(self.__class__):
+             return getattr(self.__class__, name)
+diff --git a/src/sage/libs/gap/saved_workspace.py b/src/sage/libs/gap/saved_workspace.py
+index ad5adec36d0..7636707f557 100644
+--- a/src/sage/libs/gap/saved_workspace.py
++++ b/src/sage/libs/gap/saved_workspace.py
+@@ -8,7 +8,7 @@
+ 
+ import os
+ import glob
+-from sage.env import GAP_ROOT_DIR
++from sage.env import GAP_LIB_DIR
+ from sage.interfaces.gap_workspace import gap_workspace_file
+ 
+ 
+@@ -31,7 +31,7 @@ def timestamp():
+     """
+     libgap_dir = os.path.dirname(__file__)
+     libgap_files = glob.glob(os.path.join(libgap_dir, '*'))
+-    gap_packages = glob.glob(os.path.join(GAP_ROOT_DIR, 'pkg', '*'))
++    gap_packages = glob.glob(os.path.join(GAP_LIB_DIR, 'pkg', '*'))
+     files = libgap_files + gap_packages
+     if len(files) == 0:
+         print('Unable to find LibGAP files.')
+diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
+index 344ab88c42a..eaa659d64c7 100644
+--- a/src/sage/libs/gap/util.pyx
++++ b/src/sage/libs/gap/util.pyx
+@@ -13,7 +13,7 @@ Utility functions for GAP
+ #*****************************************************************************
+ 
+ from libc.signal cimport signal, SIGCHLD, SIG_DFL
+-from posix.dlfcn cimport dlopen, dlclose, RTLD_NOW, RTLD_GLOBAL
++from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
+ 
+ from cpython.exc cimport PyErr_Fetch, PyErr_Restore
+ from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
+@@ -164,33 +164,6 @@ cdef void gasman_callback() with gil:
+ ### Initialization of GAP ##################################################
+ ############################################################################
+ 
+-def gap_root():
+-    """
+-    Find the location of the GAP root install which is stored in the gap
+-    startup script.
+-
+-    EXAMPLES::
+-
+-        sage: from sage.libs.gap.util import gap_root
+-        sage: gap_root()   # random output
+-        '/home/vbraun/opt/sage-5.3.rc0/local/gap/latest'
+-    """
+-    if os.path.exists(sage.env.GAP_ROOT_DIR):
+-        return sage.env.GAP_ROOT_DIR
+-
+-    # Attempt to figure out the appropriate GAP_ROOT by reading the
+-    # local/bin/gap shell script; this is an ugly hack that exists for
+-    # historical reasons; the best approach to setting where Sage looks for
+-    # the appropriate GAP_ROOT is to set the GAP_ROOT_DIR variable
+-    SAGE_LOCAL = sage.env.SAGE_LOCAL
+-    with open(os.path.join(SAGE_LOCAL, 'bin', 'gap')) as f:
+-        gap_sh = f.read().splitlines()
+-    gapdir = next(x for x in gap_sh if x.strip().startswith('GAP_ROOT'))
+-    gapdir = gapdir.split('"')[1]
+-    gapdir = gapdir.replace('$SAGE_LOCAL', SAGE_LOCAL)
+-    return gapdir
+-
+-
+ # To ensure that we call initialize_libgap only once.
+ cdef bint _gap_is_initialized = False
+ 
+@@ -232,12 +205,12 @@ cdef initialize():
+     # this isn't portable
+ 
+     cdef void* handle
+-    libgapname = str_to_bytes(sage.env.GAP_SO)
+-    handle = dlopen(libgapname, RTLD_NOW | RTLD_GLOBAL)
++    # reload the current module to force reload of libgap (see #33446)
++    lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
++    handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
+     if handle is NULL:
+-        raise RuntimeError(
+-                "Could not dlopen() libgap even though it should already "
+-                "be loaded!")
++        err = dlerror()
++        raise RuntimeError(f"Could not reload gap library with RTLD_GLOBAL ({err})")
+     dlclose(handle)
+ 
+     # Define argv variable, which we will pass in to
+@@ -245,7 +218,7 @@ cdef initialize():
+     cdef char* argv[16]
+     argv[0] = "sage"
+     argv[1] = "-l"
+-    s = str_to_bytes(gap_root(), FS_ENCODING, "surrogateescape")
++    s = str_to_bytes(sage.env.GAP_LIB_DIR + ";" + sage.env.GAP_SHARE_DIR, FS_ENCODING, "surrogateescape")
+     argv[2] = s
+ 
+     argv[3] = "-m"
+@@ -362,15 +335,9 @@ cdef Obj gap_eval(str gap_string) except? NULL:
+         GAPError: Error, Variable: 'Complex' must have a value
+         Syntax error: ; expected in stream:1
+         Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^
++                ^^^^^
+         Error, Variable: 'with' must have a value
+-        Syntax error: ; expected in stream:1
+-        Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^^^^^^^^^
+         Error, Variable: 'bits' must have a value
+-        Syntax error: ; expected in stream:1
+-        Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+         Error, Variable: 'precision' must have a value
+ 
+     Test that on a subsequent attempt we get the same message (no garbage was
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index d8ea7b07f3c..4beb1774df9 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -1705,14 +1705,7 @@ cdef object si2sa_intvec(intvec *v):
+ cdef extern from *: # hack to get at cython macro
+     int unlikely(int)
+ 
+-cdef extern from "dlfcn.h":
+-    void *dlopen(char *, long)
+-    char *dlerror()
+-    void dlclose(void *handle)
+-
+-cdef extern from "dlfcn.h":
+-    cdef long RTLD_LAZY
+-    cdef long RTLD_GLOBAL
++from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
+ 
+ cdef int overflow_check(unsigned long e, ring *_ring) except -1:
+     """
+@@ -1762,8 +1755,6 @@ cdef init_libsingular():
+ 
+     cdef void *handle = NULL
+ 
+-    from sage.env import LIBSINGULAR_PATH
+-    lib = str_to_bytes(LIBSINGULAR_PATH, FS_ENCODING, "surrogateescape")
+ 
+     # This is a workaround for https://github.com/Singular/Singular/issues/1113
+     # and can be removed once that fix makes it into release of Singular that
+@@ -1780,10 +1771,12 @@ cdef init_libsingular():
+ 
+     import platform
+     if not platform.system().startswith("CYGWIN"):
++        # reload the current module to force reload of libSingular (see #33446)
++        lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
+         handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
+         if not handle:
+             err = dlerror()
+-            raise ImportError(f"cannot load Singular library from {LIBSINGULAR_PATH} ({err})")
++            raise RuntimeError(f"Could not reload Singular library with RTLD_GLOBAL ({err})")
+ 
+     # load SINGULAR
+     siInit(lib)
+diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py
+index 2e4518ca226..c302b169b8a 100644
+--- a/src/sage/tests/gap_packages.py
++++ b/src/sage/tests/gap_packages.py
+@@ -103,7 +103,7 @@ def all_installed_packages(ignore_dot_gap=False, gap=None):
+ 
+         sage: from sage.tests.gap_packages import all_installed_packages
+         sage: all_installed_packages()
+-        (...'GAPDoc'...)
++        (...'gapdoc'...)
+         sage: all_installed_packages(ignore_dot_gap=True) == all_installed_packages(gap=gap, ignore_dot_gap=True)
+         True
+     """
diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches
new file mode 100755
index 000000000000..6cb717f72d8e
--- /dev/null
+++ b/srcpkgs/sagemath/patches/get_patches
@@ -0,0 +1,40 @@
+#! /bin/sh
+
+URL_BASE_PR="https://github.com/sagemath/sage/pull/"
+URL_BASE_COMPARE="https://github.com/sagemath/sage/compare/9.8..."
+
+case "$1" in
+	-n)  DO=echo ;;
+esac
+
+# get_pr <PR number> <description> [ext]
+get_pr() {
+	pr=$1
+	desc=$(echo "$2" | sed -e 's/ /_/g')
+	ext=${3-diff}
+	$DO wget "$URL_BASE_PR$pr.$ext" -O "$pr-$desc.patch"
+}
+
+get_trac() {
+	ticket=$1
+	desc=$(echo "$2" | sed -e 's/ /_/g')
+	commit=$3
+	$DO wget "$URL_BASE_COMPARE$commit.diff" -O "trac-$ticket-$desc-$commit.patch"
+}
+
+# run from patches dir
+cd $(dirname "$0")
+
+# merged in 10.0.beta0
+get_trac 34851 "support singular 4.3.1.p3" 5e5737a0c
+get_pr 35068 "fix tests giac 1.9.0.35" patch
+
+# positive review
+get_pr 34994 "fix tests numpy 1.24"
+get_pr 34997 "fix edge case of integer_check"
+get_pr 35058 "skip unstable tests klyachko"
+get_pr 35094 "support gap 4.12"					# includes PR 35093
+
+# needs review 
+get_pr 34995 "support tachyon 0.99.2"
+get_pr 34980 "avoid factoring in is_prime"
diff --git a/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch b/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
deleted file mode 100644
index e052e306e7a1..000000000000
--- a/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 6330cee1a69229b2f5d8ac4a09a73d8152f5e14d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 28 Feb 2022 23:15:16 -0300
-Subject: trac 33360: avoid factoring in is_prime()
-
-In the added TEST, the ideal norm is product of two primes but factoring
-this product takes about half an hour, so factoring the ideal is slow.
-
-To fix the issue, we only factor the ideal if the norm is a prime power.
----
- src/sage/rings/number_field/number_field_ideal.py | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
-index f785f22..10d1f88 100644
---- a/src/sage/rings/number_field/number_field_ideal.py
-+++ b/src/sage/rings/number_field/number_field_ideal.py
-@@ -995,10 +995,32 @@ class NumberFieldIdeal(Ideal_generic):
-             False
-             sage: K.ideal(17).is_prime()  # ramified
-             False
-+
-+        TESTS::
-+
-+        Check that we do not factor the norm of the ideal, this used
-+        to take half an hour, see :trac:`33360`
-+
-+           sage: K.<a,b,c> = NumberField([x^2-2,x^2-3,x^2-5])
-+           sage: t = (((-2611940*c + 1925290/7653)*b - 1537130/7653*c
-+           ....:       + 10130950)*a + (1343014/7653*c - 8349770)*b
-+           ....:       + 6477058*c - 2801449990/4002519)
-+           sage: t.is_prime()
-+           False
-+
-         """
-         try:
-             return self._pari_prime is not None
-         except AttributeError:
-+            K = self.number_field().pari_nf()
-+            I = self.pari_hnf()
-+            # This would be better, but it is broken in pari 2.13.3.
-+            #   self._pari_prime = K.idealismaximal(I) or None
-+            # Instead we factor I, but only if the norm is a prime power
-+            n = K.idealnorm(I)
-+            if n.denominator() > 1 or not n.isprimepower():
-+                self._pari_prime = None
-+                return False
-             F = self.factor()  # factorization with caching
-             if len(F) != 1 or F[0][1] != 1:
-                 self._pari_prime = None
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch b/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
deleted file mode 100644
index fb9e0f5a8071..000000000000
--- a/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
+++ /dev/null
@@ -1,427 +0,0 @@
-From 9feec282d039ca25bbefa50710f8217b775ce111 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Thu, 3 Mar 2022 14:47:00 -0300
-Subject: gap: do not directly dlopen() the gap library
-
-This needs the soname (as in sage.env.GAP_SO) which has issues for
-system gap as explained in #33446.
-
-Instead we dlopen() the extension module sage.libs.gap.util which,
-having a link time dependency to libgap, will indirectly dlopen() it.
-
-For the record: by the time we run dlopen() the libgap should be already
-loaded. The purpose of doing it is to change mode to RTLD_GLOBAL so that
-symbols in libgap are placed in the global symbol table. This is
-required to compiled load gap packages.
-
-An easy test that this is working ok is:
-
-    sage: libgap.LoadPackage("io")
-    true
-
-This requires optional spkg `gap_packages` to be installed.
----
- src/sage/libs/gap/util.pyx | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
-index 344ab88..aff604b 100644
---- a/src/sage/libs/gap/util.pyx
-+++ b/src/sage/libs/gap/util.pyx
-@@ -13,7 +13,7 @@ Utility functions for GAP
- #*****************************************************************************
- 
- from libc.signal cimport signal, SIGCHLD, SIG_DFL
--from posix.dlfcn cimport dlopen, dlclose, RTLD_NOW, RTLD_GLOBAL
-+from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
- 
- from cpython.exc cimport PyErr_Fetch, PyErr_Restore
- from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
-@@ -232,12 +232,12 @@ cdef initialize():
-     # this isn't portable
- 
-     cdef void* handle
--    libgapname = str_to_bytes(sage.env.GAP_SO)
--    handle = dlopen(libgapname, RTLD_NOW | RTLD_GLOBAL)
-+    # reload the current module to force reload of libgap (see #33446)
-+    lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
-+    handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
-     if handle is NULL:
--        raise RuntimeError(
--                "Could not dlopen() libgap even though it should already "
--                "be loaded!")
-+        err = dlerror()
-+        raise RuntimeError(f"Could not reload gap library with RTLD_GLOBAL ({err})")
-     dlclose(handle)
- 
-     # Define argv variable, which we will pass in to
--- 
-cgit v1.0-1-gd88e
-
-
-From 704a7953b97ab726e2af610724726aa562bc8bf8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Thu, 3 Mar 2022 23:00:07 -0300
-Subject: singular: do not directly dlopen() the singular library
-
-Same as for gap in the previous commit. Instead of requiring the soname
-(as in sage.env.LIBSINGULAR_PATH) we dlopen() the extension module
-sage.libs.singular.singular which will indirectly dlopen() libSingular.
----
- src/sage/libs/singular/singular.pyx | 15 ++++-----------
- 1 file changed, 4 insertions(+), 11 deletions(-)
-
-diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
-index d8ea7b0..4beb177 100644
---- a/src/sage/libs/singular/singular.pyx
-+++ b/src/sage/libs/singular/singular.pyx
-@@ -1705,14 +1705,7 @@ cdef object si2sa_intvec(intvec *v):
- cdef extern from *: # hack to get at cython macro
-     int unlikely(int)
- 
--cdef extern from "dlfcn.h":
--    void *dlopen(char *, long)
--    char *dlerror()
--    void dlclose(void *handle)
--
--cdef extern from "dlfcn.h":
--    cdef long RTLD_LAZY
--    cdef long RTLD_GLOBAL
-+from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
- 
- cdef int overflow_check(unsigned long e, ring *_ring) except -1:
-     """
-@@ -1762,8 +1755,6 @@ cdef init_libsingular():
- 
-     cdef void *handle = NULL
- 
--    from sage.env import LIBSINGULAR_PATH
--    lib = str_to_bytes(LIBSINGULAR_PATH, FS_ENCODING, "surrogateescape")
- 
-     # This is a workaround for https://github.com/Singular/Singular/issues/1113
-     # and can be removed once that fix makes it into release of Singular that
-@@ -1780,10 +1771,12 @@ cdef init_libsingular():
- 
-     import platform
-     if not platform.system().startswith("CYGWIN"):
-+        # reload the current module to force reload of libSingular (see #33446)
-+        lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
-         handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
-         if not handle:
-             err = dlerror()
--            raise ImportError(f"cannot load Singular library from {LIBSINGULAR_PATH} ({err})")
-+            raise RuntimeError(f"Could not reload Singular library with RTLD_GLOBAL ({err})")
- 
-     # load SINGULAR
-     siInit(lib)
--- 
-cgit v1.0-1-gd88e
-
-
-From d7145c14ef58acfbe00d8f941d2802e96ad4ba15 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 16:37:34 -0300
-Subject: singular: remove LIBSINGULAR_PATH, no longer needed
-
----
- build/pkgs/singular/spkg-configure.m4 | 63 +----------------------------------
- pkgs/sage-conf/_sage_conf/_conf.py.in |  3 --
- src/sage/env.py                       |  6 ----
- 3 files changed, 1 insertion(+), 71 deletions(-)
-
-diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4
-index af2eb85..6d3d3da 100644
---- a/build/pkgs/singular/spkg-configure.m4
-+++ b/build/pkgs/singular/spkg-configure.m4
-@@ -9,52 +9,7 @@ SAGE_SPKG_CONFIGURE([singular], [
-        AC_MSG_CHECKING([that Singular's help is working])
-        AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error\ occurred"` = x], [
-         AC_MSG_RESULT(yes)
--        dnl We have Singular. Now determine the shared library path on
--        dnl platforms on which sage.libs.singular needs to reload the library with RTLD_GLOBAL.
--        AS_CASE([$host_os],
--          [cygwin*], [dnl Nothing to do
--                     ],
--                     [dnl Use pkg-config to get singular's libdir while we're at it. As a
--                      dnl moral compromise for using pkg-config, this ultimately allows us
--                      dnl to pass an absolute path to dlopen(), which is the only approach
--                      dnl that POSIX guarantees will work.
--                      PKG_CHECK_VAR([SINGULAR_LIB_DIR], [Singular], [libdir])
--                      dnl The acl_shlibext variable is set in the top-level configure.ac.
--                      AC_LANG_PUSH(C)
--                      ORIG_LIBS="${LIBS}"
--                      LIBS="${LIBS} -ldl"
--                      AC_MSG_CHECKING([if we can dlopen($LIBSINGULAR_PATH)])
--                      LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libSingular.${acl_shlibext}"
--
--                      dnl if we can dlopen() it, substitute the name for sage_conf;
--                      dnl otherwise, fall back to using the SPKG.
--                      AC_RUN_IFELSE(
--                        [AC_LANG_PROGRAM(
--                          [[#include <dlfcn.h>]],
--                          [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
--                            if (h == 0) { return 1; } else { return dlclose(h); }]]
--                        )], [
--                          AC_MSG_RESULT(yes)
--                        ], [
--                          dnl try Debian-specific name
--                          LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libsingular-Singular.${acl_shlibext}"
--                          AC_RUN_IFELSE(
--                           [AC_LANG_PROGRAM(
--                             [[#include <dlfcn.h>]],
--                             [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
--                               if (h == 0) { return 1; } else { return dlclose(h); }]]
--                           )], [
--                             AC_MSG_RESULT(yes)
--                           ], [
--                            AC_MSG_RESULT(no)
--                            sage_spkg_install_singular=yes
--                          ], [AC_MSG_RESULT(yes)])
--                        ], [AC_MSG_RESULT(yes)])
--
--                      AC_LANG_POP()
--                      LIBS="${ORIG_LIBS}"
--                     ]
--       )], [
-+       ], [
-        AC_MSG_RESULT(no)
-        sage_spkg_install_singular=yes
-        ]
-@@ -64,20 +19,4 @@ SAGE_SPKG_CONFIGURE([singular], [
-       ])
-     ])
-   ])
--],[],[],[
--  dnl Post-check phase
--  dnl We make the sage_conf substitutions here, because the "default"
--  dnl substitution needs to be made even if we skipped the system-Singular
--  dnl checks themselves.
--  AS_IF([test "x${sage_spkg_install_singular}" = "xyes"], [
--    AS_CASE([$host_os],
--      [cygwin*], [dnl Nothing to do
--                 ],
--                 [dnl Set shared library path, needed for reloading the library with RTLD_GLOBAL
--                  LIBSINGULAR_PATH="\$SAGE_LOCAL/lib/libSingular.${acl_shlibext}"
--                 ]
--    )
--  ])
--
--  AC_SUBST(LIBSINGULAR_PATH, "${LIBSINGULAR_PATH}")
- ])
-diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in
-index 6cd28f5..d66bdb3 100644
---- a/pkgs/sage-conf/_sage_conf/_conf.py.in
-+++ b/pkgs/sage-conf/_sage_conf/_conf.py.in
-@@ -55,9 +55,6 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"
- OPENMP_CFLAGS = "@OPENMP_CFLAGS@"
- OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"
- 
--# The full absolute path to the main Singular library.
--LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)
--
- # Installation location of wheels. This is determined at configuration time
- # and does not depend on the installation location of sage-conf.
- SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels"
-diff --git a/src/sage/env.py b/src/sage/env.py
-index 911f34b..93f79de 100644
---- a/src/sage/env.py
-+++ b/src/sage/env.py
-@@ -229,12 +229,6 @@ NTL_LIBDIR = var("NTL_LIBDIR")
- LIE_INFO_DIR = var("LIE_INFO_DIR", join(SAGE_LOCAL, "lib", "LiE"))
- SINGULAR_BIN = var("SINGULAR_BIN") or "Singular"
- 
--# The path to libSingular, to be passed to dlopen(). This will
--# typically be set to an absolute path in sage_conf, but the relative
--# fallback path here works on systems where dlopen() searches the
--# system's library locations.
--LIBSINGULAR_PATH = var("LIBSINGULAR_PATH", "libSingular.so")
--
- # OpenMP
- OPENMP_CFLAGS = var("OPENMP_CFLAGS", "")
- OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
--- 
-cgit v1.0-1-gd88e
-
-
-From 92e5a211c792f86f5325d601abfddf667da6a776 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 15:49:26 -0300
-Subject: Revert "src/sage/interfaces/gap_workspace.py: Use hash of GAP_SO to
- disambiguate the workspace file, not SAGE_LOCAL"
-
-This reverts commit a801e6d85bd420b60ea75b1671856eb43ac6b18b.
-
-See #33446.
----
- src/sage/interfaces/gap_workspace.py | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
-
-diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
-index 33a87dd..953dc85 100644
---- a/src/sage/interfaces/gap_workspace.py
-+++ b/src/sage/interfaces/gap_workspace.py
-@@ -16,7 +16,7 @@ Support for (lib)GAP workspace files
- import os
- import time
- import hashlib
--from sage.env import DOT_SAGE, GAP_SO
-+from sage.env import DOT_SAGE, SAGE_LOCAL
- 
- 
- def gap_workspace_file(system="gap", name="workspace", dir=None):
-@@ -59,10 +59,7 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
-     if dir is None:
-         dir = os.path.join(DOT_SAGE, 'gap')
- 
--    if GAP_SO:
--        h = hashlib.sha1(GAP_SO.encode('utf-8')).hexdigest()
--    else:
--        h = 'unknown'
-+    h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
-     return os.path.join(dir, '%s-%s-%s' % (system, name, h))
- 
- 
--- 
-cgit v1.0-1-gd88e
-
-
-From b45e555b5711ae10d369b568333940c2aa771053 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 16:38:49 -0300
-Subject: gap: remove GAP_SO, no longer needed
-
----
- src/sage/env.py | 75 ---------------------------------------------------------
- 1 file changed, 75 deletions(-)
-
-diff --git a/src/sage/env.py b/src/sage/env.py
-index 93f79de..c16a094 100644
---- a/src/sage/env.py
-+++ b/src/sage/env.py
-@@ -249,81 +249,6 @@ if SAGE_GAP_MEMORY is not None:
- SAGE_GAP_COMMAND = var('SAGE_GAP_COMMAND', _gap_cmd)
- 
- 
--def _get_shared_lib_path(*libnames: str) -> Optional[str]:
--    """
--    Return the full path to a shared library file installed in
--    ``$SAGE_LOCAL/lib`` or the directories associated with the
--    Python sysconfig.
--
--    This can also be passed more than one library name (e.g. for cases where
--    some library may have multiple names depending on the platform) in which
--    case the first one found is returned.
--
--    This supports most *NIX variants (in which ``lib<libname>.so`` is found
--    under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
--    extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
--    or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
--
--    For distributions like Debian that use a multiarch layout, we also try the
--    multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
--
--    This returns ``None`` if no matching library file could be found.
--
--    EXAMPLES::
--
--        sage: from sage.env import _get_shared_lib_path
--        sage: "gap" in _get_shared_lib_path("gap")
--        True
--        sage: _get_shared_lib_path("an_absurd_lib") is None
--        True
--
--    """
--
--    for libname in libnames:
--        search_directories: List[Path] = []
--        patterns: List[str] = []
--        if sys.platform == 'cygwin':
--            # Later down we take the first matching DLL found, so search
--            # SAGE_LOCAL first so that it takes precedence
--            if SAGE_LOCAL:
--                search_directories.append(Path(SAGE_LOCAL) / 'bin')
--            search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
--            # Note: The following is not very robust, since if there are multible
--            # versions for the same library this just selects one more or less
--            # at arbitrary. However, practically speaking, on Cygwin, there
--            # will only ever be one version
--            patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
--        else:
--            if sys.platform == 'darwin':
--                ext = 'dylib'
--            else:
--                ext = 'so'
--
--            if SAGE_LOCAL:
--                search_directories.append(Path(SAGE_LOCAL) / 'lib')
--            libdir = sysconfig.get_config_var('LIBDIR')
--            if libdir is not None:
--                libdir = Path(libdir)
--                search_directories.append(libdir)
--
--                multiarchlib = sysconfig.get_config_var('MULTIARCH')
--                if multiarchlib is not None:
--                    search_directories.append(libdir / multiarchlib),
--
--            patterns = [f'lib{libname}.{ext}']
--
--        for directory in search_directories:
--            for pattern in patterns:
--                path = next(directory.glob(pattern), None)
--                if path is not None:
--                    return str(path.resolve())
--
--    # Just return None if no files were found
--    return None
--
--# locate libgap shared object
--GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
--
- # post process
- if DOT_SAGE is not None and ' ' in DOT_SAGE:
-     if UNAME[:6] == 'CYGWIN':
--- 
-cgit v1.0-1-gd88e
-
-
-From 31e3fc4ec8b8687bccd22d2e3161c86cf5553e06 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Mar 2022 12:10:37 -0300
-Subject: gap_workspace_file: include hostname and gap version
-
----
- src/sage/interfaces/gap_workspace.py | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
-index 953dc85..8c03b6b 100644
---- a/src/sage/interfaces/gap_workspace.py
-+++ b/src/sage/interfaces/gap_workspace.py
-@@ -16,7 +16,8 @@ Support for (lib)GAP workspace files
- import os
- import time
- import hashlib
--from sage.env import DOT_SAGE, SAGE_LOCAL
-+import subprocess
-+from sage.env import DOT_SAGE, SAGE_LOCAL, HOSTNAME, GAP_ROOT_DIR
- 
- 
- def gap_workspace_file(system="gap", name="workspace", dir=None):
-@@ -59,8 +60,12 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
-     if dir is None:
-         dir = os.path.join(DOT_SAGE, 'gap')
- 
--    h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
--    return os.path.join(dir, '%s-%s-%s' % (system, name, h))
-+    data = SAGE_LOCAL
-+    sysinfo = os.path.join(GAP_ROOT_DIR, "sysinfo.gap")
-+    if os.path.exists(sysinfo):
-+        data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
-+    h = hashlib.sha1(data.encode('utf-8')).hexdigest()
-+    return os.path.join(dir, '%s-%s-%s-%s' % (system, name, HOSTNAME, h))
- 
- 
- def prepare_workspace_dir(dir=None):
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch b/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
deleted file mode 100644
index 70b1fed99ce4..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From de38bac21e276c6dba95b8b33f7457a0ac56bdeb Mon Sep 17 00:00:00 2001
-From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
-Date: Tue, 25 Oct 2022 19:43:53 -0700
-Subject: [PATCH] src/sage: Apply python-3.11.patch from
- https://github.com/void-linux/void-packages/commit/6229f313450ecae88743b4d5e99da2ed4de44e07
-
----
- src/sage/cpython/cython_metaclass.h | 2 +-
- src/sage/libs/gmp/pylong.pyx        | 8 +++-----
- src/sage/symbolic/ginac/numeric.cpp | 1 -
- 3 files changed, 4 insertions(+), 7 deletions(-)
-
-diff --git a/src/sage/cpython/cython_metaclass.h b/src/sage/cpython/cython_metaclass.h
-index cc620a4dac7..6487342b71e 100644
---- a/src/sage/cpython/cython_metaclass.h
-+++ b/src/sage/cpython/cython_metaclass.h
-@@ -66,7 +66,7 @@ static CYTHON_INLINE int Sage_PyType_Ready(PyTypeObject* t)
-         }
- 
-         /* Now, set t.__class__ to metaclass */
--        Py_TYPE(t) = metaclass;
-+        Py_SET_TYPE(t, metaclass);
-         PyType_Modified(t);
-     }
-     else
-diff --git a/src/sage/libs/gmp/pylong.pyx b/src/sage/libs/gmp/pylong.pyx
-index 388be32c55e..e772b60e3e0 100644
---- a/src/sage/libs/gmp/pylong.pyx
-+++ b/src/sage/libs/gmp/pylong.pyx
-@@ -32,7 +32,7 @@ from cpython.longintrepr cimport _PyLong_New, py_long, digit, PyLong_SHIFT
- from .mpz cimport *
- 
- cdef extern from *:
--    Py_ssize_t* Py_SIZE_PTR "&Py_SIZE"(object)
-+    void Py_SET_SIZE(object, Py_ssize_t)
-     int hash_bits """
-         #ifdef _PyHASH_BITS
-         _PyHASH_BITS         /* Python 3 */
-@@ -57,10 +57,8 @@ cdef mpz_get_pylong_large(mpz_srcptr z):
-     mpz_export(L.ob_digit, NULL,
-             -1, sizeof(digit), 0, PyLong_nails, z)
-     if mpz_sgn(z) < 0:
--        # Set correct size (use a pointer to hack around Cython's
--        # non-support for lvalues).
--        sizeptr = Py_SIZE_PTR(L)
--        sizeptr[0] = -pylong_size
-+        # Set correct size
-+        Py_SET_SIZE(L, -pylong_size)
-     return L
- 
- 
-diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp
-index 22060441760..b40ed64edb5 100644
---- a/src/sage/symbolic/ginac/numeric.cpp
-+++ b/src/sage/symbolic/ginac/numeric.cpp
-@@ -52,7 +52,6 @@
- #define register
- #define PY_SSIZE_T_CLEAN
- #include <Python.h>
--#include <longintrepr.h>
- #include "flint/fmpz.h"
- #include "flint/fmpz_factor.h"
- 
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch b/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
deleted file mode 100644
index 0bb1f5f68b0e..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From 9eb08f3afde3266bbd667e196513240a0fe245f4 Mon Sep 17 00:00:00 2001
-From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
-Date: Tue, 25 Oct 2022 22:52:56 -0700
-Subject: [PATCH] inspect.ArgSpec -> inspect.FullArgSpec
-
----
- src/sage/misc/cachefunc.pyx         |  4 ++--
- src/sage/misc/decorators.py         |  6 ++++--
- src/sage/misc/function_mangling.pyx |  2 +-
- src/sage/misc/sageinspect.py        | 24 +++++++++++++-----------
- 4 files changed, 20 insertions(+), 16 deletions(-)
-
-diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx
-index 9fa967ce737..72042ef13d6 100644
---- a/src/sage/misc/cachefunc.pyx
-+++ b/src/sage/misc/cachefunc.pyx
-@@ -2818,7 +2818,7 @@ cdef class CachedMethod():
-                 except Exception:
-                     pass
-             if self.nargs == 0:
--                args, varargs, keywords, defaults = sage_getargspec(f)
-+                args, varargs, keywords, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-                 if varargs is None and keywords is None and len(args)<=1:
-                     self.nargs = 1
-                 else:
-@@ -2954,7 +2954,7 @@ cdef class CachedSpecialMethod(CachedMethod):
-         # we need to analyse the argspec
-         f = self._cachedfunc.f
-         if self.nargs == 0:
--            args, varargs, keywords, defaults = sage_getargspec(f)
-+            args, varargs, keywords, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-             if varargs is None and keywords is None and len(args)<=1:
-                 self.nargs = 1
-                 Caller = CachedMethodCallerNoArgs(inst, f, name=name, do_pickle=self._cachedfunc.do_pickle)
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 28c52448813..311a5105739 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -32,7 +32,8 @@ from copy import copy
- 
- from sage.misc.sageinspect import (sage_getsource, sage_getsourcelines,
-                                    sage_getargspec)
--from inspect import ArgSpec
-+
-+from inspect import FullArgSpec
- 
- 
- def sage_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
-@@ -499,7 +500,8 @@ class options():
-                     list(self.options))
-             defaults = (argspec.defaults or ()) + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
-+            return FullArgSpec(args, argspec.varargs, argspec.keywords, defaults,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
-         wrapper._sage_argspec_ = argspec
- 
-diff --git a/src/sage/misc/function_mangling.pyx b/src/sage/misc/function_mangling.pyx
-index 0ac03cf0715..e1bb7978953 100644
---- a/src/sage/misc/function_mangling.pyx
-+++ b/src/sage/misc/function_mangling.pyx
-@@ -116,7 +116,7 @@ cdef class ArgumentFixer:
-     """
-     def __init__(self, f, classmethod = False):
-         try:
--            arg_names, varargs, varkw, defaults = sage_getargspec(f)
-+            arg_names, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-         except AttributeError:
-             # This error occurs if f is defined in a Cython file and the
-             # source file has gone.
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index fbca2defc20..a3821cb56b9 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -359,7 +359,7 @@ def _extract_embedded_signature(docstring, name):
-         docstring = L[1] if len(L) > 1 else ''  # Remove first line, keep the rest
-         def_string = "def " + name + signature + ": pass"
-         try:
--            return docstring, inspect.ArgSpec(*_sage_getargspec_cython(def_string))
-+            return docstring, inspect.FullArgSpec(*_sage_getargspec_cython(def_string))
-         except SyntaxError:
-             docstring = os.linesep.join(L)
-     return docstring, None
-@@ -1135,8 +1135,9 @@ def _sage_getargspec_from_ast(source):
-     vararg = getattr(ast_args.vararg, 'arg', None)
-     kwarg = getattr(ast_args.kwarg, 'arg', None)
- 
--    return inspect.ArgSpec(args, vararg, kwarg,
--                           tuple(defaults) if defaults else None)
-+    return inspect.FullArgSpec(args, vararg, kwarg,
-+                               tuple(defaults) if defaults else None,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
- 
- def _sage_getargspec_cython(source):
-@@ -1152,7 +1153,7 @@ def _sage_getargspec_cython(source):
- 
-     OUTPUT:
- 
--    - an instance of :obj:`inspect.ArgSpec`, i.e., a named tuple
-+    - an instance of :class:`inspect.FullArgSpec`, i.e., a named tuple
- 
-     EXAMPLES::
- 
-@@ -1662,11 +1663,11 @@ def sage_getargspec(obj):
-         return sage_getargspec(obj.__call__)
-     if isinstance(obj, (lazy_attribute, AbstractMethod)):
-         source = sage_getsource(obj)
--        return inspect.ArgSpec(*_sage_getargspec_cython(source))
-+        return inspect.FullArgSpec(*_sage_getargspec_cython(source))
-     if not callable(obj):
-         raise TypeError("obj is not a code object")
-     try:
--        return inspect.ArgSpec(*obj._sage_argspec_())
-+        return inspect.FullArgSpec(*obj._sage_argspec_())
-     except (AttributeError, TypeError):
-         pass
-     # If we are lucky, the function signature is embedded in the docstring.
-@@ -1682,7 +1683,7 @@ def sage_getargspec(obj):
-         # Note that this may give a wrong result for the constants!
-         try:
-             args, varargs, varkw = inspect.getargs(obj.__code__)
--            return inspect.ArgSpec(args, varargs, varkw, obj.__defaults__)
-+            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__)
-         except (TypeError, AttributeError):
-             pass
-     if isclassinstance(obj):
-@@ -1717,7 +1718,7 @@ def sage_getargspec(obj):
-         except TypeError: # happens for Python builtins
-             source = ''
-         if source:
--            return inspect.ArgSpec(*_sage_getargspec_cython(source))
-+            return inspect.FullArgSpec(*_sage_getargspec_cython(source))
-         else:
-             func_obj = obj
- 
-@@ -1730,7 +1731,7 @@ def sage_getargspec(obj):
-         except TypeError: # arg is not a code object
-             # The above "hopefully" was wishful thinking:
-             try:
--                return inspect.ArgSpec(*_sage_getargspec_cython(sage_getsource(obj)))
-+                return inspect.FullArgSpec(*_sage_getargspec_cython(sage_getsource(obj)))
-             except TypeError: # This happens for Python builtins
-                 # The best we can do is to return a generic argspec
-                 args = []
-@@ -1740,7 +1741,8 @@ def sage_getargspec(obj):
-         defaults = func_obj.__defaults__
-     except AttributeError:
-         defaults = None
--    return inspect.ArgSpec(args, varargs, varkw, defaults)
-+    return inspect.FullArgSpec(args, varargs, varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
- 
- def formatannotation(annotation, base_module=None):
-@@ -1811,7 +1813,7 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
-     :func:`sage_getargspec`. Since :func:`sage_getargspec` works for
-     Cython functions while Python's inspect module does not, it makes
-     sense to keep this function for formatting instances of
--    ``inspect.ArgSpec``.
-+    ``inspect.FullArgSpec``.
- 
-     EXAMPLES::
- 
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch b/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
deleted file mode 100644
index cd2fa11622c3..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
+++ /dev/null
@@ -1,1279 +0,0 @@
-From 8955607c71cb94e4a810b89f113b7b220a351417 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Nov 2022 11:26:10 -0300
-Subject: [PATCH 01/11] dict_del_by_value: move python internal definitions to
- a separate file
-
----
- src/sage/cpython/dict_del_by_value.pyx | 153 ++++++++---------------
- src/sage/cpython/dict_internal.h       | 165 +++++++++++++++++++++++++
- 2 files changed, 214 insertions(+), 104 deletions(-)
- create mode 100644 src/sage/cpython/dict_internal.h
-
-diff --git a/src/sage/cpython/dict_del_by_value.pyx b/src/sage/cpython/dict_del_by_value.pyx
-index 488bf9c84cc..3894554c13d 100644
---- a/src/sage/cpython/dict_del_by_value.pyx
-+++ b/src/sage/cpython/dict_del_by_value.pyx
-@@ -19,13 +19,8 @@ AUTHORS:
- #                  https://www.gnu.org/licenses/
- # ****************************************************************************
- 
--import weakref
--from weakref import KeyedRef
--
- from cpython.list cimport PyList_New
--from cpython cimport Py_XINCREF, Py_XDECREF
- 
--from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
- cdef extern from "Python.h":
-     ctypedef struct PyDictKeysObject
- 
-@@ -34,99 +29,47 @@ cdef extern from "Python.h":
-         PyDictKeysObject * ma_keys
-         PyObject ** ma_values
- 
--    #we need this redefinition because we want to be able to call
--    #PyWeakref_GetObject with borrowed references. This is the recommended
--    #strategy according to Cython/Includes/cpython/__init__.pxd
--    PyObject* PyWeakref_GetObject(PyObject * wr)
-     int PyList_SetItem(object list, Py_ssize_t index, PyObject * item) except -1
--    int PyWeakref_Check(PyObject * ob)
--####
--#definitions replicated from CPython's Objects/dict-common.h
--#(this file is not exported from CPython, so we need to be
--#careful the definitions are in step with what happens there.
--
--ctypedef void* dict_lookup_func  # Precise definition not needed
--
--ctypedef union IndexBlock:
--    int8_t as_1[8]
--    int16_t as_2[4]
--    int32_t as_4[2]
--    int64_t as_8[1]
--
--ctypedef struct MyPyDictKeysObject:
--    Py_ssize_t dk_refcnt
--    Py_ssize_t dk_size
--    dict_lookup_func dk_lookup
--    Py_ssize_t dk_usable
--    Py_ssize_t dk_nentries
--    IndexBlock dk_indices
--
--ctypedef struct PyDictKeyEntry:
--    Py_hash_t me_hash
--    PyObject * me_key
--    PyObject * me_value
--
--cdef Py_ssize_t DKIX_EMPTY = -1
--cdef Py_ssize_t DKIX_DUMMY = -2
--cdef Py_ssize_t DKIX_ERROR = -3
--
--#####
--#These routines are copied from CPython's Object/dictobject.c
--#in order to access PyDictKeysObject fields
--
--cdef inline int DK_IXSIZE(MyPyDictKeysObject *keys):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        return 1
--    elif s <= 0xffff:
--        return 2
--    elif s <= 0xffffffff:
--        return 4
--    else:
--        return 8
--
--cdef inline PyDictKeyEntry * DK_ENTRIES(MyPyDictKeysObject *keys):
--    return <PyDictKeyEntry*> &(keys.dk_indices.as_1[keys.dk_size * DK_IXSIZE(keys)])
--
--cdef inline Py_ssize_t dk_get_index(MyPyDictKeysObject *keys, Py_ssize_t i):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        return keys.dk_indices.as_1[i]
--    elif s <= 0xffff:
--        return keys.dk_indices.as_2[i]
--    elif s <= 0xffffffff:
--        return keys.dk_indices.as_4[i]
--    else:
--        return keys.dk_indices.as_8[i]
--
--cdef inline void dk_set_index(MyPyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        keys.dk_indices.as_1[i] = ix
--    elif s <= 0xffff:
--        keys.dk_indices.as_2[i] = ix
--    elif s <= 0xffffffff:
--        keys.dk_indices.as_4[i] = ix
--    else:
--        keys.dk_indices.as_8[i] = ix
--
--#End of replication of Object/dictobject.c
--######
--
--cdef dict_lookup_func lookdict
--
--cdef dict_lookup_func DK_LOOKUP(PyDictObject *mp):
--    return (<MyPyDictKeysObject *>(mp.ma_keys)).dk_lookup
--
--def init_lookdict():
--    global lookdict
--    # A dict which a non-string key uses the generic "lookdict"
--    # as lookup function
--    cdef object D = {}
--    D[0] = 0
--    lookdict = DK_LOOKUP(<PyDictObject *>D)
--
--init_lookdict()
-+
-+cdef extern from "dict_internal.h":
-+    Py_ssize_t DK_MASK(PyDictKeysObject *)
-+    PyDictKeyEntry * DK_ENTRIES(PyDictKeysObject *keys)
-+
-+    Py_ssize_t dictkeys_get_index (PyDictKeysObject *keys, Py_ssize_t i)
-+    void dictkeys_set_index (PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+
-+    Py_ssize_t DKIX_EMPTY, DKIX_DUMMY
-+    int PERTURB_SHIFT
-+
-+    ctypedef struct PyDictKeyEntry:
-+        Py_hash_t me_hash
-+        PyObject * me_key
-+        PyObject * me_value
-+
-+
-+# dk_lookup was removed in python 3.11
-+DEF HAS_DK_LOOKUP = PY_VERSION_HEX < 0x30b0000
-+
-+IF HAS_DK_LOOKUP:
-+
-+    cdef extern from *:
-+        """
-+        #define DK_LOOKUP(dk) ((dk)->dk_lookup)
-+        """
-+        ctypedef void * dict_lookup_func  # Precise definition not needed
-+        dict_lookup_func DK_LOOKUP(PyDictKeysObject *mp)
-+
-+    cdef dict_lookup_func lookdict
-+
-+    def init_lookdict():
-+        global lookdict
-+        # A dict which a non-string key uses the generic "lookdict"
-+        # as lookup function
-+        cdef object D = {}
-+        D[0] = 0
-+        lookdict = DK_LOOKUP((<PyDictObject *>D).ma_keys)
-+
-+    init_lookdict()
- 
- cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_t hash) except -1:
-     """
-@@ -177,9 +120,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-         sage: for i in range(10^3+10): newA = A(); M[newA] = prev; prev = newA
-         sage: del a
-     """
--    keys = <MyPyDictKeysObject *>(mp.ma_keys)
-+    keys = mp.ma_keys
-     cdef size_t perturb
--    cdef size_t mask = <size_t> keys.dk_size-1
-+    cdef size_t mask = DK_MASK(keys)
-     cdef PyDictKeyEntry *entries = DK_ENTRIES(keys)
-     cdef PyDictKeyEntry *ep
- 
-@@ -187,7 +130,7 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-         raise TypeError("del_dictitem_by_exact_value cannot be applied to a shared key dict")
- 
-     cdef size_t i = <size_t>hash & mask
--    ix = dk_get_index(keys, i)
-+    ix = dictkeys_get_index(keys, i)
- 
-     if ix == DKIX_EMPTY:
-         # key not found
-@@ -196,9 +139,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-     ep = &(entries[ix])
-     perturb = hash
-     while (ep.me_value != value or ep.me_hash != hash):
--        perturb = perturb >> 5 #this is the value of PERTURB_SHIFT
-+        perturb = perturb >> PERTURB_SHIFT
-         i = mask & (i * 5 + perturb + 1)
--        ix = dk_get_index(keys, i)
-+        ix = dictkeys_get_index(keys, i)
-         if ix == DKIX_EMPTY:
-             # key not found
-             return 0
-@@ -206,7 +149,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
- 
-     # We need the lookup function to be the generic lookdict, otherwise
-     # deletions may not work correctly
--    keys.dk_lookup = lookdict
-+    IF HAS_DK_LOOKUP:
-+        # Can this fail? In any case dk_lookup was removed in python 3.11
-+        assert DK_LOOKUP(keys) is lookdict
- 
-     T = PyList_New(2)
-     PyList_SetItem(T, 0, ep.me_key)
-@@ -214,7 +159,7 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-     ep.me_key = NULL
-     ep.me_value = NULL
-     mp.ma_used -= 1
--    dk_set_index(keys, i, DKIX_DUMMY)
-+    dictkeys_set_index(keys, i, DKIX_DUMMY)
-     #We have transferred the to-be-deleted references to the list T
-     #we now delete the list so that the actual decref happens through a
-     #deallocation routine that uses the Python Trashcan macros to
-diff --git a/src/sage/cpython/dict_internal.h b/src/sage/cpython/dict_internal.h
-new file mode 100644
-index 00000000000..06c7a16b275
---- /dev/null
-+++ b/src/sage/cpython/dict_internal.h
-@@ -0,0 +1,165 @@
-+/* This contains internal definitions for python dictionaries,
-+ * mostly copied from cpython sourcecode.
-+ *
-+ * Moved here to make it easier to maintain in the face of python
-+ * changes.
-+ * */
-+
-+/************************************************************/
-+/* Copied verbatim from cpython 3.8 (Objects/dict-common.h) */
-+/************************************************************/
-+
-+#ifndef Py_DICT_COMMON_H
-+#define Py_DICT_COMMON_H
-+
-+typedef struct {
-+    /* Cached hash code of me_key. */
-+    Py_hash_t me_hash;
-+    PyObject *me_key;
-+    PyObject *me_value; /* This field is only meaningful for combined tables */
-+} PyDictKeyEntry;
-+
-+/* dict_lookup_func() returns index of entry which can be used like DK_ENTRIES(dk)[index].
-+ * -1 when no entry found, -3 when compare raises error.
-+ */
-+typedef Py_ssize_t (*dict_lookup_func)
-+    (PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr);
-+
-+#define DKIX_EMPTY (-1)
-+#define DKIX_DUMMY (-2)  /* Used internally */
-+#define DKIX_ERROR (-3)
-+
-+/* See dictobject.c for actual layout of DictKeysObject */
-+struct _dictkeysobject {
-+    Py_ssize_t dk_refcnt;
-+
-+    /* Size of the hash table (dk_indices). It must be a power of 2. */
-+    Py_ssize_t dk_size;
-+
-+    /* Function to lookup in the hash table (dk_indices):
-+
-+       - lookdict(): general-purpose, and may return DKIX_ERROR if (and
-+         only if) a comparison raises an exception.
-+
-+       - lookdict_unicode(): specialized to Unicode string keys, comparison of
-+         which can never raise an exception; that function can never return
-+         DKIX_ERROR.
-+
-+       - lookdict_unicode_nodummy(): similar to lookdict_unicode() but further
-+         specialized for Unicode string keys that cannot be the <dummy> value.
-+
-+       - lookdict_split(): Version of lookdict() for split tables. */
-+    dict_lookup_func dk_lookup;
-+
-+    /* Number of usable entries in dk_entries. */
-+    Py_ssize_t dk_usable;
-+
-+    /* Number of used entries in dk_entries. */
-+    Py_ssize_t dk_nentries;
-+
-+    /* Actual hash table of dk_size entries. It holds indices in dk_entries,
-+       or DKIX_EMPTY(-1) or DKIX_DUMMY(-2).
-+
-+       Indices must be: 0 <= indice < USABLE_FRACTION(dk_size).
-+
-+       The size in bytes of an indice depends on dk_size:
-+
-+       - 1 byte if dk_size <= 0xff (char*)
-+       - 2 bytes if dk_size <= 0xffff (int16_t*)
-+       - 4 bytes if dk_size <= 0xffffffff (int32_t*)
-+       - 8 bytes otherwise (int64_t*)
-+
-+       Dynamically sized, SIZEOF_VOID_P is minimum. */
-+    char dk_indices[];  /* char is required to avoid strict aliasing. */
-+
-+    /* "PyDictKeyEntry dk_entries[dk_usable];" array follows:
-+       see the DK_ENTRIES() macro */
-+};
-+
-+#endif
-+
-+
-+/***********************************************************/
-+/* Copied verbatim from cpython 3.8 (Objects/dictobject.c) */
-+/***********************************************************/
-+
-+#define PERTURB_SHIFT 5
-+#define DK_SIZE(dk) ((dk)->dk_size)
-+#if SIZEOF_VOID_P > 4
-+#define DK_IXSIZE(dk)                          \
-+    (DK_SIZE(dk) <= 0xff ?                     \
-+        1 : DK_SIZE(dk) <= 0xffff ?            \
-+            2 : DK_SIZE(dk) <= 0xffffffff ?    \
-+                4 : sizeof(int64_t))
-+#else
-+#define DK_IXSIZE(dk)                          \
-+    (DK_SIZE(dk) <= 0xff ?                     \
-+        1 : DK_SIZE(dk) <= 0xffff ?            \
-+            2 : sizeof(int32_t))
-+#endif
-+#define DK_ENTRIES(dk) \
-+    ((PyDictKeyEntry*)(&((int8_t*)((dk)->dk_indices))[DK_SIZE(dk) * DK_IXSIZE(dk)]))
-+
-+#define DK_MASK(dk) (((dk)->dk_size)-1)
-+
-+/* lookup indices.  returns DKIX_EMPTY, DKIX_DUMMY, or ix >=0 */
-+static inline Py_ssize_t
-+dictkeys_get_index(PyDictKeysObject *keys, Py_ssize_t i)
-+{
-+    Py_ssize_t s = DK_SIZE(keys);
-+    Py_ssize_t ix;
-+
-+    if (s <= 0xff) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    else if (s <= 0xffff) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (s > 0xffffffff) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    assert(ix >= DKIX_DUMMY);
-+    return ix;
-+}
-+
-+/* write to indices. */
-+static inline void
-+dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+{
-+    Py_ssize_t s = DK_SIZE(keys);
-+
-+    assert(ix >= DKIX_DUMMY);
-+
-+    if (s <= 0xff) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        assert(ix <= 0x7f);
-+        indices[i] = (char)ix;
-+    }
-+    else if (s <= 0xffff) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fff);
-+        indices[i] = (int16_t)ix;
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (s > 0xffffffff) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        indices[i] = ix;
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fffffff);
-+        indices[i] = (int32_t)ix;
-+    }
-+}
-+
-+/************************************************************/
--- 
-2.38.1
-
-
-From 76040803c8ae150baef449edce67ebdafb2ee896 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Nov 2022 11:53:24 -0300
-Subject: [PATCH 02/11] dict_del_by_value: add internal definitions for python
- 3.11
-
----
- src/sage/cpython/dict_internal.h | 77 ++++++++++++++++++++++++++++++++
- 1 file changed, 77 insertions(+)
-
-diff --git a/src/sage/cpython/dict_internal.h b/src/sage/cpython/dict_internal.h
-index 06c7a16b275..42a57bcb468 100644
---- a/src/sage/cpython/dict_internal.h
-+++ b/src/sage/cpython/dict_internal.h
-@@ -5,6 +5,8 @@
-  * changes.
-  * */
- 
-+#if PY_VERSION_HEX < 0x30b0000
-+
- /************************************************************/
- /* Copied verbatim from cpython 3.8 (Objects/dict-common.h) */
- /************************************************************/
-@@ -163,3 +165,78 @@ dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
- }
- 
- /************************************************************/
-+
-+#else   /* Python >= 3.11 */
-+
-+#define Py_BUILD_CORE
-+#include <internal/pycore_dict.h>
-+
-+/************************************************************/
-+/* Copied verbatim from cpython 3.11 (Objects/dictobject.c) */
-+/************************************************************/
-+
-+#define PERTURB_SHIFT 5
-+#define DK_MASK(dk) (DK_SIZE(dk)-1)
-+
-+/* lookup indices.  returns DKIX_EMPTY, DKIX_DUMMY, or ix >=0 */
-+static inline Py_ssize_t
-+dictkeys_get_index(const PyDictKeysObject *keys, Py_ssize_t i)
-+{
-+    int log2size = DK_LOG_SIZE(keys);
-+    Py_ssize_t ix;
-+
-+    if (log2size < 8) {
-+        const int8_t *indices = (const int8_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    else if (log2size < 16) {
-+        const int16_t *indices = (const int16_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (log2size >= 32) {
-+        const int64_t *indices = (const int64_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#endif
-+    else {
-+        const int32_t *indices = (const int32_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    assert(ix >= DKIX_DUMMY);
-+    return ix;
-+}
-+
-+/* write to indices. */
-+static inline void
-+dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+{
-+    int log2size = DK_LOG_SIZE(keys);
-+
-+    assert(ix >= DKIX_DUMMY);
-+    assert(keys->dk_version == 0);
-+
-+    if (log2size < 8) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        assert(ix <= 0x7f);
-+        indices[i] = (char)ix;
-+    }
-+    else if (log2size < 16) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fff);
-+        indices[i] = (int16_t)ix;
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (log2size >= 32) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        indices[i] = ix;
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fffffff);
-+        indices[i] = (int32_t)ix;
-+    }
-+}
-+
-+#endif
--- 
-2.38.1
-
-
-From 014c2ac9a6f6de25d4e31fe0bdaf819e9c67d24b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 06:47:18 -0300
-Subject: [PATCH 03/11] deprecated uu -> base64
-
----
- src/sage/rings/polynomial/pbori/gbrefs.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/rings/polynomial/pbori/gbrefs.py b/src/sage/rings/polynomial/pbori/gbrefs.py
-index 76e3924715d..70dc795cbab 100644
---- a/src/sage/rings/polynomial/pbori/gbrefs.py
-+++ b/src/sage/rings/polynomial/pbori/gbrefs.py
-@@ -1,6 +1,6 @@
- import gzip
- from io import StringIO
--import uu
-+import base64 as uu
- import re
- from types import ModuleType
- from .PyPolyBoRi import Polynomial
--- 
-2.38.1
-
-
-From dc8e155994a870a5e0b01a690a3fec8975197973 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 06:47:34 -0300
-Subject: [PATCH 04/11] sage.misc.fpickle: fix for python 3.11
-
----
- src/sage/misc/fpickle.pyx | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/src/sage/misc/fpickle.pyx b/src/sage/misc/fpickle.pyx
-index 502080e2c10..c5d544765bb 100644
---- a/src/sage/misc/fpickle.pyx
-+++ b/src/sage/misc/fpickle.pyx
-@@ -34,6 +34,12 @@ def reduce_code(co):
-         sage: def foo(N): return N+1
-         sage: sage.misc.fpickle.reduce_code(foo.__code__)
-         (<cyfunction code_ctor at ...>, ...)
-+
-+    Test that the constructed code matches the original code:
-+
-+        sage: ctor, args = sage.misc.fpickle.reduce_code(foo.__code__)
-+        sage: ctor(*args) == foo.__code__
-+        True
-     """
-     if co.co_freevars or co.co_cellvars:
-         raise ValueError("Cannot pickle code objects from closures")
-@@ -44,7 +50,12 @@ def reduce_code(co):
-     co_args += (co.co_kwonlyargcount, co.co_nlocals,
-                 co.co_stacksize, co.co_flags, co.co_code,
-                 co.co_consts, co.co_names, co.co_varnames, co.co_filename,
--                co.co_name, co.co_firstlineno, co.co_lnotab)
-+                co.co_name)
-+    if sys.version_info.minor >= 11:
-+        co_args += (co.co_qualname, co.co_firstlineno,
-+                    co.co_linetable, co.co_exceptiontable)
-+    else:
-+        co_args += (co.co_firstlineno, co.co_lnotab)
- 
-     return (code_ctor, co_args)
- 
--- 
-2.38.1
-
-
-From 8b0dac2322d4a888c607c56d3b5a72ff71df4147 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 08:15:43 -0300
-Subject: [PATCH 05/11] Fix FullArgSpec usage after
- 9eb08f3afde3266bbd667e196513240a0fe245f4
-
- - `kwonlydefaults` default is `[]` rather than `{}`
- - `argspec.keywords` changed to `argspec.varkw`
- - `ArgSpec` changed to `FullArgSpec`
----
- src/sage/coding/abstract_code.py | 2 +-
- src/sage/misc/decorators.py      | 7 ++++---
- src/sage/misc/sageinspect.py     | 9 +++++----
- 3 files changed, 10 insertions(+), 8 deletions(-)
-
-diff --git a/src/sage/coding/abstract_code.py b/src/sage/coding/abstract_code.py
-index ba2ec68a038..238a165c021 100644
---- a/src/sage/coding/abstract_code.py
-+++ b/src/sage/coding/abstract_code.py
-@@ -123,7 +123,7 @@ def _explain_constructor(cl):
-         reqs = "The constructor requires the arguments {}.".format(args)
-     else:
-         reqs = "The constructor requires no arguments."
--    if argspec.varargs or argspec.keywords:
-+    if argspec.varargs or argspec.varkw:
-         var = "It accepts unspecified arguments as well.\n"
-     else:
-         var = ""
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 311a5105739..271e243050f 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -423,7 +423,8 @@ class suboptions():
-             defaults = (argspec.defaults if argspec.defaults is not None else ()) \
-                         + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
-+            return FullArgSpec(args, argspec.varargs, argspec.varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
-         wrapper._sage_argspec_ = argspec
- 
-         return wrapper
-@@ -500,8 +501,8 @@ class options():
-                     list(self.options))
-             defaults = (argspec.defaults or ()) + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return FullArgSpec(args, argspec.varargs, argspec.keywords, defaults,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+            return FullArgSpec(args, argspec.varargs, argspec.varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         wrapper._sage_argspec_ = argspec
- 
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index a3821cb56b9..ce9a74f931d 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -1137,7 +1137,7 @@ def _sage_getargspec_from_ast(source):
- 
-     return inspect.FullArgSpec(args, vararg, kwarg,
-                                tuple(defaults) if defaults else None,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
- def _sage_getargspec_cython(source):
-@@ -1683,7 +1683,8 @@ def sage_getargspec(obj):
-         # Note that this may give a wrong result for the constants!
-         try:
-             args, varargs, varkw = inspect.getargs(obj.__code__)
--            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__)
-+            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__,
-+                                       kwonlyargs=[], kwonlydefaults=None, annotations={})
-         except (TypeError, AttributeError):
-             pass
-     if isclassinstance(obj):
-@@ -1742,7 +1743,7 @@ def sage_getargspec(obj):
-     except AttributeError:
-         defaults = None
-     return inspect.FullArgSpec(args, varargs, varkw, defaults,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
- def formatannotation(annotation, base_module=None):
-@@ -1788,7 +1789,7 @@ def formatannotation(annotation, base_module=None):
- 
- 
- def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
--                       kwonlyargs=(), kwonlydefaults={}, annotations={},
-+                       kwonlyargs=(), kwonlydefaults=None, annotations={},
-                        formatarg=str,
-                        formatvarargs=lambda name: '*' + name,
-                        formatvarkw=lambda name: '**' + name,
--- 
-2.38.1
-
-
-From db45aebfd6bd8413bec0fda218410d72deacd398 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 07:13:38 -0300
-Subject: [PATCH 06/11] warnings: ignore deprecation for 'import cgi' in cython
-
----
- src/sage/all.py | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index 6aef26c42a9..92d36d1fd26 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -104,6 +104,11 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message='The distutils(.sysconfig module| package) is deprecated',
-                         module='Cython|distutils|numpy|sage.env|sage.features')
- 
-+# triggered by cython 0.29.32
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message="'cgi' is deprecated and slated for removal in Python 3.13",
-+                        module='Cython')
-+
- ################ end setup warnings ###############################
- 
- 
--- 
-2.38.1
-
-
-From 664fc008ed50c2f61fb3df3020c0d81b41170628 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 20:39:12 -0300
-Subject: [PATCH 07/11] warnings: ignore deprecation for 'import sre_constants'
- in pyparsing
-
----
- src/sage/all.py | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index 92d36d1fd26..ea0712308b4 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -109,6 +109,11 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message="'cgi' is deprecated and slated for removal in Python 3.13",
-                         module='Cython')
- 
-+# triggered by pyparsing 2.4.7
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message="module 'sre_constants' is deprecated",
-+                        module='pyparsing')
-+
- ################ end setup warnings ###############################
- 
- 
--- 
-2.38.1
-
-
-From 08e1161c23caeeed5ad0e0237df8172eb8806ee5 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:40:17 -0300
-Subject: [PATCH 08/11] warnings: ignore deprecation of
- importlib.resources.path/read_binary
-
----
- src/sage/all.py                    | 6 ++++++
- src/sage/repl/display/formatter.py | 3 +++
- 2 files changed, 9 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index ea0712308b4..fedf2a17aab 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -114,6 +114,12 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message="module 'sre_constants' is deprecated",
-                         module='pyparsing')
- 
-+# importlib.resources.path and ...read_binary are deprecated in python 3.11,
-+# but the replacement importlib.resources.files needs python 3.9
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message=r'(path|read_binary) is deprecated\. Use files\(\) instead\.',
-+                        module='sage.repl.rich_output.output_(graphics|graphics3d|video)')
-+
- ################ end setup warnings ###############################
- 
- 
-diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py
-index 488f0bf2791..7e06656d880 100644
---- a/src/sage/repl/display/formatter.py
-+++ b/src/sage/repl/display/formatter.py
-@@ -143,6 +143,9 @@ class SageDisplayFormatter(DisplayFormatter):
- 
-             sage: import os
-             sage: import importlib.resources
-+            sage: import warnings
-+            sage: warnings.filterwarnings('ignore', category=DeprecationWarning,
-+            ....:     message=r'path is deprecated\. Use files\(\) instead\.')
-             sage: from sage.repl.rich_output.backend_ipython import BackendIPython
-             sage: backend = BackendIPython()
-             sage: shell = get_test_shell()
--- 
-2.38.1
-
-
-From 44480f4827e2bc1ed8daf6f4504a22ae6e8be4a4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 07:14:01 -0300
-Subject: [PATCH 09/11] doctests: fixes due to ArgSpec -> FullArgSpec change
-
----
- src/sage/interfaces/singular.py            |  3 +-
- src/sage/libs/singular/standard_options.py |  3 +-
- src/sage/misc/cachefunc.pyx                |  6 +-
- src/sage/misc/decorators.py                |  9 ++-
- src/sage/misc/lazy_import.pyx              |  4 +-
- src/sage/misc/sageinspect.py               | 94 ++++++++++------------
- src/sage/parallel/decorate.py              |  3 +-
- src/sage/plot/plot3d/plot3d.py             | 18 +++--
- src/sage/sets/set_from_iterator.py         |  4 +-
- 9 files changed, 76 insertions(+), 68 deletions(-)
-
-diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
-index 9c9586d8bc7..1dea77cdff0 100644
---- a/src/sage/interfaces/singular.py
-+++ b/src/sage/interfaces/singular.py
-@@ -2734,7 +2734,8 @@ def singular_gb_standard_options(func):
-         sage: P.<x,y> = QQ[]
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.interreduced_basis)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getsourcelines(I.interreduced_basis)
-         (['    @handle_AA_and_QQbar\n',
-           '    @singular_gb_standard_options\n',
-diff --git a/src/sage/libs/singular/standard_options.py b/src/sage/libs/singular/standard_options.py
-index 6797cb05001..5d74da3ce3a 100644
---- a/src/sage/libs/singular/standard_options.py
-+++ b/src/sage/libs/singular/standard_options.py
-@@ -117,7 +117,8 @@ def libsingular_gb_standard_options(func):
-         sage: P.<x,y> = QQ[]
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.interreduced_basis)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getsourcelines(I.interreduced_basis)
-         (['    @handle_AA_and_QQbar\n',
-           '    @singular_gb_standard_options\n',
-diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx
-index 72042ef13d6..cea3071115d 100644
---- a/src/sage/misc/cachefunc.pyx
-+++ b/src/sage/misc/cachefunc.pyx
-@@ -931,9 +931,9 @@ cdef class CachedFunction():
-             sage: I = P*[x,y]
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(I.groebner_basis)   # indirect doctest
--            ArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
--            varargs='args', keywords='kwds', defaults=('', None, None,
--            False))
-+            FullArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
-+                        varargs='args', varkw='kwds', defaults=('', None, None, False),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         """
-         return sage_getargspec(self.f)
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 271e243050f..dd9123f5004 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -93,7 +93,8 @@ def sage_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
-         5
-         sage: from sage.misc.sageinspect import sage_getargspec
-         sage: sage_getargspec(g)
--        ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['x'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Demonstrate that it correctly gets the source lines and the source
-     file, which is essential for interactive code edition; note that we
-@@ -392,7 +393,8 @@ class suboptions():
- 
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(f)
--            ArgSpec(args=['arrow_size'], varargs='args', keywords='kwds', defaults=(2,))
-+            FullArgSpec(args=['arrow_size'], varargs='args', varkw='kwds', defaults=(2,),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         @sage_wraps(func)
-         def wrapper(*args, **kwds):
-@@ -460,7 +462,8 @@ class options():
-             sage: f1 = o(f)
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(f1)
--            ArgSpec(args=['rgbcolor'], varargs='args', keywords='kwds', defaults=((0, 0, 1),))
-+            FullArgSpec(args=['rgbcolor'], varargs='args', varkw='kwds', defaults=((0, 0, 1),),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         self.options = options
-         self.original_opts = options.pop('__original_opts', False)
-diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx
-index 2d4413cd1a3..018078b0cf2 100644
---- a/src/sage/misc/lazy_import.pyx
-+++ b/src/sage/misc/lazy_import.pyx
-@@ -351,7 +351,9 @@ cdef class LazyImport():
-             sage: from sage.misc.lazy_import import LazyImport
-             sage: rm = LazyImport('sage.all', 'random_matrix')
-             sage: rm._sage_argspec_()
--            ArgSpec(args=['ring', 'nrows', 'ncols', 'algorithm', 'implementation'], varargs='args', keywords='kwds', defaults=(None, 'randomize', None))
-+            FullArgSpec(args=['ring', 'nrows', 'ncols', 'algorithm', 'implementation'],
-+                        varargs='args', varkw='kwds', defaults=(None, 'randomize', None),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         return sageinspect.sage_getargspec(self.get_object())
- 
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index ce9a74f931d..619ff6da661 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -109,7 +109,7 @@ defined Cython code, and with rather tricky argument lines::
-     sage: print(sage_getsource(foo))                                                                        # optional - sage.misc.cython
-     def foo(unsigned int x=1, a=')"', b={not (2+1==3):'bar'}, *args, **kwds): return
-     sage: sage_getargspec(foo)                                                                              # optional - sage.misc.cython
--    ArgSpec(args=['x', 'a', 'b'], varargs='args', keywords='kwds', defaults=(1, ')"', {False: 'bar'}))
-+    FullArgSpec(args=['x', 'a', 'b'], varargs='args', varkw='kwds', defaults=(1, ')"', {False: 'bar'}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- """
- 
-@@ -343,7 +343,7 @@ def _extract_embedded_signature(docstring, name):
-         File: sage/misc/nested_class.pyx (starting at line ...)
-         ...
-         sage: _extract_embedded_signature(MainClass.NestedClass.NestedSubClass.dummy.__doc__, 'dummy')[1]
--        ArgSpec(args=['self', 'x', 'r'], varargs='args', keywords='kwds', defaults=((1, 2, 3.4),))
-+        FullArgSpec(args=['self', 'x', 'r'], varargs='args', varkw='kwds', defaults=((1, 2, 3.4),), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _extract_embedded_signature(range.__call__.__doc__, '__call__')
-         ('Call self as a function.', None)
-     """
-@@ -1107,22 +1107,18 @@ def _sage_getargspec_from_ast(source):
- 
-     EXAMPLES::
- 
--        sage: import warnings
--        sage: warnings.filterwarnings('ignore',
--        ....:                         r'inspect.getargspec\(\) is deprecated',
--        ....:                         DeprecationWarning)
-         sage: import inspect, sage.misc.sageinspect as sms
-         sage: from_ast = sms._sage_getargspec_from_ast
-         sage: s = "def f(a, b=2, c={'a': [4, 5.5, False]}, d=(None, True)):\n    return"
-         sage: from_ast(s)
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)))
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: context = {}
-         sage: exec(compile(s, '<string>', 'single'), context)
--        sage: inspect.getargspec(context['f'])
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)))
--        sage: from_ast(s) == inspect.getargspec(context['f'])
-+        sage: inspect.getfullargspec(context['f'])
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)), kwonlyargs=[], kwonlydefaults=None, annotations={})
-+        sage: from_ast(s) == inspect.getfullargspec(context['f'])
-         True
--        sage: set(from_ast(sms.sage_getsource(x)) == inspect.getargspec(x) for x in [factor, identity_matrix, Graph.__init__])
-+        sage: set(from_ast(sms.sage_getsource(x)) == inspect.getfullargspec(x) for x in [factor, identity_matrix, Graph.__init__])
-         {True}
-     """
-     ast_args = ast.parse(source.lstrip()).body[0].args
-@@ -1159,23 +1155,23 @@ def _sage_getargspec_cython(source):
- 
-         sage: from sage.misc.sageinspect import _sage_getargspec_cython as sgc
-         sage: sgc("cpdef double abc(self, Element x=None, Parent base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc("def __init__(self, x=None, unsigned int base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def o(p, r={}, *q, **s) except? -1:')
--        ArgSpec(args=['p', 'r'], varargs='q', keywords='s', defaults=({},))
-+        FullArgSpec(args=['p', 'r'], varargs='q', varkw='s', defaults=({},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('cpdef how(r=(None, "u:doing?")):')
--        ArgSpec(args=['r'], varargs=None, keywords=None, defaults=((None, 'u:doing?'),))
-+        FullArgSpec(args=['r'], varargs=None, varkw=None, defaults=((None, 'u:doing?'),), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def _(x="):"):')
--        ArgSpec(args=['x'], varargs=None, keywords=None, defaults=('):',))
-+        FullArgSpec(args=['x'], varargs=None, varkw=None, defaults=('):',), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(z = {(1, 2, 3): True}):\n    return z')
--        ArgSpec(args=['z'], varargs=None, keywords=None, defaults=({(1, 2, 3): True},))
-+        FullArgSpec(args=['z'], varargs=None, varkw=None, defaults=({(1, 2, 3): True},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(double x, z = {(1, 2, 3): True}):\n    return z')
--        ArgSpec(args=['x', 'z'], varargs=None, keywords=None, defaults=({(1, 2, 3): True},))
-+        FullArgSpec(args=['x', 'z'], varargs=None, varkw=None, defaults=({(1, 2, 3): True},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(*args): pass')
--        ArgSpec(args=[], varargs='args', keywords=None, defaults=None)
-+        FullArgSpec(args=[], varargs='args', varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(**args): pass')
--        ArgSpec(args=[], varargs=None, keywords='args', defaults=None)
-+        FullArgSpec(args=[], varargs=None, varkw='args', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Some malformed input is detected::
- 
-@@ -1207,17 +1203,17 @@ def _sage_getargspec_cython(source):
- 
-         sage: def dummy_python(self, *args, x=1): pass
-         sage: sgc("def dummy_python(self, *args, x=1): pass")
--        ArgSpec(args=['self', 'x'], varargs='args', keywords=None, defaults=(1,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: cython("def dummy_cython(self, *args, x=1): pass")
-         sage: sgc("def dummy_cython(self, *args, x=1): pass")
--        ArgSpec(args=['self', 'x'], varargs='args', keywords=None, defaults=(1,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In some examples above, a syntax error was raised when a type
-     definition contains a pointer. An exception is made for ``char*``,
-     since C strings are acceptable input in public Cython functions::
- 
-         sage: sgc('def f(char *x = "a string", z = {(1,2,3): True}): pass')
--        ArgSpec(args=['x', 'z'], varargs=None, keywords=None, defaults=('a string', {(1, 2, 3): True}))
-+        FullArgSpec(args=['x', 'z'], varargs=None, varkw=None, defaults=('a string', {(1, 2, 3): True}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
-     AUTHORS:
-@@ -1503,40 +1499,40 @@ def sage_getargspec(obj):
-         sage: def f(x, y, z=1, t=2, *args, **keywords):
-         ....:     pass
-         sage: sage_getargspec(f)
--        ArgSpec(args=['x', 'y', 'z', 't'], varargs='args', keywords='keywords', defaults=(1, 2))
-+        FullArgSpec(args=['x', 'y', 'z', 't'], varargs='args', varkw='keywords', defaults=(1, 2), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     We now run sage_getargspec on some functions from the Sage library::
- 
-         sage: sage_getargspec(identity_matrix)
--        ArgSpec(args=['ring', 'n', 'sparse'], varargs=None, keywords=None, defaults=(0, False))
-+        FullArgSpec(args=['ring', 'n', 'sparse'], varargs=None, varkw=None, defaults=(0, False), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(factor)
--        ArgSpec(args=['n', 'proof', 'int_', 'algorithm', 'verbose'], varargs=None, keywords='kwds', defaults=(None, False, 'pari', 0))
-+        FullArgSpec(args=['n', 'proof', 'int_', 'algorithm', 'verbose'], varargs=None, varkw='kwds', defaults=(None, False, 'pari', 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In the case of a class or a class instance, the ``ArgSpec`` of the
-     ``__new__``, ``__init__`` or ``__call__`` method is returned::
- 
-         sage: P.<x,y> = QQ[]
-         sage: sage_getargspec(P)
--        ArgSpec(args=['base_ring', 'n', 'names', 'order'], varargs=None, keywords=None, defaults=('degrevlex',))
-+        FullArgSpec(args=['base_ring', 'n', 'names', 'order'], varargs=None, varkw=None, defaults=('degrevlex',), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(P.__class__)
--        ArgSpec(args=['self', 'x'], varargs='args', keywords='kwds', defaults=(0,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw='kwds', defaults=(0,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following tests against various bugs that were fixed in
-     :trac:`9976`::
- 
-         sage: from sage.rings.polynomial.real_roots import bernstein_polynomial_factory_ratlist
-         sage: sage_getargspec(bernstein_polynomial_factory_ratlist.coeffs_bitsize)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: from sage.rings.polynomial.pbori.pbori import BooleanMonomialMonoid
-         sage: sage_getargspec(BooleanMonomialMonoid.gen)
--        ArgSpec(args=['self', 'i'], varargs=None, keywords=None, defaults=(0,))
-+        FullArgSpec(args=['self', 'i'], varargs=None, varkw=None, defaults=(0,), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.groebner_basis)
--        ArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
--        varargs='args', keywords='kwds', defaults=('', None, None, False))
-+        FullArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
-+        varargs='args', varkw='kwds', defaults=('', None, None, False), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: cython("cpdef int foo(x,y) except -1: return 1")
-         sage: sage_getargspec(foo)
--        ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['x', 'y'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     If a ``functools.partial`` instance is involved, we see no other meaningful solution
-     than to return the argspec of the underlying function::
-@@ -1546,7 +1542,7 @@ def sage_getargspec(obj):
-         sage: import functools
-         sage: f1 = functools.partial(f, 1,c=2)
-         sage: sage_getargspec(f1)
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(1,))
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     TESTS:
- 
-@@ -1572,14 +1568,14 @@ def sage_getargspec(obj):
-         sage: print(sage.misc.sageinspect.sage_getsource(O))
-         def foo(x, a=')"', b={(2+1):'bar', not 1:3, 3<<4:5}): return
-         sage: spec = sage.misc.sageinspect.sage_getargspec(O)
--        sage: spec.args, spec.varargs, spec.keywords
-+        sage: spec.args, spec.varargs, spec.varkw
-         (['x', 'a', 'b'], None, None)
-         sage: spec.defaults[0]
-         ')"'
-         sage: sorted(spec.defaults[1].items(), key=lambda x: str(x))
-         [(3, 'bar'), (48, 5), (False, 3)]
-         sage: sage.misc.sageinspect.sage_getargspec(O.__call__)
--        ArgSpec(args=['self', 'm', 'n'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self', 'm', 'n'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     ::
- 
-@@ -1588,13 +1584,13 @@ def sage_getargspec(obj):
-         def foo(x, a='\')"', b={not (2+1==3):'bar'}): return
-         <BLANKLINE>
-         sage: sage.misc.sageinspect.sage_getargspec(foo)
--        ArgSpec(args=['x', 'a', 'b'], varargs=None, keywords=None, defaults=('\')"', {False: 'bar'}))
-+        FullArgSpec(args=['x', 'a', 'b'], varargs=None, varkw=None, defaults=('\')"', {False: 'bar'}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following produced a syntax error before the patch at :trac:`11913`,
-     see also :trac:`26906`::
- 
-         sage: sage.misc.sageinspect.sage_getargspec(r.lm)                         # optional - rpy2
--        ArgSpec(args=['self'], varargs='args', keywords='kwds', defaults=None)
-+        FullArgSpec(args=['self'], varargs='args', varkw='kwds', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following was fixed in :trac:`16309`::
- 
-@@ -1608,23 +1604,23 @@ def sage_getargspec(obj):
-         ....:     cpdef meet(categories, bint as_list = False, tuple ignore_axioms=(), tuple axioms=()): pass
-         ....: ''')
-         sage: sage_getargspec(Foo.join)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(Bar.join)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(Bar.meet)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test that :trac:`17009` is fixed::
- 
-         sage: sage_getargspec(gap)
--        ArgSpec(args=['self', 'x', 'name'], varargs=None, keywords=None, defaults=(None,))
-+        FullArgSpec(args=['self', 'x', 'name'], varargs=None, varkw=None, defaults=(None,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     By :trac:`17814`, the following gives the correct answer (previously, the
-     defaults would have been found ``None``)::
- 
-         sage: from sage.misc.nested_class import MainClass
-         sage: sage_getargspec(MainClass.NestedClass.NestedSubClass.dummy)
--        ArgSpec(args=['self', 'x', 'r'], varargs='args', keywords='kwds', defaults=((1, 2, 3.4),))
-+        FullArgSpec(args=['self', 'x', 'r'], varargs='args', varkw='kwds', defaults=((1, 2, 3.4),), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In :trac:`18249` was decided to return a generic signature for Python
-     builtin functions, rather than to raise an error (which is what Python's
-@@ -1632,7 +1628,7 @@ def sage_getargspec(obj):
- 
-         sage: import inspect
-         sage: sage_getargspec(range)
--        ArgSpec(args=[], varargs='args', keywords='kwds', defaults=None)
-+        FullArgSpec(args=[], varargs='args', varkw='kwds', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test that :trac:`28524` is fixed::
- 
-@@ -1819,14 +1815,10 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
-     EXAMPLES::
- 
-         sage: from sage.misc.sageinspect import sage_formatargspec
--        sage: from inspect import formatargspec # deprecated in Python 3
-         sage: args = ['a', 'b', 'c']
-         sage: defaults = [3]
-         sage: sage_formatargspec(args, defaults=defaults)
-         '(a, b, c=3)'
--        sage: import warnings; warnings.simplefilter('ignore')  # ignore DeprecationWarning
--        sage: formatargspec(args, defaults=defaults) == sage_formatargspec(args, defaults=defaults)
--        True
-     """
-     def formatargandannotation(arg):
-         result = formatarg(arg)
-@@ -2649,11 +2641,11 @@ def __internal_tests():
-     Test _sage_getargspec_cython with multiple default arguments and a type::
- 
-         sage: _sage_getargspec_cython("def init(self, x=None, base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _sage_getargspec_cython("def __init__(self, x=None, base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _sage_getargspec_cython("def __init__(self, x=None, unsigned int base=0, **keys):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords='keys', defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw='keys', defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test _extract_embedded_position:
- 
-diff --git a/src/sage/parallel/decorate.py b/src/sage/parallel/decorate.py
-index c14518af570..3a7152d5ac9 100644
---- a/src/sage/parallel/decorate.py
-+++ b/src/sage/parallel/decorate.py
-@@ -243,7 +243,8 @@ for a in args[0]))
-             ....:     return x + y
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(p(f))
--            ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['x', 'y'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         from sage.misc.sageinspect import sage_getargspec
-         return sage_getargspec(self.func)
-diff --git a/src/sage/plot/plot3d/plot3d.py b/src/sage/plot/plot3d/plot3d.py
-index 64b11a0442a..174765980f7 100644
---- a/src/sage/plot/plot3d/plot3d.py
-+++ b/src/sage/plot/plot3d/plot3d.py
-@@ -329,19 +329,24 @@ class _Coordinates():
-             sage: t1,t2,t3=T.to_cartesian(lambda a,b: 2*a+b)
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: sage_getargspec(t2)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: sage_getargspec(t3)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-             sage: def g(a,b): return 2*a+b
-             sage: t1,t2,t3=T.to_cartesian(g)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: t1,t2,t3=T.to_cartesian(2*a+b)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         If we cannot guess the right parameter names, then the
-         parameters are named `u` and `v`::
-@@ -352,7 +357,8 @@ class _Coordinates():
-             sage: T = _ArbitraryCoordinates((x + y, x - y, z), z,[x,y])
-             sage: t1,t2,t3=T.to_cartesian(operator.add)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['u', 'v'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['u', 'v'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: [h(1,2) for h in T.to_cartesian(operator.mul)]
-             [3.0, -1.0, 2.0]
-             sage: [h(u=1,v=2) for h in T.to_cartesian(operator.mul)]
-diff --git a/src/sage/sets/set_from_iterator.py b/src/sage/sets/set_from_iterator.py
-index 3a2360383ea..74015c4433d 100644
---- a/src/sage/sets/set_from_iterator.py
-+++ b/src/sage/sets/set_from_iterator.py
-@@ -526,7 +526,9 @@ class Decorator():
-             sage: d = Decorator()
-             sage: d.f = find_local_minimum
-             sage: sage_getargspec(d) # indirect doctest
--            ArgSpec(args=['f', 'a', 'b', 'tol', 'maxfun'], varargs=None, keywords=None, defaults=(1.48e-08, 500))
-+            FullArgSpec(args=['f', 'a', 'b', 'tol', 'maxfun'],
-+                        varargs=None, varkw=None, defaults=(1.48e-08, 500),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         from sage.misc.sageinspect import sage_getargspec
-         return sage_getargspec(self.f)
--- 
-2.38.1
-
-
-From 482dd1ac3d2bcaa94dd935e3add1a5165674b146 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:12:38 -0300
-Subject: [PATCH 10/11] doctests: AssertionError message changed in python 3.11
-
----
- src/sage/misc/lazy_format.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/misc/lazy_format.py b/src/sage/misc/lazy_format.py
-index e3050695b25..b58ea155862 100644
---- a/src/sage/misc/lazy_format.py
-+++ b/src/sage/misc/lazy_format.py
-@@ -78,7 +78,7 @@ class LazyFormat(str):
-         ....:               LazyFormat("%s is wrong")%IDontLikeBeingPrinted())
-         Traceback (most recent call last):
-         ...
--        AssertionError: <unprintable AssertionError object>
-+        AssertionError: ...
-     """
- 
-     def __mod__(self, args):
--- 
-2.38.1
-
-
-From 7b6fa565f426e28e14be3b22c202301f9d530e9e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:13:13 -0300
-Subject: [PATCH 11/11] doctests: message added more info in python 3.11
-
----
- src/sage/repl/attach.py | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/sage/repl/attach.py b/src/sage/repl/attach.py
-index 39da6ee4acd..20b848e4f04 100644
---- a/src/sage/repl/attach.py
-+++ b/src/sage/repl/attach.py
-@@ -54,6 +54,7 @@ character-by-character::
-         exec(code, globals)
-       File ".../foobar.sage....py", line ..., in <module>
-         raise ValueError("third")   # this should appear in the source snippet
-+    ...
-     ValueError: third
-     sage: detach(src)
- """
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch b/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
deleted file mode 100644
index 4c26dfdb6843..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
-index b0c80f61480..1c9a53387a0 100644
---- a/src/sage/arith/long.pxd
-+++ b/src/sage/arith/long.pxd
-@@ -124,7 +124,7 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         ....:         if err == 0:
-         ....:             return value
-         ....:         elif err == ERR_OVERFLOW:
--        ....:             raise OverflowError("integer_check_long: overflow")
-+        ....:             raise OverflowError(f"integer_check_long: overflow ({x})")
-         ....:     elif err == ERR_TYPE:
-         ....:         raise TypeError("integer_check_long: wrong type")
-         ....:     elif err == ERR_INDEX:
-@@ -136,24 +136,23 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         ....: def long_max():
-         ....:     return smallInteger(LONG_MAX)
-         ....: ''')
--        sage: types = (ZZ, QQ, int)
-         sage: L = [1, 12345, 10^9, 2^30, long_max()//9, long_max()//3, long_max()]
-         sage: L += [-x for x in L] + [0, long_min()]
-         sage: for v in L:
--        ....:     for t in (Integer, int):
-+        ....:     for t in (Integer, int, QQ):
-         ....:         assert check_long(t(v)) == v
-         sage: check_long(2^100)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long(long_max() + 1)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long(long_min() - 1)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long("hello")
-         Traceback (most recent call last):
-         ...
-@@ -162,6 +161,36 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         Traceback (most recent call last):
-         ...
-         TypeError: integer_check_long: bad __index__
-+
-+    Repeat the overflow tests with python integers:
-+
-+        sage: check_long(int(2^100))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(int(long_max() + 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(int(long_min() - 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+
-+    And again with rationals:
-+
-+        sage: check_long(QQ(2^100))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(QQ(long_max() + 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(QQ(long_min() - 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-     """
-     cdef int c = integer_check_long_py(x, value, err)
-     if c:
-@@ -193,35 +222,93 @@ cdef inline long dig(const digit* D, int n):
- 
- cdef inline bint integer_check_long_py(x, long* value, int* err):
-     """
--    Part of ``integer_check_long`` in ``long.pxd``, checking only for
--    Python objects of type ``int`` and ``long``. See that function for
--    documentation and tests.
-+    Return whether ``x`` is a python object of type ``int``.
-+
-+    If possible, compute the value of this integer as C long and store
-+    it in ``*value``.
-+
-+    Errors are returned as an error indicator ``*err`` (without raising
-+    any Python exception).
-+
-+    Possible errors when returning ``True``:
-+
-+    - ``0``: ``x`` was successfully converted to a C long and its value
-+      is stored in ``*value``.
-+
-+    - ``ERR_OVERFLOW``: ``x`` is a python object of type ``int`` but
-+      too large to store in a C long.
-+
-+    Possible errors when returning ``False``:
-+
-+    - ``ERR_TYPE``: ``x`` is not a python object of type ``int``.
-+
-+    EXAMPLES:
-+
-+    We create a pure Python wrapper of this function::
-+
-+        sage: cython('''  # optional - sage.misc.cython
-+        ....: from sage.arith.long cimport *
-+        ....: def check_long_py(x):
-+        ....:     cdef long value
-+        ....:     cdef int err
-+        ....:     cdef bint c = integer_check_long_py(x, &value, &err)
-+        ....:     if c:
-+        ....:         if err == 0:
-+        ....:             return value
-+        ....:         elif err == ERR_OVERFLOW:
-+        ....:             return f"Overflow ({x})"
-+        ....:     elif err == ERR_TYPE:
-+        ....:         return f"Bad type ({x})"
-+        ....:     return f"This should never happen ({x})"
-+        ....: from libc.limits cimport LONG_MIN, LONG_MAX
-+        ....: def long_min():
-+        ....:     return LONG_MIN
-+        ....: def long_max():
-+        ....:     return LONG_MAX
-+        ....: ''')
-+        sage: L = [1, 12345, 10^9, 2^30, long_max()//9, long_max()//3, long_max()]
-+        sage: L += [-x for x in L] + [0, long_min()]
-+        sage: for v in L:
-+        ....:     assert check_long_py(int(v)) == v
-+        sage: check_long_py(int(2^100))
-+        'Overflow (...)'
-+        sage: check_long_py(int(long_max() + 1))
-+        'Overflow (...)'
-+        sage: check_long_py(int(long_min() - 1))
-+        'Overflow (...)'
-+        sage: check_long_py(389)
-+        'Bad type (...)'
-+        sage: check_long_py("hello")
-+        'Bad type (...)'
-+        sage: check_long_py(2/3)
-+        'Bad type (...)'
-     """
--    if not isinstance(x, long):
--        if isinstance(x, int):
--            # This can happen only on Python 2
--            value[0] = PyInt_AS_LONG(x)
--            err[0] = 0
--            return 1
-+    if not isinstance(x, int):
-         err[0] = ERR_TYPE
-         return 0
- 
--    # x is a Python "long" (called "int" on Python 3)
-+    # x is a Python "int" (aka PyLongObject or py_long in cython)
-     cdef const digit* D = (<py_long>x).ob_digit
-     cdef Py_ssize_t size = Py_SIZE(x)
- 
--    # We assume that PyLong_SHIFT is 15 on a 32-bit system and 30 on a
--    # 64-bit system. This is not guaranteed by Python, but it is the
--    # default configuration.
-+    # We assume PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT.
-+    # This is true in all the default configurations:
-+    # - BITS_IN_LONG = 63, PyLong_SHIFT = 30
-+    # - BITS_IN_LONG = 31, PyLong_SHIFT = 15 (python <= 3.10)
-+    # - BITS_IN_LONG = 31, PyLong_SHIFT = 30 (new in python 3.11)
-+    # cf. https://trac.sagemath.org/ticket/33842#comment:130
-     #
--    # This way, we know that 1 and 2 digits certainly fit in a C long
--    # and 4 or more digits never fit. For 3 digits, we need an explicit
--    # overflow check.
-+    # This way, we know that 1 digit certainly fits in a C long
-+    # and 4 or more digits never fit.
-+    # For 2 or 3 digits, we need an explicit overflow check.
-     cdef int BITS_IN_LONG = 8 * sizeof(long) - 1
--    if not (2 * PyLong_SHIFT <= BITS_IN_LONG < 4 * PyLong_SHIFT):
--        raise AssertionError
-+    if not (PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT):
-+        raise AssertionError(
-+                f"PyLong_SHIFT = {PyLong_SHIFT}, "
-+                f"BITS_IN_LONG = {BITS_IN_LONG}")
- 
-     cdef long lead
-+    cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
-     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
-     if size == 0:
-         value[0] = 0
-@@ -233,9 +320,20 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
-         value[0] = -dig(D, 0)
-         err[0] = 0
-     elif size == 2:
-+        if BITS_IN_LONG < 2 * PyLong_SHIFT and D[1] >= lead_2_overflow:
-+            err[0] = ERR_OVERFLOW
-+            return 1
-         value[0] = dig(D, 0) + dig(D, 1)
-         err[0] = 0
-     elif size == -2:
-+        if BITS_IN_LONG < 2 * PyLong_SHIFT and D[1] >= lead_2_overflow:
-+            if D[0] == 0 and D[1] == lead_2_overflow:
-+                # Special case for LONG_MIN
-+                value[0] = (<long>-1) << BITS_IN_LONG
-+                err[0] = 0
-+            else:
-+                err[0] = ERR_OVERFLOW
-+            return 1
-         value[0] = -(dig(D, 0) + dig(D, 1))
-         err[0] = 0
-     elif size == 3:
diff --git a/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch b/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
deleted file mode 100644
index 977a42400e59..000000000000
--- a/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-commit 5db5d4e56243c609f44afc1f21c112b026f9e1fe
-Author: Oscar Benjamin <oscar.j.benjamin@gmail.com>
-Date:   Mon Jul 11 21:24:01 2022 +0100
-
-    Update doctests for SymPy 1.11
-    
-    Doctests related to SymPy's rsolve function are updated in:
-    
-    src/sage/calculus/test_sympy.py
-    src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-    
-    The form of the output from SymPy has changed since
-    
-    https://github.com/sympy/sympy/pull/23567
-
-diff --git a/src/sage/calculus/test_sympy.py b/src/sage/calculus/test_sympy.py
-index 7cf7f3f6bfd..927e6ee4fb6 100644
---- a/src/sage/calculus/test_sympy.py
-+++ b/src/sage/calculus/test_sympy.py
-@@ -193,7 +193,7 @@ This was fixed in Sympy, see :trac:`14437`::
-     sage: u = Function('u')
-     sage: n = Symbol('n', integer=True)
-     sage: f = u(n+2) - u(n+1) + u(n)/4
--    sage: 2**n * rsolve(f,u(n))
--    C1*n + C0
-+    sage: expand(2**n * rsolve(f,u(n)))
-+    2*C1*n + C0
- 
- """
-diff --git a/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py b/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-index 1062f4f7e8c..f53f813d793 100644
---- a/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-+++ b/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-@@ -382,7 +382,7 @@ Sage example in ./recequadiff.tex, line 1798::
-   sage: from sympy import rsolve_hyper
-   sage: from sympy.abc import n
-   sage: rsolve_hyper([-2,1],2**(n+2),n)
--  2**n*C0 + 2**(n + 2)*(C0 + n/2)
-+  2**n*C0 + 2**(n + 1)*n
- 
- """
- 
diff --git a/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch b/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
deleted file mode 100644
index b544a3eef7dd..000000000000
--- a/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
+++ /dev/null
@@ -1,526 +0,0 @@
-From aeff992d53a65a705dca5cd5216bcb97c218dce7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:14:03 +0200
-Subject: Adapt to API changes in OpenOutputStream and CloseOutput
-
----
- src/sage/libs/gap/element.pyx      | 5 +++--
- src/sage/libs/gap/gap_includes.pxd | 6 ++++--
- 2 files changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
-index be43c4c..e268116 100644
---- a/src/sage/libs/gap/element.pyx
-+++ b/src/sage/libs/gap/element.pyx
-@@ -130,6 +130,7 @@ cdef char *capture_stdout(Obj func, Obj obj):
-     """
-     cdef Obj s, stream, output_text_string
-     cdef UInt res
-+    cdef TypOutputFile output
-     # The only way to get a string representation of an object that is truly
-     # consistent with how it would be represented at the GAP REPL is to call
-     # ViewObj on it.  Unfortunately, ViewObj *prints* to the output stream,
-@@ -145,12 +146,12 @@ cdef char *capture_stdout(Obj func, Obj obj):
-         output_text_string = GAP_ValueGlobalVariable("OutputTextString")
-         stream = CALL_2ARGS(output_text_string, s, GAP_True)
- 
--        if not OpenOutputStream(stream):
-+        if not OpenOutputStream(&output, stream):
-             raise GAPError("failed to open output capture stream for "
-                            "representing GAP object")
- 
-         CALL_1ARGS(func, obj)
--        CloseOutput()
-+        CloseOutput(&output)
-         return CSTR_STRING(s)
-     finally:
-         GAP_Leave()
-diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd
-index 5a9ab48..34035fe 100644
---- a/src/sage/libs/gap/gap_includes.pxd
-+++ b/src/sage/libs/gap/gap_includes.pxd
-@@ -76,8 +76,10 @@ cdef extern from "gap/intobj.h" nogil:
- 
- 
- cdef extern from "gap/io.h" nogil:
--    UInt OpenOutputStream(Obj stream)
--    UInt CloseOutput()
-+    ctypedef struct TypOutputFile:
-+        pass
-+    UInt OpenOutputStream(TypOutputFile* output, Obj stream)
-+    UInt CloseOutput(TypOutputFile* output)
- 
- 
- cdef extern from "gap/libgap-api.h" nogil:
--- 
-cgit v1.0-1-gd88e
-
-
-From c3367b4290981e5e93b7a30c48b02f1ae3770dc8 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:14:53 +0200
-Subject: Disable colored prompt as it breaks the pexpect interface
-
----
- src/sage/interfaces/gap.py | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
-index c34fe53..569caa2 100644
---- a/src/sage/interfaces/gap.py
-+++ b/src/sage/interfaces/gap.py
-@@ -1512,6 +1512,8 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
-     """
-     # Create new workspace with filename WORKSPACE
-     g = Gap(use_workspace_cache=False, max_workspace_size=None)
-+    g.eval('ColorPrompt(false)')
-+    g.eval('SetUserPreference("UseColorPrompt", false)')
-     g.eval('SetUserPreference("HistoryMaxLines", 30)')
-     from sage.tests.gap_packages import all_installed_packages
-     for pkg in all_installed_packages(gap=g):
--- 
-cgit v1.0-1-gd88e
-
-
-From 3b63e998e4d6118fc86b13b940c8f3d3b8307a50 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:16:03 +0200
-Subject: Port NaturalHomomorphism uses
-
----
- src/sage/groups/abelian_gps/abelian_group_gap.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/sage/groups/abelian_gps/abelian_group_gap.py b/src/sage/groups/abelian_gps/abelian_group_gap.py
-index a4b0471..86090b4 100644
---- a/src/sage/groups/abelian_gps/abelian_group_gap.py
-+++ b/src/sage/groups/abelian_gps/abelian_group_gap.py
-@@ -338,7 +338,7 @@ class AbelianGroup_gap(UniqueRepresentation, GroupMixinLibGAP, ParentLibGAP, Abe
-         if isinstance(x, AbelianGroupElement_gap):
-             try:
-                 if x in self._cover:
--                    x = self.gap().NaturalHomomorphism().Image(x.gap())
-+                    x = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations).Image(x.gap())
-                 else:
-                     x = x.gap()
-             except AttributeError:
-@@ -1043,7 +1043,7 @@ class AbelianGroupQuotient_gap(AbelianGroup_gap):
-             From: Abelian group with gap, generator orders (4,)
-             To:   Quotient abelian group with generator orders (2,)
-         """
--        phi = self.gap().NaturalHomomorphism()
-+        phi = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations)
-         Hom = self._cover.Hom(self)
-         return Hom(phi)
- 
--- 
-cgit v1.0-1-gd88e
-
-
-From bc40764be044653e06f2da3497e1e05da08251f7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:17:36 +0200
-Subject: Fix tests with GAP 4.12
-
----
- src/doc/en/thematic_tutorials/lie/weyl_groups.rst  | 12 ++++++------
- src/sage/coding/codecan/autgroup_can_label.pyx     |  2 +-
- src/sage/coding/linear_code.py                     | 22 +++++++++++-----------
- .../root_system/hecke_algebra_representation.py    |  2 +-
- src/sage/combinat/symmetric_group_algebra.py       |  2 +-
- src/sage/groups/finitely_presented.py              |  6 +++---
- src/sage/groups/fqf_orthogonal.py                  |  2 +-
- src/sage/groups/libgap_wrapper.pyx                 |  6 +++---
- .../perm_gps/partn_ref2/refinement_generic.pyx     |  2 +-
- src/sage/groups/perm_gps/permgroup.py              |  8 ++++----
- src/sage/libs/gap/libgap.pyx                       |  2 +-
- src/sage/libs/gap/util.pyx                         |  8 +-------
- src/sage/tests/gap_packages.py                     |  2 +-
- 13 files changed, 35 insertions(+), 41 deletions(-)
-
-diff --git a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-index c917338..182e74a 100644
---- a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-+++ b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-@@ -139,12 +139,12 @@ string, which you can print::
-     X.1      1  1  1  1  1  1  1  1  1  1  1  1  1
-     X.2      1 -1  1  1 -1  1  1 -1 -1 -1  1  1  1
-     X.3      2  .  2 -1  .  2  2  .  .  . -1  2  2
--    X.4      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
--    X.5      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
--    X.6      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
--    X.7      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
--    X.8      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
--    X.9      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
-+    X.4      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
-+    X.5      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
-+    X.6      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
-+    X.7      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
-+    X.8      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
-+    X.9      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
-     X.10     4 -2  . -1  .  .  .  2  .  .  1  . -4
-     X.11     4  2  . -1  .  .  . -2  .  .  1  . -4
-     X.12     6  . -2  .  . -2 -2  .  .  .  .  2  6
-diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx
-index de5db98..c83b926 100644
---- a/src/sage/coding/codecan/autgroup_can_label.pyx
-+++ b/src/sage/coding/codecan/autgroup_can_label.pyx
-@@ -76,7 +76,7 @@ columns do share the same coloring::
-     ((1,),
-      (2,),
-      (3, 5, 4),
--     (6, 19, 16, 9, 21, 10, 8, 15, 14, 11, 20, 13, 12, 7, 17, 18))
-+     (6, 19, 16, 21, 9, 10, 15, 8, 20, 11, 14, 13, 7, 12, 18, 17))
- 
- We can also restrict the group action to linear isometries::
- 
-diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py
-index e8e32f8..9d45160 100644
---- a/src/sage/coding/linear_code.py
-+++ b/src/sage/coding/linear_code.py
-@@ -466,27 +466,27 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric):
-             0
-             sage: C = codes.HammingCode(GF(4, 'z'), 3)
-             sage: C.automorphism_group_gens()
--            ([((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
-+                Defn: z |--> z + 1),
-+              ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z + 1),
--              ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
--                Defn: z |--> z),
-               ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-              362880)
-             sage: C.automorphism_group_gens(equivalence="linear")
--            ([((z + 1, 1, z + 1, z + 1, z + 1, z, 1, z, 1, 1, 1, 1, z + 1, z + 1, z + 1, z, z, 1, z, z, z); (1,15,2,8,16,18,3)(4,9,12,13,20,10,11)(5,21,14,6,7,19,17), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((z + 1, z + 1, z + 1, z + 1, z + 1, 1, z, 1, z, z, z, 1, z, 1, 1, 1, z + 1, z + 1, z + 1, 1, z); (1,15,21,8,9)(2,18,5,3,11,16,7,10,19,13,12,4,17,6,20), Ring endomorphism of Finite Field in z of size 2^2
-+              ((z + 1, z + 1, z + 1, z, 1, 1, z, z, 1, z + 1, z, 1, 1, z, 1, z + 1, z, z + 1, z + 1, 1, z); (1,3,18,2,17,6,19)(4,15,13,20,7,14,16)(5,11,8,21,12,9,10), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
-               ((z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1); (), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-              181440)
-             sage: C.automorphism_group_gens(equivalence="permutational")
--            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
-+              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,18)(3,19)(4,10)(5,16)(8,13)(9,14)(11,21)(15,20), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,17)(2,8)(3,14)(4,10)(7,12)(9,19)(13,18)(15,20), Ring endomorphism of Finite Field in z of size 2^2
-+              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
-               ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,13)(3,14)(4,20)(5,11)(8,18)(9,19)(10,15)(16,21), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-@@ -692,10 +692,10 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric):
-             sage: C_iso == aut_group_can_label.get_canonical_form()
-             True
-             sage: aut_group_can_label.get_autom_gens()
--            [((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
-+            [((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
-+               Defn: z |--> z + 1),
-+             ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
-                Defn: z |--> z + 1),
--             ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
--               Defn: z |--> z),
-              ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
-                Defn: z |--> z)]
-         """
-diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py
-index bde2823..bffcc85 100644
---- a/src/sage/combinat/root_system/hecke_algebra_representation.py
-+++ b/src/sage/combinat/root_system/hecke_algebra_representation.py
-@@ -355,7 +355,7 @@ class HeckeAlgebraRepresentation(WithEqualityById, SageObject):
-             sage: q1, q2 = K.gens()
-             sage: KW = W.algebra(K)
-             sage: x = KW.an_element(); x
--            123 + 3*32 + 2*3 + e
-+            123 + 3*2312 + 2*31 + e
- 
-             sage: T = KW.demazure_lusztig_operators(q1,q2)
-             sage: T12 = T.Tw( (1,2) )
-diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py
-index c3d6755..da953d2 100644
---- a/src/sage/combinat/symmetric_group_algebra.py
-+++ b/src/sage/combinat/symmetric_group_algebra.py
-@@ -101,7 +101,7 @@ def SymmetricGroupAlgebra(R, W, category=None):
-         sage: SGA.group()
-         Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space)
-         sage: SGA.an_element()
--        s1*s2*s3 + 3*s3*s2 + 2*s3 + 1
-+        s1*s2*s3 + 3*s2*s3*s1*s2 + 2*s3*s1 + 1
- 
-     The preferred way to construct the symmetric group algebra is to
-     go through the usual ``algebra`` method::
-diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
-index 2a61bbf..d26891a 100644
---- a/src/sage/groups/finitely_presented.py
-+++ b/src/sage/groups/finitely_presented.py
-@@ -596,9 +596,9 @@ class RewritingSystem():
-             sage: k = G.rewriting_system()
-             sage: k.gap()
-             Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules
--            [ [ a^2, <identity ...> ], [ a*A, <identity ...> ],
--              [ A*a, <identity ...> ], [ b^2, <identity ...> ],
--              [ b*B, <identity ...> ], [ B*b, <identity ...> ] ]
-+            [ [ a*A, <identity ...> ], [ A*a, <identity ...> ],
-+              [ b*B, <identity ...> ], [ B*b, <identity ...> ],
-+              [ a^2, <identity ...> ], [ b^2, <identity ...> ] ]
-         """
-         return self._gap
- 
-diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
-index 75de408..dd7d84d 100644
---- a/src/sage/groups/fqf_orthogonal.py
-+++ b/src/sage/groups/fqf_orthogonal.py
-@@ -143,7 +143,7 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
-         [2/3   0   0]
-         [  0 2/3   0]
-         [  0   0 4/3]
--        generated by 2 elements
-+        generated by 3 elements
-         sage: q = matrix.diagonal(QQ, [3/2, 1/4, 1/4])
-         sage: T = TorsionQuadraticForm(q)
-         sage: T.orthogonal_group().order()
-diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx
-index a76afc2..9340c0d 100644
---- a/src/sage/groups/libgap_wrapper.pyx
-+++ b/src/sage/groups/libgap_wrapper.pyx
-@@ -25,7 +25,7 @@ Note how we call the constructor of both superclasses to initialize
- its output via LibGAP::
- 
-     sage: FooGroup()
--    <pc group of size 3 with 1 generators>
-+    <pc group of size 3 with 1 generator>
-     sage: type(FooGroup().gap())
-     <class 'sage.libs.gap.element.GapElement'>
- 
-@@ -106,7 +106,7 @@ class ParentLibGAP(SageObject):
-         ....:         ParentLibGAP.__init__(self, lg)
-         ....:         Group.__init__(self)
-         sage: FooGroup()
--        <pc group of size 3 with 1 generators>
-+        <pc group of size 3 with 1 generator>
-     """
- 
-     def __init__(self, libgap_parent, ambient=None):
-@@ -461,7 +461,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement):
-         ....:         ParentLibGAP.__init__(self, lg)
-         ....:         Group.__init__(self)
-         sage: FooGroup()
--        <pc group of size 3 with 1 generators>
-+        <pc group of size 3 with 1 generator>
-         sage: FooGroup().gens()
-         (f1,)
-     """
-diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-index 2fcb036..ca73c6b 100644
---- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-+++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-@@ -427,7 +427,7 @@ cdef class LabelledBranching:
-             sage: from sage.groups.perm_gps.partn_ref2.refinement_generic import LabelledBranching
-             sage: L = LabelledBranching(3)
-             sage: L.small_generating_set()
--            []
-+            [()]
-             sage: L.add_gen(libgap.eval('(1,2,3)'))
-             sage: L.small_generating_set()
-             [(1,2,3)]
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 4908934..34ba0cc 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -913,7 +913,7 @@ class PermutationGroup_generic(FiniteGroup):
-            sage: f = PG._coerce_map_from_(MG)
-            sage: mg = MG.an_element()
-            sage: p = f(mg); p
--           (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60)
-+           (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21)
-            sage: PG(p._gap_()) == p
-            True
- 
-@@ -959,12 +959,12 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: P = G.as_permutation_group(algorithm='smaller', seed=5)
-             sage: P1 = G.as_permutation_group()
-             sage: P == P1
--            False
-+            True
-             sage: g1, g2, g3 = G.gens()
-             sage: P(g1*g2)
--            (1,3,7,12)(2,4,8,10)(5,11)(6,9)
-+            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
-             sage: P1(g1*g2)
--            (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66)
-+            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
- 
-         Another check for :trac:`5583`::
- 
-diff --git a/src/sage/libs/gap/libgap.pyx b/src/sage/libs/gap/libgap.pyx
-index b1a64e5..6a36613 100644
---- a/src/sage/libs/gap/libgap.pyx
-+++ b/src/sage/libs/gap/libgap.pyx
-@@ -695,7 +695,7 @@ class Gap(Parent):
-             sage: libgap.List
-             <Gap function "List">
-             sage: libgap.GlobalRandomSource
--            <RandomSource in IsGlobalRandomSource>
-+            <RandomSource in IsGAPRandomSource>
-         """
-         if name in dir(self.__class__):
-             return getattr(self.__class__, name)
-diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
-index 344ab88..6350987 100644
---- a/src/sage/libs/gap/util.pyx
-+++ b/src/sage/libs/gap/util.pyx
-@@ -362,15 +362,9 @@ cdef Obj gap_eval(str gap_string) except? NULL:
-         GAPError: Error, Variable: 'Complex' must have a value
-         Syntax error: ; expected in stream:1
-         Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^
-+                ^^^^^
-         Error, Variable: 'with' must have a value
--        Syntax error: ; expected in stream:1
--        Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^^^^^^^^^
-         Error, Variable: 'bits' must have a value
--        Syntax error: ; expected in stream:1
--        Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-         Error, Variable: 'precision' must have a value
- 
-     Test that on a subsequent attempt we get the same message (no garbage was
-diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py
-index 2e4518c..c302b16 100644
---- a/src/sage/tests/gap_packages.py
-+++ b/src/sage/tests/gap_packages.py
-@@ -103,7 +103,7 @@ def all_installed_packages(ignore_dot_gap=False, gap=None):
- 
-         sage: from sage.tests.gap_packages import all_installed_packages
-         sage: all_installed_packages()
--        (...'GAPDoc'...)
-+        (...'gapdoc'...)
-         sage: all_installed_packages(ignore_dot_gap=True) == all_installed_packages(gap=gap, ignore_dot_gap=True)
-         True
-     """
--- 
-cgit v1.0-1-gd88e
-
-
-From cbc902a79ff9ec01d4d4eb9a767a1c661fb5dda7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:17:42 +0200
-Subject: Adapt test to new is_transitive and is_primitive behavior
-
----
- src/sage/groups/perm_gps/permgroup.py | 22 ++++++++++++++++------
- 1 file changed, 16 insertions(+), 6 deletions(-)
-
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 34ba0cc..5832b98 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -4359,17 +4359,23 @@ class PermutationGroup_generic(FiniteGroup):
- 
-         ::
- 
--            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
--            sage: G.is_transitive([1,4,5])
-+            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)],[(6,7)]])
-+            sage: G.is_transitive([1,2,3,4,5])
-             True
--            sage: G.is_transitive([2..6])
-+            sage: G.is_transitive([1..7])
-             False
-             sage: G.is_transitive(G.non_fixed_points())
--            True
-+            False
-             sage: H = PermutationGroup([[(1,2,3)],[(4,5,6)]])
-             sage: H.is_transitive(H.non_fixed_points())
-             False
- 
-+        If `G` does not act on the domain, it always returns ``False``::
-+
-+            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
-+            sage: G.is_transitive([1,4,5])
-+            False
-+
-         Note that this differs from the definition in GAP, where
-         ``IsTransitive`` returns whether the group is transitive on the
-         set of points moved by the group.
-@@ -4425,12 +4431,16 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
-             sage: G.is_primitive([1..4])
-             False
--            sage: G.is_primitive([1,2,3])
--            True
-             sage: G = PermutationGroup([[(3,4,5,6)],[(3,4)]]) #S_4 on [3..6]
-             sage: G.is_primitive(G.non_fixed_points())
-             True
- 
-+        If `G` does not act on the domain, it always returns ``False``::
-+
-+            sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
-+            sage: G.is_primitive([1,2,3])
-+            False
-+
-         """
-         #If the domain is not a subset of self.domain(), then the
-         #action isn't primitive.
--- 
-cgit v1.0-1-gd88e
-
-
-From 80dd6b338236f170efca1fc3545df18ce8d8795c Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:18:06 +0200
-Subject: Mark test as random. With gap 4.12 on x86_64 it is no longer 2
-
----
- src/sage/groups/perm_gps/permgroup.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 5832b98..c1230a3 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -1287,7 +1287,7 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: G.gens_small() # random
-             [('b','c'), ('a','c','b')] ## (on 64-bit Linux)
-             [('a','b'), ('a','c','b')] ## (on Solaris)
--            sage: len(G.gens_small()) == 2
-+            sage: len(G.gens_small()) == 2 # random
-             True
-         """
-         gens = self._libgap_().SmallGeneratingSet()
--- 
-cgit v1.0-1-gd88e
-
-
-From a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:18:30 +0200
-Subject: Remove test that is now redundant, all seeds give the same answer
-
----
- src/sage/groups/matrix_gps/finitely_generated.py | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py
-index a6d3dc0..63956ad 100644
---- a/src/sage/groups/matrix_gps/finitely_generated.py
-+++ b/src/sage/groups/matrix_gps/finitely_generated.py
-@@ -563,9 +563,6 @@ class FinitelyGeneratedMatrixGroup_gap(MatrixGroup_gap):
-             21499084800
-             sage: P = G.as_permutation_group()
-             sage: Psmaller = G.as_permutation_group(algorithm="smaller", seed=6)
--            sage: P == Psmaller  # see the note below
--            True
--            sage: Psmaller = G.as_permutation_group(algorithm="smaller")
-             sage: P == Psmaller
-             False
-             sage: P.cardinality()
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch b/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
deleted file mode 100644
index 8fedcb78cf71..000000000000
--- a/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-commit 04971318f032caf8dc1c0de9489346d894409091
-Author: John H. Palmieri <jhpalmieri64@gmail.com>
-Date:   Wed Aug 31 14:22:26 2022 -0700
-
-    trac 34465: fix invalid escape sequence in functions/special.py
-
-diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py
-index 02596e49620..901f02f9bee 100644
---- a/src/sage/functions/special.py
-+++ b/src/sage/functions/special.py
-@@ -849,7 +849,7 @@ class EllipticF(BuiltinFunction):
-     - :wikipedia:`Elliptic_integral#Incomplete_elliptic_integral_of_the_first_kind`
-     """
-     def __init__(self):
--        """
-+        r"""
-         EXAMPLES::
- 
-             sage: loads(dumps(elliptic_f))
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
deleted file mode 100644
index ccafad5070c4..000000000000
--- a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
+++ /dev/null
@@ -1,1750 +0,0 @@
-diff --git a/build/pkgs/giac/patches/pari_2_15.patch b/build/pkgs/giac/patches/pari_2_15.patch
-new file mode 100644
-index 0000000000..d2900a5ffc
---- /dev/null
-+++ b/build/pkgs/giac/patches/pari_2_15.patch
-@@ -0,0 +1,21 @@
-+ANYARG patch
-+
-+diff --git a/src/pari.cc b/src/pari.cc
-+index 76ce8e1..50d08ab 100644
-+--- a/src/pari.cc
-++++ b/src/pari.cc
-+@@ -40,6 +40,13 @@ using namespace std;
-+ 
-+ #ifdef HAVE_LIBPARI
-+ 
-++// Anyarg disappeared from PARI 2.15.0
-++#ifdef __cplusplus
-++#  define ANYARG ...
-++#else
-++#  define ANYARG
-++#endif
-++
-+ #ifdef HAVE_PTHREAD_H
-+ #include <pthread.h>
-+ #endif
-+
-diff --git a/build/pkgs/pari/checksums.ini b/build/pkgs/pari/checksums.ini
-index b736feed31..bafd0f36f4 100644
---- a/build/pkgs/pari/checksums.ini
-+++ b/build/pkgs/pari/checksums.ini
-@@ -1,5 +1,5 @@
- tarball=pari-VERSION.tar.gz
--sha1=e01647aab7e96a8cb4922cf26a4f224337c6647f
--md5=922f740fcdf8630b30d63dc76b58f756
--cksum=297133525
-+sha1=cba9b279f67d5efe2fbbccf3be6e9725f816cf07
-+md5=76d430f1bea1b07fa2ad9712deeaa736
-+cksum=1990743897
- upstream_url=https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-VERSION.tar.gz
-diff --git a/build/pkgs/pari/package-version.txt b/build/pkgs/pari/package-version.txt
-index a1a4224dd5..68e69e405e 100644
---- a/build/pkgs/pari/package-version.txt
-+++ b/build/pkgs/pari/package-version.txt
-@@ -1 +1 @@
--2.13.3
-+2.15.0
-diff --git a/src/doc/de/tutorial/tour_numtheory.rst b/src/doc/de/tutorial/tour_numtheory.rst
-index a012234c99..e3149fe949 100644
---- a/src/doc/de/tutorial/tour_numtheory.rst
-+++ b/src/doc/de/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ implementiert.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/en/tutorial/tour_numtheory.rst b/src/doc/en/tutorial/tour_numtheory.rst
-index 3064d100e2..075e0ac0ad 100644
---- a/src/doc/en/tutorial/tour_numtheory.rst
-+++ b/src/doc/en/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ NumberField class.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/es/tutorial/tour_numtheory.rst b/src/doc/es/tutorial/tour_numtheory.rst
-index a1f7d1a87b..48e5376cfe 100644
---- a/src/doc/es/tutorial/tour_numtheory.rst
-+++ b/src/doc/es/tutorial/tour_numtheory.rst
-@@ -140,7 +140,7 @@ Varios métodos relacionados están implementados en la clase ``NumberField``::
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/fr/tutorial/tour_numtheory.rst b/src/doc/fr/tutorial/tour_numtheory.rst
-index 871092f5fa..d1b2fee883 100644
---- a/src/doc/fr/tutorial/tour_numtheory.rst
-+++ b/src/doc/fr/tutorial/tour_numtheory.rst
-@@ -159,7 +159,7 @@ dans la classe NumberField.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/ja/tutorial/tour_numtheory.rst b/src/doc/ja/tutorial/tour_numtheory.rst
-index 47af68c862..4d4ed52d50 100644
---- a/src/doc/ja/tutorial/tour_numtheory.rst
-+++ b/src/doc/ja/tutorial/tour_numtheory.rst
-@@ -161,7 +161,7 @@ Sageには :math:`p` \-進数体も組込まれている.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/pt/tutorial/tour_numtheory.rst b/src/doc/pt/tutorial/tour_numtheory.rst
-index 6371b491ea..a3dc973a93 100644
---- a/src/doc/pt/tutorial/tour_numtheory.rst
-+++ b/src/doc/pt/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ NumberField.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus 
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/ru/tutorial/tour_numtheory.rst b/src/doc/ru/tutorial/tour_numtheory.rst
-index 652abfbc99..a985d49fbd 100644
---- a/src/doc/ru/tutorial/tour_numtheory.rst
-+++ b/src/doc/ru/tutorial/tour_numtheory.rst
-@@ -150,7 +150,7 @@ Sage содержит стандартные функции теории чис
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py
-index e57076646f..fec75d07c1 100644
---- a/src/sage/arith/misc.py
-+++ b/src/sage/arith/misc.py
-@@ -1465,13 +1465,13 @@ def divisors(n):
- 
-         sage: K.<a> = QuadraticField(7)
-         sage: divisors(K.ideal(7))
--        [Fractional ideal (1), Fractional ideal (-a), Fractional ideal (7)]
-+        [Fractional ideal (1), Fractional ideal (a), Fractional ideal (7)]
-         sage: divisors(K.ideal(3))
-         [Fractional ideal (1), Fractional ideal (3),
--        Fractional ideal (-a + 2), Fractional ideal (-a - 2)]
-+        Fractional ideal (a - 2), Fractional ideal (a + 2)]
-         sage: divisors(K.ideal(35))
--        [Fractional ideal (1), Fractional ideal (5), Fractional ideal (-a),
--        Fractional ideal (7), Fractional ideal (-5*a), Fractional ideal (35)]
-+        [Fractional ideal (1), Fractional ideal (5), Fractional ideal (a),
-+        Fractional ideal (7), Fractional ideal (5*a), Fractional ideal (35)]
- 
-     TESTS::
- 
-@@ -2569,7 +2569,7 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds):
- 
-         sage: K.<i> = QuadraticField(-1)
-         sage: factor(122 - 454*i)
--        (-3*i - 2) * (-i - 2)^3 * (i + 1)^3 * (i + 4)
-+        (-i) * (-i - 2)^3 * (i + 1)^3 * (-2*i + 3) * (i + 4)
- 
-     To access the data in a factorization::
- 
-diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-index cdfc11a9e5..b6e1280d6e 100644
---- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-+++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-@@ -7825,9 +7825,9 @@ class DynamicalSystem_projective_field(DynamicalSystem_projective,
-             sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, y^2, QQbar(sqrt(2))*z^2])
-             sage: f.reduce_base_field()
-             Dynamical System of Projective Space of dimension 2 over Number Field in a with
--            defining polynomial y^4 - 4*y^2 + 1 with a = 1.931851652578137?
-+            defining polynomial y^4 - 4*y^2 + 1 with a = -0.5176380902050415?
-               Defn: Defined on coordinates by sending (x : y : z) to
--                    (x^2 + (a^2 - 2)*y^2 : y^2 : (a^3 - 3*a)*z^2)
-+                    (x^2 + (-a^2 + 2)*y^2 : y^2 : (a^3 - 3*a)*z^2)
- 
-         ::
- 
-diff --git a/src/sage/ext_data/pari/simon/ellQ.gp b/src/sage/ext_data/pari/simon/ellQ.gp
-index 420af8f6a2..65e8386779 100644
---- a/src/sage/ext_data/pari/simon/ellQ.gp
-+++ b/src/sage/ext_data/pari/simon/ellQ.gp
-@@ -40,7 +40,7 @@
-   gp > \r ellcommon.gp
-   gp > \r ellQ.gp
- 
--  The main function is ellrank(), which takes as an argument
-+  The main function is ellQ_ellrank(), which takes as an argument
-   any elliptic curve in the form [a1,a2,a3,a4,a6]
-   the result is a vector [r,s,v], where
-     r is a lower bound for the rank,
-@@ -50,7 +50,7 @@
-   Example:
- 
-   gp > ell = [1,2,3,4,5];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
-   %1 = [1, 1, [[1,2]]
-   In this example, the rank is exactly 1, and [1,2] has infinite order.
- 
-@@ -92,7 +92,7 @@
-   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- 
-   Explications succintes :
--  La fonction ellrank() accepte toutes les courbes sous la forme
-+  La fonction ellQ_ellrank() accepte toutes les courbes sous la forme
-   [a1,a2,a3,a4,a6]
-   Les coefficients peuvent etre entiers ou non.
-   L'algorithme utilise est celui de la 2-descente.
-@@ -100,7 +100,7 @@
-   Il suffit de taper : 
- 
-   gp > ell = [a1,a2,a3,a4,a6];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
- 
-   Retourne un vecteur [r,s,v] ou
-     r est le rang probable (c'est toujours une minoration du rang),
-@@ -110,7 +110,7 @@
-   Exemple :
- 
-   gp > ell = [1,2,3,4,5];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
-   %1 = [1, 1, [[1,2]]
-   Ici, le rang est exactement 1, et le point [1,2] est d'ordre infini.
- 
-@@ -1571,12 +1571,12 @@ if( DEBUGLEVEL_ell >= 4, print("    end of ell2descent_gen"));
-     print("rank(E/Q)    >= ",m1)
-   );
- }
--{ellrank(ell,help=[]) =
-+{ellQ_ellrank(ell,help=[]) =
- \\ Algorithm of 2-descent on the elliptic curve ell.
- \\ help is a list of known points on ell.
- my(urst,urst1,den,eqell,tors2,bnf,rang,time1);
- 
--if( DEBUGLEVEL_ell >= 3, print("   starting ellrank"));
-+if( DEBUGLEVEL_ell >= 3, print("   starting ellQ_ellrank"));
-   if( #ell < 13, ell = ellinit(ell));
- 
- \\ kill the coefficients a1 and a3
-@@ -1630,7 +1630,7 @@ if( DEBUGLEVEL_ell >= 1, print(" Elliptic curve: Y^2 = ",eqell));
-   ));
- 
-   rang[3] = ellchangepoint(rang[3],ellinverturst(urst));
--if( DEBUGLEVEL_ell >= 3, print("   end of ellrank"));
-+if( DEBUGLEVEL_ell >= 3, print("   end of ellQ_ellrank"));
- 
-   return(rang);
- }
-@@ -2106,13 +2106,13 @@ if( DEBUGLEVEL_ell >= 3, print("   end of ell2descent_viaisog"));
- {
- \\                  functions for elliptic curves
-   addhelp(ell2descent_complete,
--    "ell2descent_complete(e1,e2,e3): Performs a complete 2-descent on the elliptic curve y^2 = (x-e1)*(x-e2)*(x-e3). See ?ellrank for the format of the output.");
-+    "ell2descent_complete(e1,e2,e3): Performs a complete 2-descent on the elliptic curve y^2 = (x-e1)*(x-e2)*(x-e3). See ?ellQ_ellrank for the format of the output.");
-   addhelp(ell2descent_gen,
--    "ell2descent_gen((E,bnf,k=1,help=[]): E is a vector of the form [0,A,0,B,C], (or the result of ellinit of such a vector) A,B,C integers such that x^3+A*x^2+B*x+C; bnf is the corresponding bnfinit(,1); Performs 2-descent on the elliptic curve Ek: k*y^2=x^3+A*x^2+B*x+C. See ?ellrank for the format of the output.");
-+    "ell2descent_gen((E,bnf,k=1,help=[]): E is a vector of the form [0,A,0,B,C], (or the result of ellinit of such a vector) A,B,C integers such that x^3+A*x^2+B*x+C; bnf is the corresponding bnfinit(,1); Performs 2-descent on the elliptic curve Ek: k*y^2=x^3+A*x^2+B*x+C. See ?ellQ_ellrank for the format of the output.");
-   addhelp(ell2descent_viaisog,
--    "ell2descent_viaisog(E,help=[]): E is an elliptic curve of the form [0,a,0,b,0], with a, b integers. Performs a 2-descent via isogeny on E. See ?ellrank for the format of the output.");
--  addhelp(ellrank,
--    "ellrank(E,help=[]): E is any elliptic curve defined over Q. Returns a vector [r,s,v], where r is a lower bound for the rank of E, s is the rank of its 2-Selmer group and v is a list of independant points in E(Q)/2E(Q). If help is a vector of nontrivial points on E, the result might be faster. This function might be used in conjunction with elltors2(E). See also ?default_ellQ");
-+    "ell2descent_viaisog(E,help=[]): E is an elliptic curve of the form [0,a,0,b,0], with a, b integers. Performs a 2-descent via isogeny on E. See ?ellQ_ellrank for the format of the output.");
-+  addhelp(ellQ_ellrank,
-+    "ellQ_ellrank(E,help=[]): E is any elliptic curve defined over Q. Returns a vector [r,s,v], where r is a lower bound for the rank of E, s is the rank of its 2-Selmer group and v is a list of independant points in E(Q)/2E(Q). If help is a vector of nontrivial points on E, the result might be faster. This function might be used in conjunction with elltors2(E). See also ?default_ellQ");
-   addhelp(ellhalf,
-     "ellhalf(E,P): returns the vector of all points Q on the elliptic curve E such that 2Q = P");
-   addhelp(ellredgen,
-@@ -2143,7 +2143,7 @@ if( DEBUGLEVEL_ell >= 3, print("   end of ell2descent_viaisog"));
- 
- \\                  others
-   addhelp(default_ellQ,
--    "default_ellQ(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, ELLREDGENFLAG, COMPLETE, MAXPROB, LIMBIGPRIME): set the value of the global variables used for ellrank() and other related functions. DEBUGLEVEL_ell: 0-5: choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; ELLREDGENFLAG: if != 0, try to reduce the generators at the end; COMPLETE: if != 0 and full 2-torsion, use complete 2-descent, otherwise via 2-isogeny; MAXPROB, LIMBIGPRIME: technical.");
-+    "default_ellQ(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, ELLREDGENFLAG, COMPLETE, MAXPROB, LIMBIGPRIME): set the value of the global variables used for ellQ_ellrank() and other related functions. DEBUGLEVEL_ell: 0-5: choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; ELLREDGENFLAG: if != 0, try to reduce the generators at the end; COMPLETE: if != 0 and full 2-torsion, use complete 2-descent, otherwise via 2-isogeny; MAXPROB, LIMBIGPRIME: technical.");
- /*  addhelp(DEBUGLEVEL_ell,
-     "DEBUGLEVEL_ell: Choose a higher value of this global variable to have more details of the computations printed during the 2-descent algorithm. 0 = don't print anything; 1 = (default) just print the result; 2 = print more details including the Selmer group and the nontrivial quartics.");
- */
-diff --git a/src/sage/ext_data/pari/simon/qfsolve.gp b/src/sage/ext_data/pari/simon/qfsolve.gp
-index 501fb50828..2107288c1d 100644
---- a/src/sage/ext_data/pari/simon/qfsolve.gp
-+++ b/src/sage/ext_data/pari/simon/qfsolve.gp
-@@ -434,146 +434,6 @@ my(cc);
- return([U3~*G3*U3,red[2]*U1*U2*U3]);
- }
- 
--\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
--\\        QUADRATIC FORMS MINIMIZATION         \\
--\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
--
--\\ Minimization of the quadratic form G, with nonzero determinant.
--\\ of dimension n>=2.
--\\ G must by symmetric and have integral coefficients.
--\\ Returns [G',U,factd] with U in GLn(Q) such that G'=U~*G*U*constant
--\\ is integral and has minimal determinant.
--\\ In dimension 3 or 4, may return a prime p
--\\ if the reduction at p is impossible because of the local non solvability.
--\\ If given, factdetG must be equal to factor(abs(det(G))).
--{qfminimize(G,factdetG) =
--my(factd,U,Ker,Ker2,sol,aux,di);
--my(p);
--my(n,lf,i,vp,dimKer,dimKer2,m);
--
--  n = length(G);
--  factd = matrix(0,2);
--  if( !factdetG, factdetG = factor(matdet(G)));
--
--  lf = length(factdetG[,1]);
--  i = 1; U = matid(n);
--
--  while(i <= lf,
--    vp = factdetG[i,2];
--    if( vp == 0, i++; next);
--    p = factdetG[i,1];
--    if( p == -1, i++; next);
--if( DEBUGLEVEL_qfsolve >= 4, print("    p = ",p,"^",vp));
--
--\\ The case vp = 1 can be minimized only if n is odd.
--    if( vp == 1 && n%2 == 0,
--      factd = concat(factd~, Mat([p,1])~)~;
--      i++; next
--    );
--    Ker = kermodp(G,p); dimKer = Ker[1]; Ker = Ker[2];
--
--\\ Rem: we must have dimKer <= vp
--if( DEBUGLEVEL_qfsolve >= 4, print("    dimKer = ",dimKer));
--\\ trivial case: dimKer = n
--    if( dimKer == n, 
--if( DEBUGLEVEL_qfsolve >= 4, print("     case 0: dimKer = n"));
--      G /= p;
--      factdetG[i,2] -= n;
--      next
--    );
--    G = Ker~*G*Ker;
--    U = U*Ker;
--
--\\ 1st case: dimKer < vp
--\\ then the kernel mod p contains a kernel mod p^2
--    if( dimKer < vp,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 1: dimker < vp"));
--      if( dimKer == 1,
--\\        G[,1] /= p; G[1,] /= p;
--        G[,1] /= p; G[1,] = G[1,]/p;
--        U[,1] /= p;
--        factdetG[i,2] -= 2
--      , 
--        Ker2 = kermodp(matrix(dimKer,dimKer,j,k,G[j,k]/p),p);
--        dimKer2 = Ker2[1]; Ker2 = Ker2[2];
--        for( j = 1, dimKer2, Ker2[,j] /= p);
--        Ker2 = matdiagonalblock([Ker2,matid(n-dimKer)]);
--        G = Ker2~*G*Ker2;
--        U = U*Ker2;
--        factdetG[i,2] -= 2*dimKer2
--);
--
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 1"));
--      next
--    );
--
--\\ Now, we have vp = dimKer 
--\\ 2nd case: the dimension of the kernel is >=2
--\\ and contains an element of norm 0 mod p^2
--
--\\ search for an element of norm p^2... in the kernel
--    if( dimKer > 2 || 
--       (dimKer == 2 && issquare( di = Mod((G[1,2]^2-G[1,1]*G[2,2])/p^2,p))),
--      if( dimKer > 2,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 2.1"));
--        dimKer = 3;
--        sol = qfsolvemodp(matrix(3,3,j,k,G[j,k]/p),p)
--      ,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 2.2"));
--        if( G[1,1]%p^2 == 0, 
--          sol = [1,0]~
--        , sol = [-G[1,2]/p+sqrt(di),Mod(G[1,1]/p,p)]~
--        )
--      );
--      sol = centerlift(sol);
--      sol /= content(sol);
--if( DEBUGLEVEL_qfsolve >= 4, print("    sol = ",sol));
--      Ker = vectorv(n, j, if( j<= dimKer, sol[j], 0)); \\ fill with 0's
--      Ker = completebasis(Ker,1);
--      Ker[,n] /= p;
--      G = Ker~*G*Ker;
--      U = U*Ker;
--      factdetG[i,2] -= 2;
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 2"));
--      next
--    );
--
--\\ Now, we have vp = dimKer <= 2 
--\\   and the kernel contains no vector with norm p^2...
--
--\\ In some cases, exchanging the kernel and the image
--\\ makes the minimization easy.
--
--    m = (n-1)\2-1;
--    if( ( vp == 1 && issquare(Mod(-(-1)^m*matdet(G)/G[1,1],p)))
--     || ( vp == 2 && n%2 == 1 && n >= 5)
--     || ( vp == 2 && n%2 == 0 && !issquare(Mod((-1)^m*matdet(G)/p^2,p)))
--    , 
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 3"));
--      Ker = matid(n);
--      for( j = dimKer+1, n, Ker[j,j] = p);
--      G = Ker~*G*Ker/p;
--      U = U*Ker;
--      factdetG[i,2] -= 2*dimKer-n;
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 3"));
--      next
--    );
--
--\\ Minimization was not possible se far.
--\\ If n == 3 or 4, this proves the local non-solubility at p.
--    if( n == 3 || n == 4, 
--if( DEBUGLEVEL_qfsolve >= 1, print(" no local solution at ",p));
--      return(p));
--
--if( DEBUGLEVEL_qfsolve >= 4, print("    prime ",p," finished"));
--    factd = concat(factd~,Mat([p,vp])~)~;
--    i++
--  );
--\\ apply LLL to avoid coefficients explosion
--  aux = qflll(U/content(U));
--return([aux~*G*aux,U*aux,factd]);
--}
--
- \\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- \\          CLASS GROUP COMPUTATIONS           \\
- \\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-diff --git a/src/sage/geometry/polyhedron/backend_field.py b/src/sage/geometry/polyhedron/backend_field.py
-index 6b921d23a6..2f32c58b1e 100644
---- a/src/sage/geometry/polyhedron/backend_field.py
-+++ b/src/sage/geometry/polyhedron/backend_field.py
-@@ -265,7 +265,7 @@ class Polyhedron_field(Polyhedron_base):
-              An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0,
-              An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0)
-             sage: p.Vrepresentation()                                           # optional - sage.rings.number_field
--            (A vertex at (0.?e-15, 0.707106781186548?),
-+            (A vertex at (0.?e-16, 0.7071067811865475?),
-              A vertex at (1.414213562373095?, 0),
-              A vertex at (4.000000000000000?, 0.372677996249965?))
-         """
-@@ -308,7 +308,7 @@ class Polyhedron_field(Polyhedron_base):
-              An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0,
-              An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0)
-             sage: p.Vrepresentation()                                           # optional - sage.rings.number_field
--            (A vertex at (0.?e-15, 0.707106781186548?),
-+            (A vertex at (0.?e-16, 0.7071067811865475?),
-              A vertex at (1.414213562373095?, 0),
-              A vertex at (4.000000000000000?, 0.372677996249965?))
-         """
-diff --git a/src/sage/geometry/polyhedron/backend_normaliz.py b/src/sage/geometry/polyhedron/backend_normaliz.py
-index 86b89632a5..ca8a43b248 100644
---- a/src/sage/geometry/polyhedron/backend_normaliz.py
-+++ b/src/sage/geometry/polyhedron/backend_normaliz.py
-@@ -53,7 +53,7 @@ def _number_field_elements_from_algebraics_list_of_lists_of_lists(listss, **kwds
-         1.732050807568878?
-         sage: from sage.geometry.polyhedron.backend_normaliz import _number_field_elements_from_algebraics_list_of_lists_of_lists
-         sage: K, results, hom = _number_field_elements_from_algebraics_list_of_lists_of_lists([[[rt2], [1]], [[rt3]], [[1], []]]); results  # optional - sage.rings.number_field
--        [[[-a^3 + 3*a], [1]], [[-a^2 + 2]], [[1], []]]
-+        [[[-a^3 + 3*a], [1]], [[a^2 - 2]], [[1], []]]
-     """
-     from sage.rings.qqbar import number_field_elements_from_algebraics
-     numbers = []
-diff --git a/src/sage/groups/matrix_gps/isometries.py b/src/sage/groups/matrix_gps/isometries.py
-index f9111a2c92..cca45e7175 100644
---- a/src/sage/groups/matrix_gps/isometries.py
-+++ b/src/sage/groups/matrix_gps/isometries.py
-@@ -11,11 +11,11 @@ EXAMPLES::
-     sage: L = IntegralLattice("D4")
-     sage: O = L.orthogonal_group()
-     sage: O
--    Group of isometries with 5 generators (
--    [-1  0  0  0]  [0 0 0 1]  [-1 -1 -1 -1]  [ 1  1  0  0]  [ 1  0  0  0]
--    [ 0 -1  0  0]  [0 1 0 0]  [ 0  0  1  0]  [ 0  0  1  0]  [-1 -1 -1 -1]
--    [ 0  0 -1  0]  [0 0 1 0]  [ 0  1  0  1]  [ 0  1  0  1]  [ 0  0  1  0]
--    [ 0  0  0 -1], [1 0 0 0], [ 0 -1 -1  0], [ 0 -1 -1  0], [ 0  0  0  1]
-+    Group of isometries with 3 generators (
-+    [0 0 0 1]  [ 1  1  0  0]  [ 1  0  0  0]
-+    [0 1 0 0]  [ 0  0  1  0]  [-1 -1 -1 -1]
-+    [0 0 1 0]  [ 0  1  0  1]  [ 0  0  1  0]
-+    [1 0 0 0], [ 0 -1 -1  0], [ 0  0  0  1]
-     )
- 
- Basic functionality is provided by GAP::
-diff --git a/src/sage/interfaces/genus2reduction.py b/src/sage/interfaces/genus2reduction.py
-index 56ae04b235..7a4794daf2 100644
---- a/src/sage/interfaces/genus2reduction.py
-+++ b/src/sage/interfaces/genus2reduction.py
-@@ -143,31 +143,31 @@ class ReductionData(SageObject):
-        sur un corps de valuation discrète", Trans. AMS 348 (1996),
-        4577-4610, Section 7.2, Proposition 4).
-     """
--    def __init__(self, pari_result, P, Q, minimal_equation, minimal_disc,
--                 local_data, conductor, prime_to_2_conductor_only):
-+    def __init__(self, pari_result, P, Q, Pmin, Qmin, minimal_disc,
-+                 local_data, conductor):
-         self.pari_result = pari_result
-         self.P = P
-         self.Q = Q
--        self.minimal_equation = minimal_equation
-+        self.Pmin = Pmin
-+        self.Qmin = Qmin
-         self.minimal_disc = minimal_disc
-         self.local_data = local_data
-         self.conductor = conductor
--        self.prime_to_2_conductor_only = prime_to_2_conductor_only
- 
-     def _repr_(self):
--        if self.prime_to_2_conductor_only:
--            ex = ' (away from 2)'
--        else:
--            ex = ''
-         if self.Q == 0:
-             yterm = ''
-         else:
-             yterm = '+ (%s)*y '%self.Q
-+
-         s = 'Reduction data about this proper smooth genus 2 curve:\n'
-         s += '\ty^2 %s= %s\n'%(yterm, self.P)
--        s += 'A Minimal Equation (away from 2):\n\ty^2 = %s\n'%self.minimal_equation
--        s += 'Minimal Discriminant (away from 2):  %s\n'%self.minimal_disc
--        s += 'Conductor%s: %s\n'%(ex, self.conductor)
-+        if self.Qmin:
-+            s += 'A Minimal Equation:\n\ty^2 + (%s)y = %s\n'%(self.Qmin, self.Pmin)
-+        else:
-+            s += 'A Minimal Equation:\n\ty^2 = %s\n'%self.Pmin
-+        s += 'Minimal Discriminant: %s\n'%self.minimal_disc
-+        s += 'Conductor: %s\n'%self.conductor
-         s += 'Local Data:\n%s'%self._local_data_str()
-         return s
- 
-@@ -242,17 +242,7 @@ class Genus2reduction(SageObject):
-         sage: factor(R.conductor)
-         5^4 * 2267
- 
--    This means that only the odd part of the conductor is known.
--
--    ::
--
--        sage: R.prime_to_2_conductor_only
--        True
--
--    The discriminant is always minimal away from 2, but possibly not at
--    2.
--
--    ::
-+    The discriminant is always minimal::
- 
-         sage: factor(R.minimal_disc)
-         2^3 * 5^5 * 2267
-@@ -264,10 +254,10 @@ class Genus2reduction(SageObject):
-         sage: R
-         Reduction data about this proper smooth genus 2 curve:
-             y^2 + (x^3 - 2*x^2 - 2*x + 1)*y = -5*x^5
--        A Minimal Equation (away from 2):
--            y^2 = x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855
--        Minimal Discriminant (away from 2):  56675000
--        Conductor (away from 2): 1416875
-+        A Minimal Equation:
-+            y^2 ...
-+        Minimal Discriminant: 56675000
-+        Conductor: 1416875
-         Local Data:
-             p=2
-             (potential) stable reduction:  (II), j=1
-@@ -293,10 +283,10 @@ class Genus2reduction(SageObject):
-         sage: genus2reduction(0, x^6 + 3*x^3 + 63)
-         Reduction data about this proper smooth genus 2 curve:
-                 y^2 = x^6 + 3*x^3 + 63
--        A Minimal Equation (away from 2):
--                y^2 = x^6 + 3*x^3 + 63
--        Minimal Discriminant (away from 2):  10628388316852992
--        Conductor (away from 2): 2893401
-+        A Minimal Equation:
-+                y^2 ...
-+        Minimal Discriminant: -10628388316852992
-+        Conductor: 2893401
-         Local Data:
-                 p=2
-                 (potential) stable reduction:  (V), j1+j2=0, j1*j2=0
-@@ -327,9 +317,9 @@ class Genus2reduction(SageObject):
-         sage: genus2reduction(x^3-x^2-1, x^2 - x)
-         Reduction data about this proper smooth genus 2 curve:
-                 y^2 + (x^3 - x^2 - 1)*y = x^2 - x
--        A Minimal Equation (away from 2):
--                y^2 = x^6 + 58*x^5 + 1401*x^4 + 18038*x^3 + 130546*x^2 + 503516*x + 808561
--        Minimal Discriminant (away from 2):  169
-+        A Minimal Equation:
-+                y^2 ...
-+        Minimal Discriminant: -169
-         Conductor: 169
-         Local Data:
-                 p=13
-@@ -370,10 +360,10 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^3 - 2*x^2 - 2*x + 1, -5*x^5)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^3 - 2*x^2 - 2*x + 1)*y = -5*x^5
--            A Minimal Equation (away from 2):
--                    y^2 = x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855
--            Minimal Discriminant (away from 2):  56675000
--            Conductor (away from 2): 1416875
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 56675000
-+            Conductor: 1416875
-             Local Data:
-                     p=2
-                     (potential) stable reduction:  (II), j=1
-@@ -389,9 +379,9 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^2 + 1, -5*x^5)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^2 + 1)*y = -5*x^5
--            A Minimal Equation (away from 2):
--                    y^2 = -20*x^5 + x^4 + 2*x^2 + 1
--            Minimal Discriminant (away from 2):  48838125
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 48838125
-             Conductor: 32025
-             Local Data:
-                     p=3
-@@ -412,9 +402,9 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^3 + x^2 + x,-2*x^5 + 3*x^4 - x^3 - x^2 - 6*x - 2)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^3 + x^2 + x)*y = -2*x^5 + 3*x^4 - x^3 - x^2 - 6*x - 2
--            A Minimal Equation (away from 2):
--                    y^2 = x^6 + 18*x^3 + 36*x^2 - 27
--            Minimal Discriminant (away from 2):  1520984142
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 1520984142
-             Conductor: 954
-             Local Data:
-                     p=2
-@@ -436,18 +426,10 @@ class Genus2reduction(SageObject):
-             raise ValueError("Q (=%s) must have degree at most 3" % Q)
- 
-         res = pari.genus2red([P, Q])
--
-         conductor = ZZ(res[0])
--        minimal_equation = R(res[2])
--
--        minimal_disc = QQ(res[2].poldisc()).abs()
--        if minimal_equation.degree() == 5:
--            minimal_disc *= minimal_equation[5]**2
--        # Multiply with suitable power of 2 of the form 2^(2*(d-1) - 12)
--        b = 2 * (minimal_equation.degree() - 1)
--        k = QQ((12 - minimal_disc.valuation(2), b)).ceil()
--        minimal_disc >>= 12 - b*k
--        minimal_disc = ZZ(minimal_disc)
-+        Pmin = R(res[2][0])
-+        Qmin = R(res[2][1])
-+        minimal_disc = ZZ(pari.hyperelldisc(res[2]))
- 
-         local_data = {}
-         for red in res[3]:
-@@ -468,9 +450,7 @@ class Genus2reduction(SageObject):
- 
-             local_data[p] = data
- 
--        prime_to_2_conductor_only = (-1 in res[1].component(2))
--        return ReductionData(res, P, Q, minimal_equation, minimal_disc, local_data,
--                             conductor, prime_to_2_conductor_only)
-+        return ReductionData(res, P, Q, Pmin, Qmin, minimal_disc, local_data, conductor)
- 
-     def __reduce__(self):
-         return _reduce_load_genus2reduction, tuple([])
-diff --git a/src/sage/lfunctions/dokchitser.py b/src/sage/lfunctions/dokchitser.py
-index fec450d7bc..236402c293 100644
---- a/src/sage/lfunctions/dokchitser.py
-+++ b/src/sage/lfunctions/dokchitser.py
-@@ -337,6 +337,7 @@ class Dokchitser(SageObject):
-             # After init_coeffs is called, future calls to this method should
-             # return the full output for further parsing
-             raise RuntimeError("unable to create L-series, due to precision or other limits in PARI")
-+        t = t.replace("  *** _^_: Warning: normalizing a series with 0 leading term.\n", "")
-         return t
- 
-     def __check_init(self):
-diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
-index d2b20f1891..6c31efe239 100644
---- a/src/sage/lfunctions/pari.py
-+++ b/src/sage/lfunctions/pari.py
-@@ -339,7 +339,7 @@ def lfun_eta_quotient(scalings, exponents):
-         0.0374412812685155
- 
-         sage: lfun_eta_quotient([6],[4])
--        [[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4])]], 0, [0, 1], 2, 36, 1]
-+        [[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4]), 0]], 0, [0, 1], 2, 36, 1]
- 
-         sage: lfun_eta_quotient([2,1,4], [5,-2,-2])
-         Traceback (most recent call last):
-diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py
-index e5a2aa2517..0efcb15de0 100644
---- a/src/sage/libs/pari/tests.py
-+++ b/src/sage/libs/pari/tests.py
-@@ -356,7 +356,7 @@ Constructors::
-     [2, 4]~*x + [1, 3]~
- 
-     sage: pari(3).Qfb(7, 1)
--    Qfb(3, 7, 1, 0.E-19)
-+    Qfb(3, 7, 1)
-     sage: pari(3).Qfb(7, 2)
-     Traceback (most recent call last):
-     ...
-@@ -512,7 +512,7 @@ Basic functions::
-     sage: pari('sqrt(-2)').frac()
-     Traceback (most recent call last):
-     ...
--    PariError: incorrect type in gfloor (t_COMPLEX)
-+    PariError: incorrect type in gfrac (t_COMPLEX)
- 
-     sage: pari('1+2*I').imag()
-     2
-diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py
-index 25d93cac92..157ebabe29 100644
---- a/src/sage/modular/cusps_nf.py
-+++ b/src/sage/modular/cusps_nf.py
-@@ -1220,7 +1220,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/modform_hecketriangle/hecke_triangle_group_element.py b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-index a881336596..090d1bfaf0 100644
---- a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-+++ b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-@@ -43,7 +43,7 @@ def coerce_AA(p):
-         sage: AA(p)._exact_field()
-         Number Field in a with defining polynomial y^8 ... with a in ...
-         sage: coerce_AA(p)._exact_field()
--        Number Field in a with defining polynomial y^4 - 1910*y^2 - 3924*y + 681058 with a in 39.710518724...?
-+        Number Field in a with defining polynomial y^4 - 1910*y^2 - 3924*y + 681058 with a in ...?
-     """
-     el = AA(p)
-     el.simplify()
-diff --git a/src/sage/modular/modsym/p1list_nf.py b/src/sage/modular/modsym/p1list_nf.py
-index 222caacca8..f9d969732c 100644
---- a/src/sage/modular/modsym/p1list_nf.py
-+++ b/src/sage/modular/modsym/p1list_nf.py
-@@ -58,7 +58,7 @@ Lift an MSymbol to a matrix in `SL(2, R)`:
- 
-     sage: alpha = MSymbol(N, a + 2, 3*a^2)
-     sage: alpha.lift_to_sl2_Ok()
--    [-3*a^2 + a + 12, 25*a^2 - 50*a + 100, a + 2, a^2 - 3*a + 3]
-+    [-1, 4*a^2 - 13*a + 23, a + 2, 5*a^2 + 3*a - 3]
-     sage: Ok = k.ring_of_integers()
-     sage: M = Matrix(Ok, 2, alpha.lift_to_sl2_Ok())
-     sage: det(M)
-@@ -945,11 +945,11 @@ class P1NFList(SageObject):
-             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])
--            1
-+            5
- 
-         ::
- 
-diff --git a/src/sage/modules/free_quadratic_module_integer_symmetric.py b/src/sage/modules/free_quadratic_module_integer_symmetric.py
-index a206f0c721..aeb19ab669 100644
---- a/src/sage/modules/free_quadratic_module_integer_symmetric.py
-+++ b/src/sage/modules/free_quadratic_module_integer_symmetric.py
-@@ -1168,11 +1168,11 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
-             sage: A4 = IntegralLattice("A4")
-             sage: Aut = A4.orthogonal_group()
-             sage: Aut
--            Group of isometries with 5 generators (
--            [-1  0  0  0]  [0 0 0 1]  [-1 -1 -1  0]  [ 1  0  0  0]  [ 1  0  0  0]
--            [ 0 -1  0  0]  [0 0 1 0]  [ 0  0  0 -1]  [-1 -1 -1 -1]  [ 0  1  0  0]
--            [ 0  0 -1  0]  [0 1 0 0]  [ 0  0  1  1]  [ 0  0  0  1]  [ 0  0  1  1]
--            [ 0  0  0 -1], [1 0 0 0], [ 0  1  0  0], [ 0  0  1  0], [ 0  0  0 -1]
-+            Group of isometries with 4 generators (
-+            [0 0 0 1]  [-1 -1 -1  0]  [ 1  0  0  0]  [ 1  0  0  0]
-+            [0 0 1 0]  [ 0  0  0 -1]  [-1 -1 -1 -1]  [ 0  1  0  0]
-+            [0 1 0 0]  [ 0  0  1  1]  [ 0  0  0  1]  [ 0  0  1  1]
-+            [1 0 0 0], [ 0  1  0  0], [ 0  0  1  0], [ 0  0  0 -1]
-             )
- 
-         The group acts from the right on the lattice and its discriminant group::
-@@ -1180,19 +1180,19 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
-             sage: x = A4.an_element()
-             sage: g = Aut.an_element()
-             sage: g
--            [ 1  1  1  0]
--            [ 0  0 -1  0]
--            [ 0  0  1  1]
--            [ 0 -1 -1 -1]
-+            [-1 -1 -1  0]
-+            [ 0  0  1  0]
-+            [ 0  0 -1 -1]
-+            [ 0  1  1  1]
-             sage: x*g
--            (1, 1, 1, 0)
-+            (-1, -1, -1, 0)
-             sage: (x*g).parent()==A4
-             True
-             sage: (g*x).parent()
-             Vector space of dimension 4 over Rational Field
-             sage: y = A4.discriminant_group().an_element()
-             sage: y*g
--            (1)
-+            (4)
- 
-         If the group is finite we can compute the usual things::
- 
-@@ -1208,10 +1208,10 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
- 
-             sage: A2 = IntegralLattice(matrix.identity(3),Matrix(ZZ,2,3,[1,-1,0,0,1,-1]))
-             sage: A2.orthogonal_group()
--            Group of isometries with 3 generators (
--            [-1/3  2/3  2/3]  [ 2/3  2/3 -1/3]  [1 0 0]
--            [ 2/3 -1/3  2/3]  [ 2/3 -1/3  2/3]  [0 0 1]
--            [ 2/3  2/3 -1/3], [-1/3  2/3  2/3], [0 1 0]
-+            Group of isometries with 2 generators (
-+            [ 2/3  2/3 -1/3]  [1 0 0]
-+            [ 2/3 -1/3  2/3]  [0 0 1]
-+            [-1/3  2/3  2/3], [0 1 0]
-             )
- 
-         It can be negative definite as well::
-diff --git a/src/sage/quadratic_forms/binary_qf.py b/src/sage/quadratic_forms/binary_qf.py
-index cfa3ada73e..5ac823bc6c 100755
---- a/src/sage/quadratic_forms/binary_qf.py
-+++ b/src/sage/quadratic_forms/binary_qf.py
-@@ -141,7 +141,7 @@ class BinaryQF(SageObject):
-                   and a.degree() == 2 and a.parent().ngens() == 2):
-                 x, y = a.parent().gens()
-                 a, b, c = [a.monomial_coefficient(mon) for mon in [x**2, x*y, y**2]]
--            elif isinstance(a, pari_gen) and a.type() in ('t_QFI', 't_QFR'):
-+            elif isinstance(a, pari_gen) and a.type() in ('t_QFI', 't_QFR', 't_QFB'):
-                 # a has 3 or 4 components
-                 a, b, c = a[0], a[1], a[2]
-         try:
-diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py
-index 8290b6c4fa..0fc43f33c6 100644
---- a/src/sage/quadratic_forms/genera/genus.py
-+++ b/src/sage/quadratic_forms/genera/genus.py
-@@ -3088,8 +3088,8 @@ class GenusSymbol_global_ring():
-             sage: G = Genus(matrix(ZZ, 3, [6,3,0, 3,6,0, 0,0,2]))
-             sage: G.representatives()
-             (
--            [2 0 0]  [ 2 -1  0]
--            [0 6 3]  [-1  2  0]
-+            [2 0 0]  [ 2  1  0]
-+            [0 6 3]  [ 1  2  0]
-             [0 3 6], [ 0  0 18]
-             )
- 
-diff --git a/src/sage/quadratic_forms/qfsolve.py b/src/sage/quadratic_forms/qfsolve.py
-index ddde95e04f..d5e15d9f83 100644
---- a/src/sage/quadratic_forms/qfsolve.py
-+++ b/src/sage/quadratic_forms/qfsolve.py
-@@ -70,7 +70,7 @@ def qfsolve(G):
- 
-         sage: M = Matrix(QQ, [[3, 0, 0, 0], [0, 5, 0, 0], [0, 0, -7, 0], [0, 0, 0, -11]])
-         sage: qfsolve(M)
--        (3, -4, -3, -2)
-+        (3, 4, -3, -2)
-     """
-     ret = G.__pari__().qfsolve()
-     if ret.type() == 't_COL':
-diff --git a/src/sage/quadratic_forms/quadratic_form__automorphisms.py b/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-index c36c667e3b..3d72cf3be1 100644
---- a/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-+++ b/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-@@ -300,9 +300,9 @@ def automorphism_group(self):
-         sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
-         sage: Q.automorphism_group()
-         Matrix group over Rational Field with 3 generators (
--        [-1  0  0]  [0 0 1]  [ 0  0  1]
--        [ 0 -1  0]  [0 1 0]  [-1  0  0]
--        [ 0  0 -1], [1 0 0], [ 0  1  0]
-+        [ 0  0  1]  [1 0 0]  [ 1  0  0]
-+        [-1  0  0]  [0 0 1]  [ 0 -1  0]
-+        [ 0  1  0], [0 1 0], [ 0  0  1]
-         )
- 
-     ::
-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 9129ecb56a..d5a4cb8f22 100644
---- a/src/sage/rings/finite_rings/finite_field_prime_modn.py
-+++ b/src/sage/rings/finite_rings/finite_field_prime_modn.py
-@@ -111,7 +111,7 @@ class FiniteField_prime_modn(FiniteField_generic, integer_mod_ring.IntegerModRin
-             sage: RF13 = K.residue_field(pp)
-             sage: RF13.hom([GF(13)(1)])
-             Ring morphism:
--             From: Residue field of Fractional ideal (w + 18)
-+             From: Residue field of Fractional ideal (-w - 18)
-              To:   Finite Field of size 13
-              Defn: 1 |--> 1
- 
-diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx
-index 7596f2a302..1e1869f1b1 100644
---- a/src/sage/rings/finite_rings/residue_field.pyx
-+++ b/src/sage/rings/finite_rings/residue_field.pyx
-@@ -20,13 +20,13 @@ monogenic (i.e., 2 is an essential discriminant divisor)::
- 
-     sage: K.<a> = 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)
-+    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)
-     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`::
- 
-@@ -258,9 +258,9 @@ class ResidueFieldFactory(UniqueFactory):
-     the index of ``ZZ[a]`` in the maximal order for all ``a``::
- 
-         sage: K.<a> = NumberField(x^3 + x^2 - 2*x + 8); P = K.ideal(2).factor()[0][0]; P
--        Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F = K.residue_field(P); F
--        Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F(a)
-         0
-         sage: B = K.maximal_order().basis(); B
-@@ -270,7 +270,7 @@ class ResidueFieldFactory(UniqueFactory):
-         sage: F(B[2])
-         0
-         sage: F
--        Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F.degree()
-         1
- 
-@@ -730,15 +730,15 @@ class ResidueField_generic(Field):
-         EXAMPLES::
- 
-             sage: I = QQ[3^(1/3)].factor(5)[1][0]; I
--            Fractional ideal (-a + 2)
-+            Fractional ideal (a - 2)
-             sage: k = I.residue_field(); k
--            Residue field of Fractional ideal (-a + 2)
-+            Residue field of Fractional ideal (a - 2)
-             sage: f = k.lift_map(); f
-             Lifting map:
--              From: Residue field of Fractional ideal (-a + 2)
-+              From: Residue field of Fractional ideal (a - 2)
-               To:   Maximal Order in Number Field in a with defining polynomial x^3 - 3 with a = 1.442249570307409?
-             sage: f.domain()
--            Residue field of Fractional ideal (-a + 2)
-+            Residue field of Fractional ideal (a - 2)
-             sage: f.codomain()
-             Maximal Order in Number Field in a with defining polynomial x^3 - 3 with a = 1.442249570307409?
-             sage: f(k.0)
-@@ -768,7 +768,7 @@ class ResidueField_generic(Field):
- 
-             sage: K.<a> = NumberField(x^3-11)
-             sage: F = K.ideal(37).factor(); F
--            (Fractional ideal (37, a + 9)) * (Fractional ideal (37, a + 12)) * (Fractional ideal (2*a - 5))
-+            (Fractional ideal (37, a + 9)) * (Fractional ideal (37, a + 12)) * (Fractional ideal (-2*a + 5))
-             sage: k = K.residue_field(F[0][0])
-             sage: l = K.residue_field(F[1][0])
-             sage: k == l
-@@ -846,7 +846,7 @@ cdef class ReductionMap(Map):
-             sage: F.reduction_map()
-             Partially defined reduction map:
-               From: Number Field in a with defining polynomial x^3 + x^2 - 2*x + 8
--              To:   Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+              To:   Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
- 
-             sage: K.<theta_5> = CyclotomicField(5)
-             sage: F = K.factor(7)[0][0].residue_field()
-diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py
-index e99dff850f..759cbfb334 100644
---- a/src/sage/rings/number_field/S_unit_solver.py
-+++ b/src/sage/rings/number_field/S_unit_solver.py
-@@ -1781,20 +1781,20 @@ def sieve_ordering(SUK, q):
-         sage: SUK = K.S_unit_group(S=3)
-         sage: sieve_data = list(sieve_ordering(SUK, 19))
-         sage: sieve_data[0]
--        (Fractional ideal (xi - 3),
--         Fractional ideal (-2*xi^2 + 3),
-+        (Fractional ideal (-2*xi^2 + 3),
-+         Fractional ideal (-xi + 3),
-          Fractional ideal (2*xi + 1))
- 
-         sage: sieve_data[1]
--        (Residue field of Fractional ideal (xi - 3),
--         Residue field of Fractional ideal (-2*xi^2 + 3),
-+        (Residue field of Fractional ideal (-2*xi^2 + 3),
-+         Residue field of Fractional ideal (-xi + 3),
-          Residue field of Fractional ideal (2*xi + 1))
- 
-         sage: sieve_data[2]
--        ([18, 7, 16, 4], [18, 9, 12, 8], [18, 3, 10, 10])
-+        ([18, 12, 16, 8], [18, 16, 10, 4], [18, 10, 12, 10])
- 
-         sage: sieve_data[3]
--        (486, 648, 11664)
-+        (648, 2916, 3888)
-     """
- 
-     K = SUK.number_field()
-diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py
-index beb047ae02..b7c8c33d0b 100644
---- a/src/sage/rings/number_field/bdd_height.py
-+++ b/src/sage/rings/number_field/bdd_height.py
-@@ -248,7 +248,7 @@ def bdd_norm_pr_ideal_gens(K, norm_list):
-         sage: from sage.rings.number_field.bdd_height import bdd_norm_pr_ideal_gens
-         sage: K.<g> = QuadraticField(123)
-         sage: bdd_norm_pr_ideal_gens(K, range(5))
--        {0: [0], 1: [1], 2: [-g - 11], 3: [], 4: [2]}
-+        {0: [0], 1: [1], 2: [g + 11], 3: [], 4: [2]}
- 
-     ::
- 
-diff --git a/src/sage/rings/number_field/class_group.py b/src/sage/rings/number_field/class_group.py
-index 018ff5f5c6..73c0462cd1 100644
---- a/src/sage/rings/number_field/class_group.py
-+++ b/src/sage/rings/number_field/class_group.py
-@@ -221,11 +221,11 @@ class FractionalIdealClass(AbelianGroupWithValuesElement):
-             Class group of order 76 with structure C38 x C2
-             of Number Field in a with defining polynomial x^2 + 20072
-             sage: I = (G.0)^11; I
--            Fractional ideal class (41, 1/2*a + 5)
-+            Fractional ideal class (33, 1/2*a + 8)
-             sage: J = G(I.ideal()^5); J
--            Fractional ideal class (115856201, 1/2*a + 40407883)
-+            Fractional ideal class (39135393, 1/2*a + 13654253)
-             sage: J.reduce()
--            Fractional ideal class (57, 1/2*a + 44)
-+            Fractional ideal class (73, 1/2*a + 47)
-             sage: J == I^5
-             True
-         """
-diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py
-index 79acd053bb..e060148e4d 100644
---- a/src/sage/rings/number_field/galois_group.py
-+++ b/src/sage/rings/number_field/galois_group.py
-@@ -944,7 +944,7 @@ class GaloisGroup_v2(GaloisGroup_perm):
-             sage: K.<b> = 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,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)]
-+            [(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)]
-             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 58463d570d..ff65634e99 100644
---- a/src/sage/rings/number_field/number_field.py
-+++ b/src/sage/rings/number_field/number_field.py
-@@ -3643,7 +3643,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: L.<b> = K.extension(x^2 - 3, x^2 + 1)
-             sage: M.<c> = 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
- 
-@@ -4227,7 +4227,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             (y^2 + 6, Mod(1/6*y, y^2 + 6), Mod(6*y, y^2 + 1/6))
-         """
-         f = self.absolute_polynomial()._pari_with_name('y')
--        if f.pollead() == f.content().denominator() == 1:
-+        f = f * f.content().denominator()
-+        if f.pollead() == 1:
-             g = f
-             alpha = beta = g.variable().Mod(g)
-         else:
-@@ -4821,7 +4822,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: K.<a> = 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))]
-@@ -5166,7 +5167,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: [K.ideal(g).factor() for g in gens]
-             [(Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1)),
--            Fractional ideal (-a),
-+            Fractional ideal (a),
-             (Fractional ideal (2, a + 1))^2,
-             1]
- 
-@@ -5751,7 +5752,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: K.elements_of_norm(3)
-             []
-             sage: K.elements_of_norm(50)
--            [-7*a + 1, 5*a - 5, 7*a + 1]
-+            [-a - 7, 5*a - 5, 7*a + 1]
- 
-         TESTS:
- 
-@@ -5863,7 +5864,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             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 (-3*a - 2))
-+            (Fractional ideal (a + 1)) * (Fractional ideal (-a - 2))^-1 * (Fractional ideal (2*a + 1))^-1 * (Fractional ideal (-2*a + 3))
- 
-         An example over a relative number field::
- 
-@@ -6460,9 +6461,9 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: new_basis = k.reduced_basis(prec=120)
-             sage: [c.minpoly() for c in new_basis]
-             [x - 1,
--             x^2 - 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^6 - 3*x^5 - 102*x^4 + 315*x^3 + 10254*x^2 - 80955*x + 198147,
-              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)
-@@ -7058,7 +7059,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-              -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,
--             -a^14 - a^13 + a^12 + 2*a^10 + a^8 - 2*a^7 - 2*a^6 + 2*a^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)
- 
-         TESTS:
- 
-@@ -7067,7 +7068,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: K.<a> = NumberField(1/2*x^2 - 1/6)
-             sage: K.units()
--            (-3*a + 2,)
-+            (3*a - 2,)
-         """
-         proof = proof_flag(proof)
- 
-@@ -7146,7 +7147,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: U.gens()
-             (u0, u1, u2, u3, u4, u5, u6, u7, u8)
-             sage: U.gens_values()  # result not independently verified
--            [-1, -a^9 - a + 1, -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, -a^14 - a^13 + a^12 + 2*a^10 + a^8 - 2*a^7 - 2*a^6 + 2*a^3 - a^2 + 2*a - 2]
-+            [-1, -a^9 - a + 1, -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]
-         """
-         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 784c239dc1..aa740069dc 100644
---- a/src/sage/rings/number_field/number_field_element.pyx
-+++ b/src/sage/rings/number_field/number_field_element.pyx
-@@ -4446,7 +4446,7 @@ cdef class NumberFieldElement(FieldElement):
-             sage: f = Qi.embeddings(K)[0]
-             sage: a = f(2+3*i) * (2-zeta)^2
-             sage: a.descend_mod_power(Qi,2)
--            [-3*i - 2, -2*i + 3]
-+            [-2*i + 3, 3*i + 2]
- 
-         An absolute example::
- 
-@@ -5124,7 +5124,7 @@ cdef class NumberFieldElement_relative(NumberFieldElement):
-         EXAMPLES::
- 
-             sage: K.<a, b, c> = NumberField([x^2 - 2, x^2 - 3, x^2 - 5])
--            sage: P = K.prime_factors(5)[0]
-+            sage: P = K.prime_factors(5)[1]
-             sage: (2*a + b - c).valuation(P)
-             1
-         """
-diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
-index 5f587556a4..33481fead0 100644
---- a/src/sage/rings/number_field/number_field_ideal.py
-+++ b/src/sage/rings/number_field/number_field_ideal.py
-@@ -3355,7 +3355,7 @@ def quotient_char_p(I, p):
-         []
- 
-         sage: I = K.factor(13)[0][0]; I
--        Fractional ideal (-3*i - 2)
-+        Fractional ideal (-2*i + 3)
-         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 bae36d4b9c..f64bd5b761 100644
---- a/src/sage/rings/number_field/number_field_ideal_rel.py
-+++ b/src/sage/rings/number_field/number_field_ideal_rel.py
-@@ -272,7 +272,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = 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
-@@ -401,7 +401,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = K.extension(5*x^2 + 1)
-             sage: P = L.primes_above(2)[0]
-             sage: P.relative_norm()
--            Fractional ideal (-6*a + 2)
-+            Fractional ideal (6*a + 2)
-         """
-         L = self.number_field()
-         K = L.base_field()
-@@ -518,7 +518,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = K.extension(5*x^2 + 1)
-             sage: P = L.primes_above(2)[0]
-             sage: P.ideal_below()
--            Fractional ideal (-6*a + 2)
-+            Fractional ideal (6*a + 2)
-         """
-         L = self.number_field()
-         K = L.base_field()
-diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py
-index d33980c4b1..50e846b205 100644
---- a/src/sage/rings/number_field/number_field_rel.py
-+++ b/src/sage/rings/number_field/number_field_rel.py
-@@ -213,14 +213,14 @@ class NumberField_relative(NumberField_generic):
-             sage: l.<b> = 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 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4), ..., y^4 + 6*y^2 + 1, x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4)], [0, 0]]
-+            [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]]
-             sage: b
-             b
- 
-             sage: l.<b> = 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 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4), ..., y^4 + 6*y^2 + 1, x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4)], [0, 0]]
-+            [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]]
-             sage: b
-             b
- 
-diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py
-index 6eca89ed8d..78ef4c3b33 100644
---- a/src/sage/rings/number_field/order.py
-+++ b/src/sage/rings/number_field/order.py
-@@ -520,7 +520,7 @@ class Order(IntegralDomain, sage.rings.abc.Order):
-             sage: k.<a> = 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 (11, a + 7)
-+            Fractional ideal class (43, a + 13)
-             sage: Ok = k.maximal_order(); Ok
-             Maximal Order in Number Field in a with defining polynomial x^2 + 5077
-             sage: Ok * (11, a + 7)
-diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py
-index c534aaa9f6..6bc67565d2 100644
---- a/src/sage/rings/number_field/selmer_group.py
-+++ b/src/sage/rings/number_field/selmer_group.py
-@@ -491,7 +491,7 @@ 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 (a),
-         (Fractional ideal (2, a + 1))^2,
-         1]
- 
-diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py
-index bb5d8356be..8a7e5fa66f 100644
---- a/src/sage/rings/polynomial/polynomial_quotient_ring.py
-+++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py
-@@ -1791,7 +1791,7 @@ class PolynomialQuotientRing_generic(CommutativeRing):
-             sage: D.selmer_generators([K.ideal(2, -a+1), K.ideal(3, a+1)], 3)
-             [2, a + 1]
-             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))
-diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
-index 704b77ce5f..83ee4549e4 100644
---- a/src/sage/rings/qqbar.py
-+++ b/src/sage/rings/qqbar.py
-@@ -312,8 +312,8 @@ and we get a way to produce the number directly::
-     True
-     sage: sage_input(n)
-     R.<y> = QQ[]
--    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(RR(0.51763809020504148), RR(0.51763809020504159)))
--    -109*v^3 - 89*v^2 + 327*v + 178
-+    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(-RR(1.9318516525781366), -RR(1.9318516525781364)))
-+    -109*v^3 + 89*v^2 + 327*v - 178
- 
- We can also see that some computations (basically, those which are
- easy to perform exactly) are performed directly, instead of storing
-@@ -362,7 +362,7 @@ algorithms in :trac:`10255`::
-     # Verified
-     R1.<x> = QQbar[]
-     R2.<y> = QQ[]
--    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(RR(0.51763809020504148), RR(0.51763809020504159)))
-+    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(-RR(1.9318516525781366), -RR(1.9318516525781364)))
-     AA.polynomial_root(AA.common_polynomial(x^4 + QQbar(v^3 - 3*v - 1)*x^3 + QQbar(-v^3 + 3*v - 3)*x^2 + QQbar(-3*v^3 + 9*v + 3)*x + QQbar(3*v^3 - 9*v)), RIF(RR(0.99999999999999989), RR(1.0000000000000002)))
-     sage: one
-     1
-@@ -2310,7 +2310,7 @@ def do_polred(poly, threshold=32):
-     cost = 2 * bitsize.nbits() + 5 * poly.degree().nbits()
-     if cost > threshold:
-         return parent.gen(), parent.gen(), poly
--    new_poly, elt_back = poly.__pari__().polredbest(flag=1)
-+    new_poly, elt_back = poly.numerator().__pari__().polredbest(flag=1)
-     elt_fwd = elt_back.modreverse()
-     return parent(elt_fwd.lift()), parent(elt_back.lift()), parent(new_poly)
- 
-@@ -2542,10 +2542,10 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-            Defn: a |--> 1.414213562373095?)
- 
-         sage: number_field_elements_from_algebraics((rt2,rt3))
--        (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, -a^2 + 2], Ring morphism:
-+        (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, a^2 - 2], Ring morphism:
-             From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-             To:   Algebraic Real Field
--            Defn: a |--> 0.5176380902050415?)
-+            Defn: a |--> -1.931851652578137?)
- 
-     ``rt3a`` is a real number in ``QQbar``.  Ordinarily, we'd get a homomorphism
-     to ``AA`` (because all elements are real), but if we specify ``same_field=True``,
-@@ -2570,7 +2570,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^3 + 3*a, Ring morphism:
-             From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-             To:   Algebraic Real Field
--            Defn: a |--> 0.5176380902050415?)
-+            Defn: a |--> -1.931851652578137?)
- 
-     We can specify ``minimal=True`` if we want the smallest number field::
- 
-@@ -2618,7 +2618,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         sage: nfI^2
-         -1
-         sage: sum = nfrt2 + nfrt3 + nfI + nfz3; sum
--        2*a^6 + a^5 - a^4 - a^3 - 2*a^2 - a
-+        a^5 + a^4 - a^3 + 2*a^2 - a - 1
-         sage: hom(sum)
-         2.646264369941973? + 1.866025403784439?*I
-         sage: hom(sum) == rt2 + rt3 + qqI + z3
-@@ -2658,7 +2658,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
-         sage: nf
-         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
--          with a = 0.2598678911433438? + 0.0572892247058457?*I
-+          with a = 0.2598679? + 0.0572892?*I
-         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
-         True
- 
-@@ -2725,7 +2725,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-                          sqrt(2), AA.polynomial_root(x^3-3, RIF(0,3)), 11/9, 1]
-         sage: res = number_field_elements_from_algebraics(my_nums, embedded=True)
-         sage: res[0]
--        Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = -95.5053039433554?
-+        Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = 93.32530798172420?
-     """
-     gen = qq_generator
- 
-@@ -3129,7 +3129,7 @@ class AlgebraicGenerator(SageObject):
-             sage: root = ANRoot(x^2 - x - 1, RIF(1, 2))
-             sage: gen = AlgebraicGenerator(nf, root)
-             sage: gen.pari_field()
--             [y^2 - y - 1, [2, 0], ...]
-+            [[y^2 - y - 1, [2, 0], ...]
-         """
-         if self.is_trivial():
-             raise ValueError("No PARI field attached to trivial generator")
-@@ -3213,7 +3213,7 @@ class AlgebraicGenerator(SageObject):
-             sage: qq_generator.union(gen3) is gen3
-             True
-             sage: gen2.union(gen3)
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-         """
-         if self._trivial:
-             return other
-@@ -3306,13 +3306,13 @@ class AlgebraicGenerator(SageObject):
-             Number Field in a with defining polynomial y^2 - 3 with a in 1.732050807568878?
-             sage: gen2_3 = gen2.union(gen3)
-             sage: gen2_3
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-             sage: qq_generator.super_poly(gen2) is None
-             True
-             sage: gen2.super_poly(gen2_3)
-             -a^3 + 3*a
-             sage: gen3.super_poly(gen2_3)
--            -a^2 + 2
-+            a^2 - 2
- 
-         """
-         if checked is None:
-@@ -3360,13 +3360,13 @@ class AlgebraicGenerator(SageObject):
-             sage: sqrt3 = ANExtensionElement(gen3, nf3.gen())
-             sage: gen2_3 = gen2.union(gen3)
-             sage: gen2_3
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-             sage: gen2_3(sqrt2)
-             -a^3 + 3*a
-             sage: gen2_3(ANRational(1/7))
-             1/7
-             sage: gen2_3(sqrt3)
--            -a^2 + 2
-+            a^2 - 2
-         """
-         if self._trivial:
-             return elt._value
-@@ -4336,10 +4336,10 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: rt3 = AA(sqrt(3))
-             sage: rt3b = rt2 + rt3 - rt2
-             sage: rt3b.as_number_field_element()
--            (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^2 + 2, Ring morphism:
-+            (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, a^2 - 2, Ring morphism:
-                 From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-                 To:   Algebraic Real Field
--                Defn: a |--> 0.5176380902050415?)
-+                Defn: a |--> -1.931851652578137?)
-             sage: rt3b.as_number_field_element(minimal=True)
-             (Number Field in a with defining polynomial y^2 - 3, a, Ring morphism:
-                From: Number Field in a with defining polynomial y^2 - 3
-@@ -4401,7 +4401,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: rt2b = rt3 + rt2 - rt3
-             sage: rt2b.exactify()
-             sage: rt2b._exact_value()
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b.simplify()
-             sage: rt2b._exact_value()
-             a where a^2 - 2 = 0 and a in 1.414213562373095?
-@@ -4422,7 +4422,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: QQbar(2)._exact_field()
-             Trivial generator
-             sage: (sqrt(QQbar(2)) + sqrt(QQbar(19)))._exact_field()
--            Number Field in a with defining polynomial y^4 - 20*y^2 + 81 with a in 2.375100220297941?
-+            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?
-         """
-@@ -4442,7 +4442,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: QQbar(2)._exact_value()
-             2
-             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 2.375100220297941?
-+            -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?
-         """
-@@ -6857,7 +6857,7 @@ class AlgebraicPolynomialTracker(SageObject):
-             sage: p = sqrt(AA(2)) * x^2 - sqrt(AA(3))
-             sage: cp = AA.common_polynomial(p)
-             sage: cp.generator()
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 1.931851652578137?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -0.5176380902050415?
-         """
-         self.exactify()
-         return self._gen
-@@ -7706,7 +7706,7 @@ class ANExtensionElement(ANDescr):
- 
-             sage: rt2b.exactify()
-             sage: rt2b._descr
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b._descr.is_simple()
-             False
-         """
-@@ -7791,7 +7791,7 @@ class ANExtensionElement(ANDescr):
-             sage: rt2b = rt3 + rt2 - rt3
-             sage: rt2b.exactify()
-             sage: rt2b._descr
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b._descr.simplify(rt2b)
-             a where a^2 - 2 = 0 and a in 1.414213562373095?
-         """
-@@ -7830,9 +7830,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.neg(a)
--            1/3*a^3 - 2/3*a^2 + 4/3*a - 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-             sage: b.neg("ham spam and eggs")
--            1/3*a^3 - 2/3*a^2 + 4/3*a - 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-         """
-         return ANExtensionElement(self._generator, -self._value)
- 
-@@ -7848,9 +7848,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.invert(a)
--            7/3*a^3 - 2/3*a^2 + 4/3*a - 12 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-             sage: b.invert("ham spam and eggs")
--            7/3*a^3 - 2/3*a^2 + 4/3*a - 12 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-         """
-         return ANExtensionElement(self._generator, ~self._value)
- 
-@@ -7866,9 +7866,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.conjugate(a)
--            -1/3*a^3 + 2/3*a^2 - 4/3*a + 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? + 1.573132184970987?*I
-+            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
-             sage: b.conjugate("ham spam and eggs")
--            -1/3*a^3 + 2/3*a^2 - 4/3*a + 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? + 1.573132184970987?*I
-+            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
-         """
-         if self._exactly_real:
-             return self
-@@ -8501,7 +8501,7 @@ def an_binop_expr(a, b, op):
-         sage: x = an_binop_expr(a, b, operator.add); x
-         <sage.rings.qqbar.ANBinaryExpr object at ...>
-         sage: x.exactify()
--        -6/7*a^7 + 2/7*a^6 + 71/7*a^5 - 26/7*a^4 - 125/7*a^3 + 72/7*a^2 + 43/7*a - 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in 3.12580...?
-+        6/7*a^7 - 2/7*a^6 - 71/7*a^5 + 26/7*a^4 + 125/7*a^3 - 72/7*a^2 - 43/7*a + 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997?
- 
-         sage: a = QQbar(sqrt(2)) + QQbar(sqrt(3))
-         sage: b = QQbar(sqrt(3)) + QQbar(sqrt(5))
-@@ -8510,7 +8510,7 @@ def an_binop_expr(a, b, op):
-         sage: x = an_binop_expr(a, b, operator.mul); x
-         <sage.rings.qqbar.ANBinaryExpr object at ...>
-         sage: x.exactify()
--        2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in 3.1258...?
-+        2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997?
-     """
-     return ANBinaryExpr(a, b, op)
- 
-diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py
-index 1c4f2dff18..32c2e47e49 100644
---- a/src/sage/schemes/affine/affine_morphism.py
-+++ b/src/sage/schemes/affine/affine_morphism.py
-@@ -1148,9 +1148,9 @@ class SchemeMorphism_polynomial_affine_space_field(SchemeMorphism_polynomial_aff
-             sage: H = End(A)
-             sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)])
-             sage: f.reduce_base_field()
--            Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = 1.931851652578137?
-+            Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = ...?
-               Defn: Defined on coordinates by sending (x) to
--                    (((a^3 - 3*a)*x^2 + (1/3*a^2 - 2/3))/(5*x))
-+                    (((a^3 - 3*a)*x^2 + (-1/3*a^2 + 2/3))/(5*x))
- 
-         ::
- 
-diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py
-index 68b8375dae..48f358ea6a 100644
---- a/src/sage/schemes/elliptic_curves/ell_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_field.py
-@@ -845,7 +845,7 @@ class EllipticCurve_field(ell_generic.EllipticCurve_generic, ProjectivePlaneCurv
-             sage: E = E.base_extend(G).quadratic_twist(c); E
-             Elliptic Curve defined 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.<b> = E.division_field(3, simplify_all=True); K
--            Number Field in b with defining polynomial x^12 - 10*x^10 + 55*x^8 - 60*x^6 + 75*x^4 + 1350*x^2 + 2025
-+            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_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py
-index 926ae310ea..3bae819fb0 100644
---- a/src/sage/schemes/elliptic_curves/ell_generic.py
-+++ b/src/sage/schemes/elliptic_curves/ell_generic.py
-@@ -3324,8 +3324,8 @@ class EllipticCurve_generic(WithEqualityById, plane_curve.ProjectivePlaneCurve):
-             sage: K.<a> = QuadraticField(2)
-             sage: E = EllipticCurve([1,a])
-             sage: E.pari_curve()
--            [Mod(0, y^2 - 2), Mod(0, y^2 - 2), Mod(0, y^2 - 2), Mod(1, y^2 - 2),
--            Mod(y, y^2 - 2), Mod(0, y^2 - 2), Mod(2, y^2 - 2), Mod(4*y, y^2 - 2),
-+            [0, 0, 0, Mod(1, y^2 - 2),
-+            Mod(y, y^2 - 2), 0, Mod(2, y^2 - 2), Mod(4*y, y^2 - 2),
-             Mod(-1, y^2 - 2), Mod(-48, y^2 - 2), Mod(-864*y, y^2 - 2),
-             Mod(-928, y^2 - 2), Mod(3456/29, y^2 - 2), Vecsmall([5]),
-             [[y^2 - 2, [2, 0], 8, 1, [[1, -1.41421356237310;
-diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
-index edbd196090..c44c803aa8 100644
---- a/src/sage/schemes/elliptic_curves/ell_number_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
-@@ -218,7 +218,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: E == loads(dumps(E))
-             True
-             sage: E.simon_two_descent()
--            (2, 2, [(0 : 0 : 1)])
-+            (2, 2, [(0 : 0 : 1), (1/18*a + 7/18 : -5/54*a - 17/54 : 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)])
- 
-@@ -274,7 +274,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: E.simon_two_descent()  # long time (4s on sage.math, 2013)
-             (3,
-              3,
--             [(5/8*zeta43_0^2 + 17/8*zeta43_0 - 9/4 : -27/16*zeta43_0^2 - 103/16*zeta43_0 + 39/8 : 1),
-+             [(1/8*zeta43_0^2 - 3/8*zeta43_0 - 1/4 : -5/16*zeta43_0^2 + 7/16*zeta43_0 + 1/8 : 1),
-               (0 : 0 : 1)])
-         """
-         verbose = int(verbose)
-@@ -865,7 +865,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             Conductor exponent: 1
-             Kodaira Symbol: I1
-             Tamagawa Number: 1,
--            Local data at Fractional ideal (-3*i - 2):
-+            Local data at Fractional ideal (-2*i + 3):
-             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
-             Minimal discriminant valuation: 2
-@@ -2645,12 +2645,12 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             [-92, -23, -23]
- 
-             sage: C.matrix()  # long time
--            [1 2 2 4 2 4]
--            [2 1 2 2 4 4]
--            [2 2 1 4 4 2]
--            [4 2 4 1 3 3]
--            [2 4 4 3 1 3]
--            [4 4 2 3 3 1]
-+            [1 2 2 4 4 2]
-+            [2 1 2 4 2 4]
-+            [2 2 1 2 4 4]
-+            [4 4 2 1 3 3]
-+            [4 2 4 3 1 3]
-+            [2 4 4 3 3 1]
- 
-         The graph of this isogeny class has a shape which does not
-         occur over `\QQ`: a triangular prism.  Note that for curves
-@@ -2677,12 +2677,12 @@ class EllipticCurve_number_field(EllipticCurve_field):
- 
-             sage: G = C.graph()  # long time
-             sage: G.adjacency_matrix()  # long time
--            [0 1 1 0 1 0]
--            [1 0 1 1 0 0]
--            [1 1 0 0 0 1]
--            [0 1 0 0 1 1]
--            [1 0 0 1 0 1]
--            [0 0 1 1 1 0]
-+            [0 1 1 0 0 1]
-+            [1 0 1 0 1 0]
-+            [1 1 0 1 0 0]
-+            [0 0 1 0 1 1]
-+            [0 1 0 1 0 1]
-+            [1 0 0 1 1 0]
- 
-         To display the graph without any edge labels::
- 
-@@ -3316,7 +3316,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: points = [E.lift_x(x) for x in xi]
-             sage: newpoints, U = E.lll_reduce(points)  # long time (35s on sage.math, 2011)
-             sage: [P[0] for P in newpoints]            # long time
--            [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 175620639884534615751/25, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7404442636649562303, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297]
-+            [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 11465667352242779838, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7041412654828066743, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297]
- 
-         An example to show the explicit use of the height pairing matrix::
- 
-diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py
-index 3808822812..a75290ea35 100644
---- a/src/sage/schemes/elliptic_curves/ell_rational_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py
-@@ -1827,7 +1827,7 @@ class EllipticCurve_rational_field(EllipticCurve_number_field):
-             sage: E = EllipticCurve('389a1')
-             sage: E._known_points = []  # clear cached points
-             sage: E.simon_two_descent()
--            (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)])
-+            (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/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 81ad295160..d484a4a18b 100644
---- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
-+++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
-@@ -780,12 +780,12 @@ 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 (a),
-          Fractional ideal (-2*a + 3),
-          Fractional ideal (2*a + 3),
-          Fractional ideal (a + 6),
-diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py
-index 28b97f34af..9f7d1b6020 100644
---- a/src/sage/schemes/elliptic_curves/gp_simon.py
-+++ b/src/sage/schemes/elliptic_curves/gp_simon.py
-@@ -56,7 +56,7 @@ 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)
--        (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)])
-+        (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)])
- 
-     TESTS::
- 
-@@ -117,7 +117,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
-     # The block below mimics the defaults in Simon's scripts, and needs to be changed
-     # when these are updated.
-     if K is QQ:
--        cmd = 'ellrank(%s, %s);' % (list(E.ainvs()), [P.__pari__() for P in known_points])
-+        cmd = 'ellQ_ellrank(%s, %s);' % (list(E.ainvs()), [P.__pari__() for P in known_points])
-         if lim1 is None:
-             lim1 = 5
-         if lim3 is None:
-@@ -144,7 +144,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
-     if verbose > 0:
-         print(s)
-     v = gp.eval('ans')
--    if v=='ans': # then the call to ellrank() or bnfellrank() failed
-+    if v=='ans': # then the call to ellQ_ellrank() or bnfellrank() failed
-         raise RuntimeError("An error occurred while running Simon's 2-descent program")
-     if verbose >= 2:
-         print("v = %s" % v)
-diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-index a936deb74f..dc19254d8c 100644
---- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-+++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-@@ -1208,14 +1208,14 @@ def isogenies_13_0(E, minimal_models=True):
-         sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
-         [(0,
-           0,
--          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645,
-+          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
-           -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
--          579363345221/13763747804451840*a^11 + 371192377511/860234237778240*a^10 + 8855090365657/1146978983704320*a^9 + 5367261541663/1633873196160*a^8 + 614883554332193/15930263662560*a^7 + 30485197378483/68078049840*a^6 - 131000897588387/2450809794240*a^5 - 203628705777949/306351224280*a^4 - 1587619388190379/204234149520*a^3 + 14435069706551/11346341640*a^2 + 7537273048614/472764235*a + 89198980034806/472764235),
-+          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
-          (0,
-           0,
--          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645,
-+          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
-           -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
--          -132601797212627/3440936951112960*a^11 - 6212467020502021/13763747804451840*a^10 - 1515926454902497/286744745926080*a^9 - 15154913741799637/4901619588480*a^8 - 576888119803859263/15930263662560*a^7 - 86626751639648671/204234149520*a^6 + 16436657569218427/306351224280*a^5 + 1540027900265659087/2450809794240*a^4 + 375782662805915809/51058537380*a^3 - 14831920924677883/11346341640*a^2 - 7237947774817724/472764235*a - 84773764066089509/472764235)]
-+          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
-     """
-     if E.j_invariant()!=0:
-         raise ValueError("j-invariant must be 0.")
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
deleted file mode 100644
index 762bb2612632..000000000000
--- a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From f0365f30834b6890313790b3845c647d0160fa6a Mon Sep 17 00:00:00 2001
-From: Vincent Delecroix <20100.delecroix@gmail.com*>
-Date: Fri, 30 Sep 2022 16:31:08 +0200
-Subject: fix doctest if fqf_orthogonal
-
----
- src/sage/groups/fqf_orthogonal.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
-index 75de408..7fc4dbe 100644
---- a/src/sage/groups/fqf_orthogonal.py
-+++ b/src/sage/groups/fqf_orthogonal.py
-@@ -245,10 +245,10 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
-             sage: all(x*f==x*fbar for x in q.gens())
-             True
-             sage: L = IntegralLattice("A2").twist(3)
--            sage: q = L.discriminant_group()
-             sage: OL = L.orthogonal_group()
-+            sage: assert OL(OL.0.matrix()) == OL.0
-+            sage: q = L.discriminant_group()
-             sage: Oq = q.orthogonal_group()
--            sage: assert Oq(OL.0) == Oq(OL.0.matrix())
-             sage: assert Oq(Oq.0.matrix()) == Oq.0
-         """
-         from sage.libs.gap.element import GapElement
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch b/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
deleted file mode 100644
index 6afaf1b7162f..000000000000
--- a/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-commit 5501e0de0dca1cff0355326dd42bd8c7e5749568
-Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
-Date:   Tue Oct 11 17:25:04 2022 -0300
-
-    Support matplotlib 3.6
-
-diff --git a/src/sage/plot/arc.py b/src/sage/plot/arc.py
-index bb834763afc..f65973bcbd5 100644
---- a/src/sage/plot/arc.py
-+++ b/src/sage/plot/arc.py
-@@ -273,9 +273,9 @@ class Arc(GraphicPrimitive):
-         p = patches.Arc((self.x, self.y),
-                         2. * self.r1,
-                         2. * self.r2,
--                        fmod(self.angle, 2 * pi) * (180. / pi),
--                        self.s1 * (180. / pi),
--                        self.s2 * (180. / pi))
-+                        angle=fmod(self.angle, 2 * pi) * (180. / pi),
-+                        theta1=self.s1 * (180. / pi),
-+                        theta2=self.s2 * (180. / pi))
-         return p
- 
-     def bezier_path(self):
-diff --git a/src/sage/plot/ellipse.py b/src/sage/plot/ellipse.py
-index a77e6fe640a..c35bed574ef 100644
---- a/src/sage/plot/ellipse.py
-+++ b/src/sage/plot/ellipse.py
-@@ -192,7 +192,8 @@ class Ellipse(GraphicPrimitive):
-         options = self.options()
-         p = patches.Ellipse(
-                 (self.x,self.y),
--                self.r1*2.,self.r2*2.,self.angle/pi*180.)
-+                self.r1*2.,self.r2*2.,
-+                angle=self.angle/pi*180.)
-         p.set_linewidth(float(options['thickness']))
-         p.set_fill(options['fill'])
-         a = float(options['alpha'])
-diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py
-index e779e1210e3..8d620b5c625 100644
---- a/src/sage/plot/graphics.py
-+++ b/src/sage/plot/graphics.py
-@@ -2007,7 +2007,7 @@ class Graphics(WithEqualityById, SageObject):
-         We can also do custom formatting if you need it.  See above for full
-         details::
- 
--            sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex")
-+            sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") # not tested (broken with matplotlib 3.6)
-             Graphics object consisting of 1 graphics primitive
- 
-         This is particularly useful when setting custom ticks in multiples
-@@ -2341,7 +2341,7 @@ class Graphics(WithEqualityById, SageObject):
-             sage: subplot = Figure().add_subplot(111)
-             sage: p._objects[0]._render_on_subplot(subplot)
-             sage: p._matplotlib_tick_formatter(subplot, **d)
--            (<AxesSubplot:>,
-+            (<AxesSubplot:...>,
-             <matplotlib.ticker.MaxNLocator object at ...>,
-             <matplotlib.ticker.MaxNLocator object at ...>,
-             <matplotlib.ticker.ScalarFormatter object at ...>,
-diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py
-index b36ee57227c..5301a05c3dc 100644
---- a/src/sage/plot/plot.py
-+++ b/src/sage/plot/plot.py
-@@ -1741,7 +1741,7 @@ def plot(funcs, *args, **kwds):
- 
-     ::
- 
--        sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex")
-+        sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") # not tested (broken with matplotlib 3.6)
-         Graphics object consisting of 1 graphics primitive
- 
-     .. PLOT::
diff --git a/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch b/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
new file mode 100644
index 000000000000..f2f825e4fb10
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
@@ -0,0 +1,205 @@
+diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini
+index 2e33a405d36..313463d2fea 100644
+--- a/build/pkgs/singular/checksums.ini
++++ b/build/pkgs/singular/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=singular-VERSION.tar.gz
+-sha1=6c2b622d3681e2de3d58d30c654d43d3e32b720c
+-md5=abb1e37c794472e7760655358ab66054
+-cksum=17455733
++sha1=28bb3ee97ef48d04dfa96de182fd93eebe08426c
++md5=fc0a4f5720dadba45a52ee94324ce00c
++cksum=1573851737
+ upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz
+diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt
+index 11300c77e7d..66e2bede53a 100644
+--- a/build/pkgs/singular/package-version.txt
++++ b/build/pkgs/singular/package-version.txt
+@@ -1 +1 @@
+-4.3.1p1
++4.3.1p3
+diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd
+index 8e3ac314b67..747a6b1e2fb 100644
+--- a/src/sage/libs/singular/decl.pxd
++++ b/src/sage/libs/singular/decl.pxd
+@@ -574,7 +574,7 @@ cdef extern from "singular/Singular/libsingular.h":
+ 
+     # gets a component out of a polynomial vector
+ 
+-    poly *pTakeOutComp1(poly **, int)
++    poly *pTakeOutComp(poly **, int)
+ 
+     # deep copy p
+ 
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index d8ea7b07f3c..3a1271cd59f 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -1726,20 +1726,21 @@ cdef int overflow_check(unsigned long e, ring *_ring) except -1:
+ 
+     Whether an overflow occurs or not partially depends
+     on the number of variables in the ring. See trac ticket
+-    :trac:`11856`. With Singular 4, it is by default optimized
+-    for at least 4 variables on 64-bit and 2 variables on 32-bit,
+-    which in both cases makes a maximal default exponent of
+-    2^16-1.
++    :trac:`11856`.
+ 
+     EXAMPLES::
+ 
+         sage: P.<x,y> = QQ[]
+-        sage: y^(2^16-1)
+-        y^65535
+-        sage: y^2^16
++        sage: y^(2^30)
++        Traceback (most recent call last):             # 32-bit
++        ...                                            # 32-bit
++        OverflowError: exponent overflow (1073741824)  # 32-bit
++        y^1073741824  # 64-bit
++        sage: y^2^32
+         Traceback (most recent call last):
+         ...
+-        OverflowError: exponent overflow (65536)
++        OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++        OverflowError: exponent overflow (4294967296)  # 64-bit
+     """
+     if unlikely(e > _ring.bitmask):
+         raise OverflowError("exponent overflow (%d)"%(e))
+diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+index 7dc058a22f0..71494eddbc0 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_ideal.py
++++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+@@ -60,7 +60,7 @@
+ Note that the result of a computation is not necessarily reduced::
+ 
+     sage: (a+b)^17
+-    256*a*b^16 + 256*b^17
++    a*b^16 + b^17
+     sage: S(17) == 0
+     True
+ 
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index 4dad016b33f..9bf67dd1425 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -193,7 +193,7 @@ from sage.libs.singular.decl cimport (
+     p_IsUnit, p_IsOne, p_Series, p_Head, idInit, fast_map_common_subexp, id_Delete,
+     p_IsHomogeneous, p_Homogen, p_Totaldegree,pLDeg1_Totaldegree, singclap_pdivide, singclap_factorize,
+     idLift, IDELEMS, On, Off, SW_USE_CHINREM_GCD, SW_USE_EZGCD,
+-    p_LmIsConstant, pTakeOutComp1, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
++    p_LmIsConstant, pTakeOutComp, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
+     pLength, kNF, p_Neg, p_Minus_mm_Mult_qq, p_Plus_mm_Mult_qq,
+     pDiff, singclap_resultant, p_Normalize,
+     prCopyR, prCopyR_NoSort)
+@@ -1587,7 +1587,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
+             9/4
+ 
+             sage: P.monomial_quotient(x,y) # Note the wrong result
+-            x*y^65535*z^65535
++            x*y^65535*z^65535      # 32-bit
++            x*y^1048575*z^1048575  # 64-bit
+ 
+             sage: P.monomial_quotient(x,P(1))
+             x
+@@ -2247,10 +2248,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             9/4*x^2 - 1/4*y^2 - y - 1
+ 
+             sage: P.<x,y> = PolynomialRing(QQ,order='lex')
+-            sage: (x^2^15) * x^2^15
++            sage: (x^2^32) * x^2^32
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (...)
++            OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++            OverflowError: exponent overflow (...)  # 64-bit
+         """
+         # all currently implemented rings are commutative
+         cdef poly *_p
+@@ -2371,10 +2373,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             ValueError: not a 2nd power
+ 
+             sage: P.<x,y> = PolynomialRing(QQ,order='lex')
+-            sage: (x+y^2^15)^10
++            sage: (x+y^2^32)^10
+             Traceback (most recent call last):
+             ....
+-            OverflowError: exponent overflow (...)
++            OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++            OverflowError: exponent overflow (...)  # 64-bit
+ 
+         Test fractional powers (:trac:`22329`)::
+ 
+@@ -3461,7 +3464,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             x^10000
+             no overflow
+ 
+-            sage: n = 1000
++            sage: n = 100000
+             sage: try:
+             ....:     f = x^n
+             ....:     f.subs(x = x^n)
+@@ -4567,7 +4570,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         l = []
+         for i from 0 <= i < IDELEMS(res):
+             for j from 1 <= j <= IDELEMS(_I):
+-                l.append( new_MP(parent, pTakeOutComp1(&res.m[i], j)) )
++                l.append( new_MP(parent, pTakeOutComp(&res.m[i], 1)) )
+ 
+         id_Delete(&fI, r)
+         id_Delete(&_I, r)
+@@ -4635,7 +4638,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+ 
+             sage: f = 3*x
+             sage: f.reduce([2*x,y])
+-            3*x
++            x
+ 
+         The reduction is not canonical when ``I`` is not a Groebner
+         basis::
+diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx
+index 1c9f35e56ba..587511c3888 100644
+--- a/src/sage/rings/polynomial/plural.pyx
++++ b/src/sage/rings/polynomial/plural.pyx
+@@ -1619,10 +1619,10 @@ cdef class NCPolynomial_plural(RingElement):
+             sage: P = A.g_algebra(relations={y*x:-x*y + z},  order='lex')
+             sage: P.inject_variables()
+             Defining x, z, y
+-            sage: (x^2^15) * x^2^15
++            sage: (x^2^31) * x^2^31
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (65536)
++            OverflowError: exponent overflow (2147483648)
+         """
+         # all currently implemented rings are commutative
+         cdef poly *_p
+@@ -1689,10 +1689,10 @@ cdef class NCPolynomial_plural(RingElement):
+             sage: P = A.g_algebra(relations={y*x:-x*y + z},  order='lex')
+             sage: P.inject_variables()
+             Defining x, z, y
+-            sage: (x+y^2^15)^10
++            sage: (x+y^2^31)^10
+             Traceback (most recent call last):
+             ....
+-            OverflowError: exponent overflow (327680)
++            OverflowError: exponent overflow (2147483648)
+         """
+         if type(exp) is not Integer:
+             try:
+diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx
+index b5d83ef71b6..5c45b3fb528 100644
+--- a/src/sage/structure/element.pyx
++++ b/src/sage/structure/element.pyx
+@@ -2705,10 +2705,10 @@ cdef class RingElement(ModuleElement):
+         with Singular 4::
+ 
+             sage: K.<x,y> = ZZ[]
+-            sage: (x^12345)^54321
++            sage: (x^123456)^654321
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (670592745)
++            OverflowError: exponent overflow (...)
+         """
+         return arith_generic_power(self, n)
+ 
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..75695f0e5f87 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.7
-revision=4
+version=9.8
+revision=1
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -14,7 +14,7 @@ makedepends="arb-devel boost-devel brial-devel cliquer-devel ecl eclib-devel
  libpng-devel linbox-devel m4ri-devel m4rie-devel mpfi-devel
  mpfr-devel ntl-devel openblas-devel pari-devel planarity-devel python3-cypari2
  python3-cysignals python3-devel python3-gmpy2 python3-memory_allocator
- python3-numpy rankwidth-devel singular symmetrica-devel zn_poly"
+ python3-numpy rankwidth-devel singular symmetrica-devel"
 depends="FlintQS eclib-devel fflas-ffpack flintlib-devel gcc-fortran gd-devel
  gfan giac gsl-devel gzip libpng-devel linbox-devel m4ri-devel maxima-ecl
  mpfr-devel nauty ntl-devel palp pari-devel pari-elldata-small pari-galdata
@@ -32,7 +32,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+checksum=2aff28bd1d18c2d526581f5298acb8336f5b92db5675a7403dec8eaf9a86bc4c
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: rebuild for dep updates and fixes
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (23 preceding siblings ...)
  2023-02-14  0:11 ` tornaria
@ 2023-02-14  0:17 ` tornaria
  2023-02-14 13:03 ` [PR PATCH] [Updated] sagemath: update to 9.8 tornaria
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-14  0:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1428902911

Comment:
We had a few failures because I patched sagemath to support singular 4.3.1p3,  but I didn't upgrade singular (see #42235).

Just to make it easy, I include #42235 here.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Updated] sagemath: update to 9.8
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (24 preceding siblings ...)
  2023-02-14  0:17 ` tornaria
@ 2023-02-14 13:03 ` tornaria
  2023-02-14 13:05 ` tornaria
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-14 13:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]

There is an updated pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sagemath
https://github.com/void-linux/void-packages/pull/42048

sagemath: update to 9.8
<!-- Uncomment relevant sections and delete options which are not applicable -->

This PR includes
 - update brial to 1.2.12   (it has to be built in sync because of boost)
 - update singular to 4.3.1.p3   (it has to be built in sync because an output difference)

Changes in sagemath package:
 - fix edge case of python 3.11 integer conversion on 32 bit
 - support tachyon 0.99.5
 - support singular 4.3.1p3
 - fix tests for giac 1.9.0.35
 -  fix tests for numpy 1.24
 - skip unstable tests in klyachko.py
 - remove zn_poly dependency


#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/42048.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sagemath-42048.patch --]
[-- Type: text/x-diff, Size: 317388 bytes --]

From 8cf5dcfc81420a780587ad33844d34d7ebce3fee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 23:11:04 -0300
Subject: [PATCH 1/3] singular: update to 4.3.1p3.

---
 srcpkgs/singular/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/singular/template b/srcpkgs/singular/template
index 2dc38af826be..c73a020dcf15 100644
--- a/srcpkgs/singular/template
+++ b/srcpkgs/singular/template
@@ -1,6 +1,6 @@
 # Template file for 'singular'
 pkgname=singular
-version=4.3.1p2
+version=4.3.1p3
 revision=1
 _majver=${version%p*}
 build_style=gnu-configure
@@ -20,7 +20,7 @@ maintainer="dkwo <npiazza@disroot.org>"
 license="GPL-2.0-or-later"
 homepage="https://www.singular.uni-kl.de"
 distfiles="https://www.singular.uni-kl.de/ftp/pub/Math/Singular/SOURCES/${_majver//./-}/singular-${version}.tar.gz"
-checksum=95814bba0f0bd0290cd9799ec1d2ecc6f4c8a4e6429d9a02eb7f9c4e5649682a
+checksum=66cfaeee7ab909272fd81050a09cae3ec115652a01adde014a5128a54b97397a
 
 if [ -z "$CROSS_BUILD" ]; then
 	makedepends+=" ntl-devel"

From 5e3d045d5314fca1ed95ffb215f4417634da9089 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Mon, 30 Jan 2023 11:04:46 -0300
Subject: [PATCH 2/3] brial: update to 1.2.12.

---
 srcpkgs/brial/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/brial/template b/srcpkgs/brial/template
index 8f988c1296c6..2f8e195a8804 100644
--- a/srcpkgs/brial/template
+++ b/srcpkgs/brial/template
@@ -1,6 +1,6 @@
 # Template file for 'brial'
 pkgname=brial
-version=1.2.11
+version=1.2.12
 revision=1
 build_style=gnu-configure
 hostmakedepends="pkg-config"
@@ -9,8 +9,9 @@ short_desc="BRiAl (Boolean Ring Algebra) is the successor to PolyBoRi"
 maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="https://github.com/BRiAl/BRiAl"
+changelog="https://github.com/BRiAl/BRiAl/releases"
 distfiles="https://github.com/BRiAl/BRiAl/releases/download/$version/brial-$version.tar.bz2"
-checksum=6c0f622009dcd9928295d748226baa9cdc1a87c32552e13772fddf95bbb6f02c
+checksum=ca009e3722dd3f0a60d15501caed1413146c80abced57423e32ae0116f407494
 
 if [ -n "$CROSS_BUILD" ]; then
 	configure_args+=" --with-boost-unit-test-framework=no"

From e463970074bef7ae7811b7b95fb5d0fee7076e6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Thu, 2 Feb 2023 19:03:34 -0300
Subject: [PATCH 3/3] sagemath: update to 9.8.

Also:
 - fix edge case of python 3.11 integer conversion on 32 bit
 - support tachyon 0.99.5
 - support singular 4.3.1p3
 - fix tests for giac 1.9.0.35
 - fix tests for numpy 1.24
 - skip unstable tests in klyachko.py
 - remove zn_poly dependency
 - fix very slow test in stream.py
---
 srcpkgs/sagemath/files/sage_conf.py           |    3 +-
 .../patches/09-doctest_numerical_fix.patch    |   14 -
 .../34980-avoid_factoring_in_is_prime.patch   |   47 +
 .../patches/34994-fix_tests_numpy_1.24.patch  |   58 +
 .../34995-support_tachyon_0.99.2.patch        |   57 +
 ...34997-fix_edge_case_of_integer_check.patch |   36 +
 .../35058-skip_unstable_tests_klyachko.patch  |   22 +
 .../35068-fix_tests_giac_1.9.0.35.patch       |   62 +
 .../patches/35094-support_gap_4.12.patch      | 1303 ++++++++++++
 .../35127-fix_very_slow_test_stream.py.patch  |   15 +
 srcpkgs/sagemath/patches/get_patches          |   41 +
 ...cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch |   53 -
 ...fc4ec8b8687bccd22d2e3161c86cf5553e06.patch |  427 ----
 ...rac-33842-01-python_3.11-de38bac21e2.patch |   66 -
 ...-python_3.11-argspec-fix-9eb08f3afde.patch |  168 --
 ...3-python3.11-final_fixes-7b6fa565f42.patch | 1279 ------------
 .../trac-33842-04-python3.11_fix_32_bit.patch |  212 --
 ...d4e56243c609f44afc1f21c112b026f9e1fe.patch |   42 -
 ...93d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch |  526 -----
 ...1318f032caf8dc1c0de9489346d894409091.patch |   19 -
 .../trac-34537-sagemath-pari-2.15.patch       | 1750 -----------------
 .../trac-34537-sagemath-pari-2.15b.patch      |   29 -
 ...e0de0dca1cff0355326dd42bd8c7e5749568.patch |   72 -
 ...-support_singular_4.3.1.p3-5e5737a0c.patch |  205 ++
 srcpkgs/sagemath/template                     |    8 +-
 srcpkgs/sagemath/update                       |    2 +
 26 files changed, 1854 insertions(+), 4662 deletions(-)
 delete mode 100644 srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
 create mode 100644 srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
 create mode 100644 srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
 create mode 100644 srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
 create mode 100644 srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
 create mode 100644 srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
 create mode 100644 srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
 create mode 100644 srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
 create mode 100644 srcpkgs/sagemath/patches/35127-fix_very_slow_test_stream.py.patch
 create mode 100755 srcpkgs/sagemath/patches/get_patches
 delete mode 100644 srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
 delete mode 100644 srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
 create mode 100644 srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
 create mode 100644 srcpkgs/sagemath/update

diff --git a/srcpkgs/sagemath/files/sage_conf.py b/srcpkgs/sagemath/files/sage_conf.py
index 85ec37dfb50e..00de40f1ee4f 100644
--- a/srcpkgs/sagemath/files/sage_conf.py
+++ b/srcpkgs/sagemath/files/sage_conf.py
@@ -1,3 +1,4 @@
 # configuration for sage on void linux
 SAGE_SHARE = "/usr/share/sagemath"
-GAP_ROOT_DIR = "/usr/share/gap"
+GAP_SHARE_DIR = "/usr/share/gap"
+GAP_LIB_DIR = "/usr/lib/gap"
diff --git a/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch b/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
deleted file mode 100644
index 8780c8a97efa..000000000000
--- a/srcpkgs/sagemath/patches/09-doctest_numerical_fix.patch
+++ /dev/null
@@ -1,14 +0,0 @@
- - This fixes a doctest failure due to a small numerical issue when running
-   maxima-sbcl on 32 bit
-
---- a/src/sage/interfaces/maxima_abstract.py
-+++ b/src/sage/interfaces/maxima_abstract.py
-@@ -1525,7 +1525,7 @@ class MaximaAbstractElement(ExtraTabCompletion, InterfaceElement):
-         EXAMPLES::
- 
-             sage: maxima('exp(-sqrt(x))').nintegral('x',0,1)
--            (0.5284822353142306, 4.1633141378838...e-11, 231, 0)
-+            (0.5284822353142306, 4.163...e-11, 231, 0)
- 
-         Note that GP also does numerical integration, and can do so to very
-         high precision very quickly::
diff --git a/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch b/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
new file mode 100644
index 000000000000..ca61a2ada4eb
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34980-avoid_factoring_in_is_prime.patch
@@ -0,0 +1,47 @@
+diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
+index d5f7157217f..1a9d11aec68 100644
+--- a/src/sage/rings/number_field/number_field_ideal.py
++++ b/src/sage/rings/number_field/number_field_ideal.py
+@@ -996,16 +996,36 @@ def is_prime(self):
+             False
+             sage: K.ideal(17).is_prime()  # ramified
+             False
++
++        TESTS:
++
++        Check that we do not factor the norm of the ideal, this used
++        to take half an hour, see :trac:`33360`::
++
++            sage: K.<a,b,c> = NumberField([x^2-2,x^2-3,x^2-5])
++            sage: t = (((-2611940*c + 1925290/7653)*b - 1537130/7653*c
++            ....:       + 10130950)*a + (1343014/7653*c - 8349770)*b
++            ....:       + 6477058*c - 2801449990/4002519)
++            sage: t.is_prime()
++            False
+         """
+         try:
+             return self._pari_prime is not None
+         except AttributeError:
+-            F = self.factor()  # factorization with caching
+-            if len(F) != 1 or F[0][1] != 1:
+-                self._pari_prime = None
+-            else:
+-                self._pari_prime = F[0][0]._pari_prime
+-            return self._pari_prime is not None
++            pass
++
++        K = self.number_field().pari_nf()
++        I = self.pari_hnf()
++
++        self._pari_prime = K.idealismaximal(I) or None
++
++        # PARI uses probabilistic primality testing inside idealismaximal().
++        if self._pari_prime \
++                and get_flag(None, 'arithmetic') \
++                and not self._pari_prime[0].isprime():
++            self._pari_prime = None
++
++        return self._pari_prime is not None
+ 
+     def pari_prime(self):
+         r"""
diff --git a/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch b/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
new file mode 100644
index 000000000000..91f06fd4d173
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34994-fix_tests_numpy_1.24.patch
@@ -0,0 +1,58 @@
+diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
+index 3ac5f1cc2b0..cb1f327c199 100644
+--- a/src/sage/misc/persist.pyx
++++ b/src/sage/misc/persist.pyx
+@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
+         ....:     _ = f.write(code)
+         sage: load(t)
+         sage: hello
+-        <fortran object>
++        <fortran ...>
+     """
+     import sage.repl.load
+     if len(filename) != 1:
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 6f0aeab87ae..b77c69b2f77 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
+             rgb[i, j, 2] = b
+ 
+     sig_off()
++    nan_indices = np.isnan(rgb).any(-1)     # Mask for undefined points
++    rgb[nan_indices] = 1                    # Make nan_indices white
+     return rgb
+ 
+ 
+diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
+index 3bc2b76b58e..388c2d1391d 100644
+--- a/src/sage/plot/histogram.py
++++ b/src/sage/plot/histogram.py
+@@ -87,13 +87,8 @@ def get_minmax_data(self):
+ 
+         TESTS::
+ 
+-            sage: h = histogram([10,3,5], normed=True)[0]
+-            doctest:warning...:
+-            DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
+-            See https://trac.sagemath.org/25260 for details.
++            sage: h = histogram([10,3,5], density=True)[0]
+             sage: h.get_minmax_data()
+-            doctest:warning ...
+-            ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
+             {'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
+         """
+         import numpy
+diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
+index 798671aab42..cad6a47ca8b 100644
+--- a/src/sage/repl/ipython_extension.py
++++ b/src/sage/repl/ipython_extension.py
+@@ -405,7 +405,7 @@ def fortran(self, line, cell):
+             ....: C END FILE FIB1.F
+             ....: ''')
+             sage: fib
+-            <fortran object>
++            <fortran ...>
+             sage: from numpy import array
+             sage: a = array(range(10), dtype=float)
+             sage: fib(a, 10)
diff --git a/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch b/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
new file mode 100644
index 000000000000..2769e87f6a4b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34995-support_tachyon_0.99.2.patch
@@ -0,0 +1,57 @@
+diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
+index 23671e50892..ce1d50f71bc 100644
+--- a/src/sage/interfaces/tachyon.py
++++ b/src/sage/interfaces/tachyon.py
+@@ -683,12 +683,14 @@
+ #*****************************************************************************
+ 
+ import os
++import re
+ 
+ from sage.cpython.string import bytes_to_str
+ from sage.misc.pager import pager
+ from sage.misc.superseded import deprecation
+ from sage.misc.temporary_file import tmp_filename
+ from sage.structure.sage_object import SageObject
++from sage.misc.cachefunc import cached_method
+ 
+ 
+ class TachyonRT(SageObject):
+@@ -799,6 +801,11 @@ def __call__(self, model, outfile='sage.png', verbose=1, extra_opts=''):
+             Parser failed due to an input file syntax error.
+             Aborting render.
+         """
++        if self.version() >= '0.99.2':
++            # this keyword was changed in 0.99.2
++            model = model.replace(
++                    "              focallength ",
++                    "              focaldist ")
+         modelfile = tmp_filename(ext='.dat')
+         with open(modelfile, 'w') as file:
+             file.write(model)
+@@ -851,6 +858,25 @@ def usage(self, use_pager=True):
+         else:
+             print(r)
+ 
++    @cached_method
++    def version(self):
++        """
++        Returns the version of the Tachyon raytracer being used.
++
++        TESTS::
++
++            sage: tachyon_rt.version()  # random
++            0.98.9
++            sage: tachyon_rt.version() >= '0.98.9'
++            True
++        """
++        with os.popen('tachyon') as f:
++            r = f.readline()
++        res = re.search(r"Version ([\d.]*)", r)
++        # debian patches tachyon so it won't report the version
++        # we hardcode '0.99' since that's indeed the version they ship
++        return res[1] if res else '0.99'
++
+     def help(self, use_pager=True):
+         """
+         Deprecated: type 'sage.interfaces.tachyon?' for help
diff --git a/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch b/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
new file mode 100644
index 000000000000..11eb20d4f735
--- /dev/null
+++ b/srcpkgs/sagemath/patches/34997-fix_edge_case_of_integer_check.patch
@@ -0,0 +1,36 @@
+diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
+index 1c9a53387a0..d96b98f247c 100644
+--- a/src/sage/arith/long.pxd
++++ b/src/sage/arith/long.pxd
+@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+         sage: L += [-x for x in L] + [0, long_min()]
+         sage: for v in L:
+         ....:     assert check_long_py(int(v)) == v
++        sage: check_long_py(int(2^60))
++        1152921504606846976                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^61))
++        2305843009213693952                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^62))
++        4611686018427387904                 # 64-bit
++        'Overflow (...)'                    # 32-bit
++        sage: check_long_py(int(2^63))
++        'Overflow (...)'
+         sage: check_long_py(int(2^100))
+         'Overflow (...)'
+         sage: check_long_py(int(long_max() + 1))
+@@ -309,7 +320,12 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
+ 
+     cdef long lead
+     cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
+-    cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
++    cdef long lead_3_overflow
++    if BITS_IN_LONG < 2 * PyLong_SHIFT:
++        # in this case 3 digit is always overflow
++        lead_3_overflow = 0
++    else:
++        lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
+     if size == 0:
+         value[0] = 0
+         err[0] = 0
diff --git a/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch b/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
new file mode 100644
index 000000000000..c4d7d5c779d1
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35058-skip_unstable_tests_klyachko.patch
@@ -0,0 +1,22 @@
+diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py
+index b1304a16913..77fae4b7545 100644
+--- a/src/sage/schemes/toric/sheaf/klyachko.py
++++ b/src/sage/schemes/toric/sheaf/klyachko.py
+@@ -26,7 +26,7 @@
+     (0, 0, 18, 16, 1)
+     sage: Gtilde = G_sum.random_deformation()
+     sage: V = Gtilde.wedge(2) * K                     # long time
+-    sage: V.cohomology(dim=True, weight=(0,0,0,0))    # long time
++    sage: V.cohomology(dim=True, weight=(0,0,0,0))    # long time  # random failure (see #32773)
+     (0, 0, 3, 0, 0)
+ 
+ REFERENCES:
+@@ -948,7 +948,7 @@ def random_deformation(self, epsilon=None):
+            sage: V.cohomology(dim=True, weight=(0,))
+            (1, 0)
+            sage: Vtilde = V.random_deformation()
+-           sage: Vtilde.cohomology(dim=True, weight=(0,))
++           sage: Vtilde.cohomology(dim=True, weight=(0,))  # random failure (see #32773)
+            (1, 0)
+         """
+         filt = self._filt.random_deformation(epsilon)
diff --git a/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch b/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
new file mode 100644
index 000000000000..d9a9835c696b
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35068-fix_tests_giac_1.9.0.35.patch
@@ -0,0 +1,62 @@
+From 9ac7840134054155545e24fa3e66402d42b91c0f Mon Sep 17 00:00:00 2001
+From: Antonio Rojas <arojas@archlinux.org>
+Date: Fri, 20 Jan 2023 21:36:27 +0100
+Subject: [PATCH] Fix tests with giac 1.9.0.35
+
+---
+ src/sage/libs/giac/giac.pyx   |  3 +--
+ src/sage/symbolic/relation.py | 15 +++++----------
+ 2 files changed, 6 insertions(+), 12 deletions(-)
+
+diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
+index 4e451dba5e7..ccad5169836 100644
+--- a/src/sage/libs/giac/giac.pyx
++++ b/src/sage/libs/giac/giac.pyx
+@@ -374,8 +374,7 @@ def _giac(s):
+ 
+         sage: x = libgiac('x')
+         sage: (1+2*sin(3*x)).solve(x).simplify()
+-        Warning, argument is not an equation, solving 1+2*sin(3*x)=0
+-        list[-pi/18,7*pi/18]
++        ...list[-pi/18,7*pi/18]
+ 
+         sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
+         Traceback (most recent call last):
+diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
+index e9dbc0fea30..b8896a94be9 100644
+--- a/src/sage/symbolic/relation.py
++++ b/src/sage/symbolic/relation.py
+@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
+@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
+     EXAMPLES::
+ 
+         sage: solve([(2/3)^x-2], [x], algorithm='giac')
+-        ...
+-        [[-log(2)/(log(3) - log(2))]]
++        ...[[-log(2)/(log(3) - log(2))]]
+         sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -log(2)/(log(3) - log(2))}]
++        ...[{x: -log(2)/(log(3) - log(2))}]
+ 
+         sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
+         sage: solve(f, x, algorithm='giac')
+-        ...
+-        [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
++        ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
+         sage: solve(f, x, algorithm='giac', solution_dict=True)
+-        ...
+-        [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
++        ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
+ 
+         sage: x, y = SR.var('x,y')
+         sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
diff --git a/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch b/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
new file mode 100644
index 000000000000..499e0c71e256
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35094-support_gap_4.12.patch
@@ -0,0 +1,1303 @@
+diff --git a/build/pkgs/gap/checksums.ini b/build/pkgs/gap/checksums.ini
+index 066e943308a..b0ea8ba8818 100644
+--- a/build/pkgs/gap/checksums.ini
++++ b/build/pkgs/gap/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=gap-VERSION.tar.gz
+-sha1=4ecdd281b8f430282fb9b12690b06e0a26abde10
+-md5=85dc9e459d5b6c66fcad9f468afd3e3e
+-cksum=1351843158
++sha1=a6e36f3f874a2c46f51561402634497eab705cca
++md5=c5cd9f272f2703d7a3649ad7193b2d90
++cksum=2760477284
+ upstream_url=https://github.com/gap-system/gap/releases/download/vVERSION/gap-VERSION.tar.gz
+diff --git a/build/pkgs/gap/package-version.txt b/build/pkgs/gap/package-version.txt
+index d782fca8f64..f1cd7de1de5 100644
+--- a/build/pkgs/gap/package-version.txt
++++ b/build/pkgs/gap/package-version.txt
+@@ -1 +1 @@
+-4.11.1
++4.12.2
+diff --git a/build/pkgs/gap/spkg-check.in b/build/pkgs/gap/spkg-check.in
+index d9791d33293..d2fccda6e04 100644
+--- a/build/pkgs/gap/spkg-check.in
++++ b/build/pkgs/gap/spkg-check.in
+@@ -3,6 +3,13 @@ cd src
+ # #28728: Fix test failure in tst/testinstall/strings.tst
+ export LC_CTYPE=en_US.UTF-8
+ 
++# #34391: in GAP 4.12 some packages need GAP package io
++#         to let tests run, otherwise this hangs. Thus we install io here.
++cd pkg/io
++./configure --with-gaproot=../..
++make
++cd ../..
++
+ make testinstall
+ if [[ $? -ne 0 ]]; then
+     exit 1
+diff --git a/build/pkgs/gap/spkg-install.in b/build/pkgs/gap/spkg-install.in
+index 2ceadf99db4..e2c8b4dca54 100644
+--- a/build/pkgs/gap/spkg-install.in
++++ b/build/pkgs/gap/spkg-install.in
+@@ -8,8 +8,7 @@ export CFLAGS=$CFLAGS_NON_NATIVE
+ export CXXFLAGS=$CXXFLAGS_NON_NATIVE
+ 
+ GAP_BUILD_ROOT="$(pwd)"
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
+-DESTDIR_GAP_ROOT="$SAGE_DESTDIR$GAP_ROOT"
++GAP_ROOT="$SAGE_LOCAL/lib/gap"
+ 
+ # Enable debug info if requested.
+ # Note that -g3 allows you to use preprocessor macros in gdb which are widely used
+@@ -17,37 +16,17 @@ if [ "$SAGE_DEBUG" = yes ] ; then
+     export CFLAGS="-O0 -g3 -DDEBUG_MASTERPOINTERS -DDEBUG_GLOBAL_BAGS -DDEBUG_FUNCTIONS_BAGS $CFLAGS"
+ fi
+ 
+-sdh_configure $SAGE_CONFIGURE_GMP
+-sdh_make -j1
++# LDFLAGS hack below needed by Semigroups package
++sdh_configure $SAGE_CONFIGURE_GMP LDFLAGS="-pthread" --prefix=$SAGE_LOCAL
++sdh_make
+ 
+-# GAP's "make install" is work in progress; we use bits and pieces of it
+-# but we install many things manually.
+-sdh_make install-headers install-libgap
+-
+-# Install config.h, which is not currently handled by `make install-headers`
+-sdh_install gen/config.h "$SAGE_LOCAL/include/gap"
+-
+-# Now install the gap executable as "gap-bin"; it will be called normally
+-# through our wrapper script that sets the appropriate GAP_ROOT
+-SAGE_BIN="$SAGE_LOCAL/bin"
+-mkdir -p "$SAGE_DESTDIR$SAGE_BIN" || sdh_die "Failed to create the directory $SAGE_BIN"
+-
+-./libtool --mode=install install gap "$SAGE_DESTDIR$SAGE_BIN/gap-bin" || \
+-    sdh_die "Failed to install gap-bin to $SAGE_BIN"
+-
+-./libtool --mode=install install gac "$SAGE_DESTDIR$SAGE_BIN/gac" || \
+-    sdh_die "Failed to install gac to $SAGE_BIN"
+-
+-# Now copy additional files GAP needs to run (and a few optional bits) into
+-# GAP_ROOT; we don't need everything from the source tree
+-sdh_install bin doc gen grp lib src tst sysinfo.gap "$GAP_ROOT"
+-
+-# GAP's copy of libtool is also used by the toolchain for build GAP packages
+-# (i.e. by gac)
+-sdh_install libtool "$GAP_ROOT"
++sdh_make_install
++# sdh_make install-headers install-libgap
++# The 'packagemanager' package expects this https://github.com/gap-packages/PackageManager/issues/105
++mkdir -p "$SAGE_LOCAL/lib/gap/bin"
+ 
+ # Install only the minimal packages GAP needs to run
+-sdh_install pkg/GAPDoc-* pkg/primgrp-* pkg/SmallGrp-* pkg/transgrp "$GAP_ROOT"/pkg
++sdh_install pkg/gapdoc pkg/primgrp pkg/smallgrp pkg/transgrp "$GAP_ROOT"/pkg
+ 
+ # Install additional packages that are not strictly required, but that are
+ # typically "expected" to be loaded: These are the default packages that are
+@@ -58,50 +37,25 @@ sdh_install pkg/GAPDoc-* pkg/primgrp-* pkg/SmallGrp-* pkg/transgrp "$GAP_ROOT"/p
+ # Also include atlasrep which is a dependency of tomlib
+ sdh_install \
+     pkg/atlasrep \
+-    pkg/autpgrp-* \
+-    pkg/alnuth-* \
+-    pkg/crisp-* \
+-    pkg/ctbllib-* \
+-    pkg/FactInt-* \
++    pkg/autodoc \
++    pkg/autpgrp \
++    pkg/alnuth \
++    pkg/crisp \
++    pkg/ctbllib \
++    pkg/factint \
+     pkg/fga \
+-    pkg/irredsol-* \
+-    pkg/laguna-* \
+-    pkg/PackageManager-* \
+-    pkg/polenta-* \
+-    pkg/polycyclic-* \
+-    pkg/resclasses-* \
+-    pkg/sophus-* \
+-    pkg/tomlib-* \
++    pkg/irredsol \
++    pkg/laguna \
++    pkg/packagemanager \
++    pkg/polenta \
++    pkg/polycyclic \
++    pkg/radiroot \
++    pkg/resclasses \
++    pkg/sophus \
++    pkg/tomlib \
++    pkg/utils \
+     "$GAP_ROOT"/pkg
+ 
+-# Install the GAP startup script; ensure it is executable
+-sdh_install -T ../gap "$SAGE_BIN/gap"
+-chmod +x "$SAGE_DESTDIR$SAGE_BIN/gap"
+-
+-# Create symlinks under $GAP_ROOT for these executables, as they are expected
+-# (especially when building kernel packages) to exist
+-ln -sf "../../bin/gap-bin" "$DESTDIR_GAP_ROOT/gap"
+-ln -sf "../../bin/gac" "$DESTDIR_GAP_ROOT/gac"
+-
+-# Fix the $GAP_ROOT/bin/<arch>/src symlink to be relative (otherwise it links
+-# to the actual path of the sources GAP was compiled from)
+-for srclink in "$DESTDIR_GAP_ROOT"/bin/*/src; do
+-    rm -f "$srclink"
+-    ln -s "../../src" "$srclink"
+-done
+-
+-# Additional fixups for some files after they have been copied into their
+-# destination directory.  gac and sysinfo.gap are generated files that contain
+-# in them hard-coded references to the GAP build directory, which will soon
+-# be going away.  This breaks the build toolchain for some compiled GAP
+-# packages.  We need to replace these paths with the final GAP_ROOT path.  The
+-# below will work so long as neither of these paths contain '|', and if they do
+-# then god help you.  https://trac.sagemath.org/ticket/27218
+-sed -i -e "s|$GAP_BUILD_ROOT|$GAP_ROOT|g" \
+-    "$SAGE_DESTDIR$SAGE_BIN/gac" "$DESTDIR_GAP_ROOT/sysinfo.gap" \
+-    "$DESTDIR_GAP_ROOT/bin/gap.sh" "$DESTDIR_GAP_ROOT/doc/make_doc" || \
+-    sdh_die "Failed to fix up hard-coded paths in GAP build tools."
+-
+ # TODO: This seems unnecessary--we are already installing all of doc/ to
+ # GAP_ROOT, which is necessary for some functionality in GAP to work.  Do
+ # we need this?  Maybe doc/gap could just be a symlink to gap/doc??
+diff --git a/build/pkgs/gap/spkg-legacy-uninstall b/build/pkgs/gap/spkg-legacy-uninstall
+index d17eb939eb7..a8e5c59e1fb 100755
+--- a/build/pkgs/gap/spkg-legacy-uninstall
++++ b/build/pkgs/gap/spkg-legacy-uninstall
+@@ -4,6 +4,8 @@ rm -rf "$SAGE_LOCAL/gap/gap-4."*
+ rm -rf "$SAGE_SHARE/gap"
+ rm -f "$SAGE_LOCAL/gap/latest"
+ rm -f "$SAGE_LOCAL/bin/gap"
++rm -f "$SAGE_LOCAL/bin/gac"
+ 
+-# Remove old libgap headers
++# Remove old libgap headers and library
+ rm -rf "$SAGE_LOCAL/include/gap"
++rm -rf "$SAGE_LOCAL/lib/gap"
+diff --git a/build/pkgs/gap/spkg-prerm.in b/build/pkgs/gap/spkg-prerm.in
+deleted file mode 100644
+index 661d92621fa..00000000000
+--- a/build/pkgs/gap/spkg-prerm.in
++++ /dev/null
+@@ -1,6 +0,0 @@
+-# These generated files are placed in directory provided by the SPKG, so
+-# delete the generated files first so that their parent directories can be
+-# removed during installation
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
+-rm -f "$GAP_ROOT/pkg/atlasrep/datagens/"*.*
+-rm -f "$GAP_ROOT/pkg/atlasrep/dataword/"*.*
+diff --git a/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch b/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch
+deleted file mode 100644
+index e45fe7d9c6f..00000000000
+--- a/build/pkgs/gap_packages/patches/cohomolo-gcc10.patch
++++ /dev/null
+@@ -1,150 +0,0 @@
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c b/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-index 3bbdc45..7df699f 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/crp1.c
+-@@ -8,9 +8,8 @@ extern short sp[],**mat[],*psp[],**imcos[],**cpco[],lorb[],
+- short *cst,**cpst,***cdpst,**svptr,*cp,*rel;
+- short *spst,**pspst,**pptr,**cpptr,npt,nb,nph,nph2,npg,npg2,
+-       rno,orno,coh_index,*invg;
+--FILE  *ip,*op;
+- 
+--void seeknln (void) { while (getc(ip)!='\n'); }
+-+void seeknln (FILE *ip) { while (getc(ip)!='\n'); }
+- 
+- /* This program differs from most other permutation programs in that perms are
+-    all stored in the single array sp. Schreier vectors are stored in the short
+-@@ -23,13 +22,14 @@ void seeknln (void) { while (getc(ip)!='\n'); }
+- int 
+- crprog1 (void)
+- { short *pc,*qc,ex,neg; int x;
+-+  FILE  *ip,*op;
+-   short i,j,k,l,m,n,cl,rl,*p,ocl,im,pt,pt1,pn,ipt;
+-   if ((ip=fopen(inf2,"r"))== 0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf2); return(-1);}
+-   fscanf(ip,"%hd%hd%hd%hd",&npt,&nph,&nb,&k);
+-   if (nb>=mb) {fprintf(stderr,"nb too big. Increase MB.\n"); return(-1);}
+-   if (k<=2) {fprintf(stderr,"inf2 has illegal format.\n"); return(-1); }
+--  seeknln(); seeknln();
+-+  seeknln(ip); seeknln(ip);
+-   for (i=1;i<=nb;i++) fscanf(ip,"%hd",lorb+i);
+-   pptr=psp-1; pspst=psp+nph; svptr=cpsp-1;  cpst=cpsp+nb;
+-   invg=sp; nph2=2*nph; spst=sp+nph2;
+-@@ -37,7 +37,7 @@ crprog1 (void)
+-   { pptr[i]=spst+(i-1)*npt-1; p=pptr[i];
+-     for (j=1;j<=npt;j++) {fscanf(ip,"%hd",&k); p[k]=j; }
+-     invg[2*i-2]=2*i-1; invg[2*i-1]=2*i-2;
+--    seeknln();
+-+    seeknln(ip);
+-   }
+-   spst+=(npt*nph);
+-   for (i=1;i<=nb;i++)
+-@@ -75,7 +75,7 @@ crprog1 (void)
+-   strcpy(inf1,inf0); strcat(inf1,".rel");
+-   if ((ip=fopen(inf1,"r"))==0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf1); return(-1);}
+--  fscanf(ip,"%hd%hd",&k,&rno); seeknln();
+-+  fscanf(ip,"%hd%hd",&k,&rno); seeknln(ip);
+-   op=fopen(outft,"w");
+- /* Now we have read everything in, and the computation can start */
+-   orno=0;
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-index a7396b2..658496f 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nq+chfns.c
+-@@ -20,8 +20,6 @@ short  mexp=MEXP,mcl=MCL,no,rel[RSP],wt[MEXP],exp,*rpf,*rpb,
+- extern short  prime,dim,*spv,**spm,mspace[],*vec[],**mat[],cp[],pinv[],opmats,
+-         mm,mv;
+- extern int msp;
+--FILE *ip,*op;
+--
+- 
+- int 
+- calcmats (void)
+-@@ -59,7 +57,7 @@ calcmats (void)
+-   }
+-   for (i=1;i<=exp;i++) trans(mat[i+exp],mat[i]);
+-   if (opmats)
+--  { op=fopen(outf,"w");
+-+  { FILE *op=fopen(outf,"w");
+-     fprintf(op,"%4d%4d%4d\n",prime,dim,exp);
+-     for (i=1;i<=exp;i++) printmat(mat[i]); 
+-     fclose(op);
+-@@ -71,6 +69,7 @@ int
+- rdmats (void)
+- /* reads matrices of generators of P */
+- { short i; int quot;
+-+  FILE *ip;
+-   ip=fopen(inf4,"r");
+-   if (ip==0)
+-   { fprintf(stderr,"Cannot open %s\n ",inf4); return(-1); }
+-@@ -90,12 +89,12 @@ rdmats (void)
+-   fclose(ip);
+-   return(0);
+- }
+--FILE *ip;
+- 
+- int 
+- ingp (int inp)
+- /* Read in output of respcrun -s */
+- { short i,j,k,l,m,*orpf,**pcp;
+-+  FILE *ip;
+-   ip=fopen(inf3,"r");
+-   if (ip==0) { fprintf(stderr,"Cannot open %s\n",inf3); return(-1); }
+-   fscanf(ip,"%hd%hd%hd%hd%hd%hd",&prime,&exp,&i,&no,&j,&m);
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-index 0896551..6841bc8 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmfns.c
+-@@ -9,7 +9,6 @@ extern short  intexp,mexp,mng,wksp,
+-        spugen[],*tlintg[];
+- extern int ptrsp,rsp;
+- short  fac;
+--FILE *ip,*op;
+- 
+- int 
+- ingp (void)
+-@@ -18,6 +17,7 @@ ingp (void)
+-    of nqrun, and tails are also read in.
+- */
+- { short i,j,k,l,m,x,y,no,*orpf,*orpb,**pcp;  char tails;
+-+  FILE *ip;
+-   if ((ip=fopen(inf1,"r"))==0)
+-   { fprintf(stderr,"Cannot open %s.\n",inf1); return(-1); }
+-   fscanf(ip,"%hd%hd%hd%hd%hd%hd",&prime,&exp,&nng,&no,&class,&m);
+-@@ -89,6 +89,7 @@ int
+- outgp (void)
+- /* The PCP is output, together with tails */
+- { short i,k,l,**pcp,*b,*e,*c;
+-+  FILE *op;
+-   op=fopen(outf,"w");
+-   fprintf(op,"%4d%4d%4d%4d%4d%4d\n",prime,exp,nng,exp,class,1);
+-   for (i=1;i<=exp;i++) fprintf(op,"%4d",wt[i]); fprintf(op,"\n");
+-@@ -379,7 +380,7 @@ restart:
+-     nng--; mnng--; enexpnt--;
+-     if (nng==0)
+-     { if (gap)
+--      { op=fopen(outfm,"w"); fprintf(op,"COHOMOLO.Multiplier:=[];\n");
+-+      { FILE *op=fopen(outfm,"w"); fprintf(op,"COHOMOLO.Multiplier:=[];\n");
+-         fclose(op);
+-         printf("All new generators eliminated. Multiplier is trivial.\n");
+-       }
+-diff --git a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-index 01cf914..0144883 100644
+---- a/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-+++ b/pkg/cohomolo-1.6.8/standalone/progs.d/nqmp.c
+-@@ -9,7 +9,6 @@ extern short  intexp,mng,mexp,wksp,
+-        spugen[],*intg[],*imintg[],*tlintg[];
+- extern int ptrsp,rsp;
+- short  *wf,*wc; char norm;
+--FILE *ip,*op;
+- 
+- /* The data structures for this program and for nqrun are similar.
+-    d1 and d2 contain definitions of generators. (Def. comes from commutator
+-@@ -35,6 +34,7 @@ nqmprog (void)
+- { short i,j,k,l,m,d,*gi,*gj,*ti,*tj,cl,def,*ps,*pf,**dp,*nrpb,*p,*orpf,*orpb,
+-         nb,np,k1,*rno,*covrel,**pgen,tdef,sgn;
+-   char nt;
+-+  FILE *ip,*op;
+-   if (ingp() == -1) {fprintf(stderr,"Input error.\n"); return(-1); }
+-   eexpnt=expnt+exp; enexpnt=nexpnt+nng;
+- 
+diff --git a/build/pkgs/gap_packages/patches/guava_leon_includes.patch b/build/pkgs/gap_packages/patches/guava_leon_includes.patch
+deleted file mode 100644
+index cdcd19cc3e8..00000000000
+--- a/build/pkgs/gap_packages/patches/guava_leon_includes.patch
++++ /dev/null
+@@ -1,13 +0,0 @@
+---- a/pkg/guava-3.15/src/leon/src/generate.c	Sat Feb 29 09:02:10 2020
+---- b/pkg/guava-3.15/src/leon/src/generate.c	Thu Sep 24 13:58:36 2020
+-***************
+-*** 115,120 ****
+---- 115,122 ----
+-  #include "groupio.h"
+-  #include "enum.h"
+-  #include "storage.h"
+-+ #include "chbase.h"
+-+ #include "inform.h"
+-  
+-  #ifdef ALT_TIME_HEADER
+-  #include "cputime.h"
+diff --git a/build/pkgs/gap_packages/spkg-install.in b/build/pkgs/gap_packages/spkg-install.in
+index 168e6b11532..6dff182a48f 100644
+--- a/build/pkgs/gap_packages/spkg-install.in
++++ b/build/pkgs/gap_packages/spkg-install.in
+@@ -1,4 +1,4 @@
+-GAP_ROOT="$SAGE_LOCAL/share/gap"
++GAP_ROOT="$SAGE_LOCAL/lib/gap"
+ PKG_DIR="$GAP_ROOT/pkg"
+ 
+ PKG_SRC_DIR="$(pwd)/src/pkg"
+@@ -11,33 +11,31 @@ cd "$PKG_SRC_DIR"
+ #    (GAP 4.8.6 still had it, but this is gone in 4.10)
+ 
+ sdh_install \
+-    aclib-* \
+-    AutoDoc-* \
+-    corelg-* \
+-    crime-* \
++    aclib \
++    corelg \
++    crime \
+     cryst \
+     crystcat \
+-    design-* \
++    design \
+     gbnp \
+-    genss-* \
+-    hap-* \
+-    hapcryst-* \
+-    hecke-* \
+-    images-* \
+-    liealgdb-* \
+-    liepring-* \
+-    liering-* \
+-    loops-* \
+-    MapClass-* \
+-    polymaking-* \
+-    qpa-* \
+-    quagroup-* \
+-    radiroot-* \
+-    repsn-* \
+-    sla-* \
+-    sonata-* \
+-    Toric-* \
+-    utils-* \
++    genss \
++    hap \
++    hapcryst \
++    hecke \
++    images \
++    liealgdb \
++    liepring \
++    liering \
++    loops \
++    mapclass \
++    polymaking \
++    qpa \
++    quagroup \
++    repsn \
++    singular \
++    sla \
++    sonata \
++    toric \
+     "$PKG_DIR"
+ 
+ install_compiled_pkg()
+@@ -45,27 +43,23 @@ install_compiled_pkg()
+     local pkg="$1"
+     # Install the bin/ dir (where compiled modules should end up)
+     # under <prefix>/lib/gap; we then symlink to it later
+-    sdh_install bin "$SAGE_LOCAL/lib/gap/pkg/$pkg"
++    sdh_install * "$SAGE_LOCAL/lib/gap/pkg/$pkg"
+ 
++    # TODO:
+     # Clean up any build artificts before installing the rest of the package
+     # Also remove configure/Makefiles
+     # Note: None, if any of the packages really have a proper install target
+-    make clean  # Works for some packages but not all
+-    rm -rf bin/
+-    rm -rf configure configure.* config.* autogen.sh *.m4 Makefile* m4/
++    #make clean  # Works for some packages but not all
++    #rm -rf bin/
++    #rm -rf configure configure.* config.* autogen.sh *.m4 Makefile* m4/
+ 
+-    # Create the bin/ symlink
+-    ln -s "$SAGE_LOCAL/lib/gap/pkg/$pkg/bin" bin
+-
+-    # Install the rest of the package files
+-    sdh_install * "$PKG_DIR/$pkg"
+ }
+ 
+ # Build and install compiled packages:
+ #
+ # These packages have an old ./configure that take the GAP_ROOT as a positional
+ # argument
+-for pkg in cohomolo-* crypting-* grape-* guava-* orb-* datastructures-*
++for pkg in cohomolo crypting grape guava orb datastructures
+ do
+     echo "Building GAP package $pkg"
+     CFLAGS="$CFLAGS -Wno-implicit-function-declaration"
+@@ -91,7 +85,7 @@ pararr=( " " " " "--with-external-planarity" "--with-external-libsemigroups" )
+ ##############################################################################
+ 
+ parind=0
+-for pkg in nq-* io-* digraphs-* semigroups-*
++for pkg in nq io digraphs semigroups
+ do
+     echo "Building GAP package $pkg"
+     cd "$PKG_SRC_DIR/$pkg"
+diff --git a/build/pkgs/libsemigroups/checksums.ini b/build/pkgs/libsemigroups/checksums.ini
+index 62c4268515f..4e13a36cb35 100644
+--- a/build/pkgs/libsemigroups/checksums.ini
++++ b/build/pkgs/libsemigroups/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=libsemigroups-VERSION.tar.gz
+-sha1=2b16c095cc5ffd3f77a71dfbf48cce188e054c03
+-md5=7082cadcf7a195ccb93175cd72b6db95
+-cksum=1501022358
++sha1=86375824b47ce4b0e23570122e873f67136d0c0a
++md5=ff79ad5fbc8bfeb64d48faaf24106b98
++cksum=2845045455
+ upstream_url=https://github.com/libsemigroups/libsemigroups/releases/download/vVERSION/libsemigroups-VERSION.tar.gz
+diff --git a/build/pkgs/libsemigroups/package-version.txt b/build/pkgs/libsemigroups/package-version.txt
+index 9084fa2f716..f90b1afc082 100644
+--- a/build/pkgs/libsemigroups/package-version.txt
++++ b/build/pkgs/libsemigroups/package-version.txt
+@@ -1 +1 @@
+-1.1.0
++2.3.2
+diff --git a/build/pkgs/libsemigroups/spkg-install.in b/build/pkgs/libsemigroups/spkg-install.in
+index 2aaf0e99043..128b54d2f99 100644
+--- a/build/pkgs/libsemigroups/spkg-install.in
++++ b/build/pkgs/libsemigroups/spkg-install.in
+@@ -1,4 +1,4 @@
+ cd src
+-sdh_configure
++sdh_configure --disable-eigen
+ sdh_make
+ sdh_make_install
+diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4
+index d4d145defe3..6a85631f624 100644
+--- a/build/pkgs/singular/spkg-configure.m4
++++ b/build/pkgs/singular/spkg-configure.m4
+@@ -9,52 +9,7 @@ SAGE_SPKG_CONFIGURE([singular], [
+        AC_MSG_CHECKING([that Singular's help is working])
+        AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error occurred"` = x], [
+         AC_MSG_RESULT(yes)
+-        dnl We have Singular. Now determine the shared library path on
+-        dnl platforms on which sage.libs.singular needs to reload the library with RTLD_GLOBAL.
+-        AS_CASE([$host_os],
+-          [cygwin*], [dnl Nothing to do
+-                     ],
+-                     [dnl Use pkg-config to get singular's libdir while we're at it. As a
+-                      dnl moral compromise for using pkg-config, this ultimately allows us
+-                      dnl to pass an absolute path to dlopen(), which is the only approach
+-                      dnl that POSIX guarantees will work.
+-                      PKG_CHECK_VAR([SINGULAR_LIB_DIR], [Singular], [libdir])
+-                      dnl The acl_shlibext variable is set in the top-level configure.ac.
+-                      AC_LANG_PUSH(C)
+-                      ORIG_LIBS="${LIBS}"
+-                      LIBS="${LIBS} -ldl"
+-                      AC_MSG_CHECKING([if we can dlopen($LIBSINGULAR_PATH)])
+-                      LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libSingular.${acl_shlibext}"
+-
+-                      dnl if we can dlopen() it, substitute the name for sage_conf;
+-                      dnl otherwise, fall back to using the SPKG.
+-                      AC_RUN_IFELSE(
+-                        [AC_LANG_PROGRAM(
+-                          [[#include <dlfcn.h>]],
+-                          [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
+-                            if (h == 0) { return 1; } else { return dlclose(h); }]]
+-                        )], [
+-                          AC_MSG_RESULT(yes)
+-                        ], [
+-                          dnl try Debian-specific name
+-                          LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libsingular-Singular.${acl_shlibext}"
+-                          AC_RUN_IFELSE(
+-                           [AC_LANG_PROGRAM(
+-                             [[#include <dlfcn.h>]],
+-                             [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
+-                               if (h == 0) { return 1; } else { return dlclose(h); }]]
+-                           )], [
+-                             AC_MSG_RESULT(yes)
+-                           ], [
+-                            AC_MSG_RESULT(no)
+-                            sage_spkg_install_singular=yes
+-                          ], [AC_MSG_RESULT(yes)])
+-                        ], [AC_MSG_RESULT(yes)])
+-
+-                      AC_LANG_POP()
+-                      LIBS="${ORIG_LIBS}"
+-                     ]
+-       )], [
++       ], [
+        AC_MSG_RESULT(no)
+        sage_spkg_install_singular=yes
+        ]
+@@ -64,20 +19,4 @@ SAGE_SPKG_CONFIGURE([singular], [
+       ])
+     ])
+   ])
+-],[],[],[
+-  dnl Post-check phase
+-  dnl We make the sage_conf substitutions here, because the "default"
+-  dnl substitution needs to be made even if we skipped the system-Singular
+-  dnl checks themselves.
+-  AS_IF([test "x${sage_spkg_install_singular}" = "xyes"], [
+-    AS_CASE([$host_os],
+-      [cygwin*], [dnl Nothing to do
+-                 ],
+-                 [dnl Set shared library path, needed for reloading the library with RTLD_GLOBAL
+-                  LIBSINGULAR_PATH="\$SAGE_LOCAL/lib/libSingular.${acl_shlibext}"
+-                 ]
+-    )
+-  ])
+-
+-  AC_SUBST(LIBSINGULAR_PATH, "${LIBSINGULAR_PATH}")
+ ])
+diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in
+index 6cd28f558a8..d66bdb3d264 100644
+--- a/pkgs/sage-conf/_sage_conf/_conf.py.in
++++ b/pkgs/sage-conf/_sage_conf/_conf.py.in
+@@ -55,9 +55,6 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"
+ OPENMP_CFLAGS = "@OPENMP_CFLAGS@"
+ OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"
+ 
+-# The full absolute path to the main Singular library.
+-LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)
+-
+ # Installation location of wheels. This is determined at configuration time
+ # and does not depend on the installation location of sage-conf.
+ SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels"
+diff --git a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
+index c917338e444..182e74aad20 100644
+--- a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
++++ b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
+@@ -139,12 +139,12 @@ string, which you can print::
+     X.1      1  1  1  1  1  1  1  1  1  1  1  1  1
+     X.2      1 -1  1  1 -1  1  1 -1 -1 -1  1  1  1
+     X.3      2  .  2 -1  .  2  2  .  .  . -1  2  2
+-    X.4      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
+-    X.5      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
+-    X.6      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
+-    X.7      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
+-    X.8      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
+-    X.9      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
++    X.4      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
++    X.5      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
++    X.6      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
++    X.7      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
++    X.8      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
++    X.9      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
+     X.10     4 -2  . -1  .  .  .  2  .  .  1  . -4
+     X.11     4  2  . -1  .  .  . -2  .  .  1  . -4
+     X.12     6  . -2  .  . -2 -2  .  .  .  .  2  6
+diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx
+index de5db985e0b..c83b9264e44 100644
+--- a/src/sage/coding/codecan/autgroup_can_label.pyx
++++ b/src/sage/coding/codecan/autgroup_can_label.pyx
+@@ -76,7 +76,7 @@ columns do share the same coloring::
+     ((1,),
+      (2,),
+      (3, 5, 4),
+-     (6, 19, 16, 9, 21, 10, 8, 15, 14, 11, 20, 13, 12, 7, 17, 18))
++     (6, 19, 16, 21, 9, 10, 15, 8, 20, 11, 14, 13, 7, 12, 18, 17))
+ 
+ We can also restrict the group action to linear isometries::
+ 
+diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py
+index a3ac3ca1547..bfb9f8696e8 100644
+--- a/src/sage/coding/linear_code.py
++++ b/src/sage/coding/linear_code.py
+@@ -465,27 +465,27 @@ def automorphism_group_gens(self, equivalence="semilinear"):
+             0
+             sage: C = codes.HammingCode(GF(4, 'z'), 3)
+             sage: C.automorphism_group_gens()
+-            ([((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
++            ([((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
++                Defn: z |--> z + 1),
++              ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z + 1),
+-              ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
+-                Defn: z |--> z),
+               ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+              362880)
+             sage: C.automorphism_group_gens(equivalence="linear")
+-            ([((z + 1, 1, z + 1, z + 1, z + 1, z, 1, z, 1, 1, 1, 1, z + 1, z + 1, z + 1, z, z, 1, z, z, z); (1,15,2,8,16,18,3)(4,9,12,13,20,10,11)(5,21,14,6,7,19,17), Ring endomorphism of Finite Field in z of size 2^2
++            ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((z + 1, z + 1, z + 1, z + 1, z + 1, 1, z, 1, z, z, z, 1, z, 1, 1, 1, z + 1, z + 1, z + 1, 1, z); (1,15,21,8,9)(2,18,5,3,11,16,7,10,19,13,12,4,17,6,20), Ring endomorphism of Finite Field in z of size 2^2
++              ((z + 1, z + 1, z + 1, z, 1, 1, z, z, 1, z + 1, z, 1, 1, z, 1, z + 1, z, z + 1, z + 1, 1, z); (1,3,18,2,17,6,19)(4,15,13,20,7,14,16)(5,11,8,21,12,9,10), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+               ((z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1); (), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+              181440)
+             sage: C.automorphism_group_gens(equivalence="permutational")
+-            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
++            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
++              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,18)(3,19)(4,10)(5,16)(8,13)(9,14)(11,21)(15,20), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+-              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,17)(2,8)(3,14)(4,10)(7,12)(9,19)(13,18)(15,20), Ring endomorphism of Finite Field in z of size 2^2
++              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z),
+               ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,13)(3,14)(4,20)(5,11)(8,18)(9,19)(10,15)(16,21), Ring endomorphism of Finite Field in z of size 2^2
+                 Defn: z |--> z)],
+@@ -691,10 +691,10 @@ def _canonize(self, equivalence):
+             sage: C_iso == aut_group_can_label.get_canonical_form()
+             True
+             sage: aut_group_can_label.get_autom_gens()
+-            [((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
++            [((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
++               Defn: z |--> z + 1),
++             ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
+                Defn: z |--> z + 1),
+-             ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
+-               Defn: z |--> z),
+              ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
+                Defn: z |--> z)]
+         """
+diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py
+index 2836d59d960..8c882d5ac3b 100644
+--- a/src/sage/combinat/posets/posets.py
++++ b/src/sage/combinat/posets/posets.py
+@@ -8813,7 +8813,7 @@ def _libgap_(self):
+             sage: libgap(P)  # optional - gap_packages
+             <A poset on 5 points>
+             sage: A = libgap(GF(2)).PosetAlgebra(P); A  # optional - gap_packages
+-            <GF(2)[<quiver with 5 vertices and 5 arrows>]/<two-sided ideal in <GF(2)[<quiver with 5 vertices and 5 arrows>]>, (1 generators)>>
++            <GF(2)[<quiver with 5 vertices and 5 arrows>]/<two-sided ideal in <GF(2)[<quiver with 5 vertices and 5 arrows>]>, (1 generator)>>
+             sage: A.Dimension()  # optional - gap_packages
+             13
+         """
+diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py
+index 6b756bafc30..8ac99319bec 100644
+--- a/src/sage/combinat/root_system/hecke_algebra_representation.py
++++ b/src/sage/combinat/root_system/hecke_algebra_representation.py
+@@ -357,7 +357,7 @@ def Tw(self, word, signs=None, scalar=None):
+             sage: q1, q2 = K.gens()
+             sage: KW = W.algebra(K)
+             sage: x = KW.an_element(); x
+-            123 + 3*32 + 2*3 + e
++            123 + 3*2312 + 2*31 + e
+ 
+             sage: T = KW.demazure_lusztig_operators(q1,q2)
+             sage: T12 = T.Tw( (1,2) )
+diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py
+index b8a0bebab44..9bccba124c8 100644
+--- a/src/sage/combinat/symmetric_group_algebra.py
++++ b/src/sage/combinat/symmetric_group_algebra.py
+@@ -101,7 +101,7 @@ def SymmetricGroupAlgebra(R, W, category=None):
+         sage: SGA.group()
+         Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space)
+         sage: SGA.an_element()
+-        s1*s2*s3 + 3*s3*s2 + 2*s3 + 1
++        s1*s2*s3 + 3*s2*s3*s1*s2 + 2*s3*s1 + 1
+ 
+     The preferred way to construct the symmetric group algebra is to
+     go through the usual ``algebra`` method::
+diff --git a/src/sage/env.py b/src/sage/env.py
+index 911f34b1bc6..5f7aca8599c 100644
+--- a/src/sage/env.py
++++ b/src/sage/env.py
+@@ -197,7 +197,8 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ GRAPHS_DATA_DIR = var("GRAPHS_DATA_DIR", join(SAGE_SHARE, "graphs"))
+ ELLCURVE_DATA_DIR = var("ELLCURVE_DATA_DIR", join(SAGE_SHARE, "ellcurves"))
+ POLYTOPE_DATA_DIR = var("POLYTOPE_DATA_DIR", join(SAGE_SHARE, "reflexive_polytopes"))
+-GAP_ROOT_DIR = var("GAP_ROOT_DIR", join(SAGE_SHARE, "gap"))
++GAP_LIB_DIR = var("GAP_LIB_DIR", join(SAGE_LOCAL, "lib", "gap"))
++GAP_SHARE_DIR = var("GAP_SHARE_DIR", join(SAGE_SHARE, "gap"))
+ THEBE_DIR = var("THEBE_DIR", join(SAGE_SHARE, "thebe"))
+ COMBINATORIAL_DESIGN_DATA_DIR = var("COMBINATORIAL_DESIGN_DATA_DIR", join(SAGE_SHARE, "combinatorial_designs"))
+ CREMONA_MINI_DATA_DIR = var("CREMONA_MINI_DATA_DIR", join(SAGE_SHARE, "cremona"))
+@@ -229,12 +230,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ LIE_INFO_DIR = var("LIE_INFO_DIR", join(SAGE_LOCAL, "lib", "LiE"))
+ SINGULAR_BIN = var("SINGULAR_BIN") or "Singular"
+ 
+-# The path to libSingular, to be passed to dlopen(). This will
+-# typically be set to an absolute path in sage_conf, but the relative
+-# fallback path here works on systems where dlopen() searches the
+-# system's library locations.
+-LIBSINGULAR_PATH = var("LIBSINGULAR_PATH", "libSingular.so")
+-
+ # OpenMP
+ OPENMP_CFLAGS = var("OPENMP_CFLAGS", "")
+ OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
+@@ -255,81 +250,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
+ SAGE_GAP_COMMAND = var('SAGE_GAP_COMMAND', _gap_cmd)
+ 
+ 
+-def _get_shared_lib_path(*libnames: str) -> Optional[str]:
+-    """
+-    Return the full path to a shared library file installed in
+-    ``$SAGE_LOCAL/lib`` or the directories associated with the
+-    Python sysconfig.
+-
+-    This can also be passed more than one library name (e.g. for cases where
+-    some library may have multiple names depending on the platform) in which
+-    case the first one found is returned.
+-
+-    This supports most *NIX variants (in which ``lib<libname>.so`` is found
+-    under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
+-    extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
+-    or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
+-
+-    For distributions like Debian that use a multiarch layout, we also try the
+-    multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
+-
+-    This returns ``None`` if no matching library file could be found.
+-
+-    EXAMPLES::
+-
+-        sage: from sage.env import _get_shared_lib_path
+-        sage: "gap" in _get_shared_lib_path("gap")
+-        True
+-        sage: _get_shared_lib_path("an_absurd_lib") is None
+-        True
+-
+-    """
+-
+-    for libname in libnames:
+-        search_directories: List[Path] = []
+-        patterns: List[str] = []
+-        if sys.platform == 'cygwin':
+-            # Later down we take the first matching DLL found, so search
+-            # SAGE_LOCAL first so that it takes precedence
+-            if SAGE_LOCAL:
+-                search_directories.append(Path(SAGE_LOCAL) / 'bin')
+-            search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
+-            # Note: The following is not very robust, since if there are multible
+-            # versions for the same library this just selects one more or less
+-            # at arbitrary. However, practically speaking, on Cygwin, there
+-            # will only ever be one version
+-            patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
+-        else:
+-            if sys.platform == 'darwin':
+-                ext = 'dylib'
+-            else:
+-                ext = 'so'
+-
+-            if SAGE_LOCAL:
+-                search_directories.append(Path(SAGE_LOCAL) / 'lib')
+-            libdir = sysconfig.get_config_var('LIBDIR')
+-            if libdir is not None:
+-                libdir = Path(libdir)
+-                search_directories.append(libdir)
+-
+-                multiarchlib = sysconfig.get_config_var('MULTIARCH')
+-                if multiarchlib is not None:
+-                    search_directories.append(libdir / multiarchlib),
+-
+-            patterns = [f'lib{libname}.{ext}']
+-
+-        for directory in search_directories:
+-            for pattern in patterns:
+-                path = next(directory.glob(pattern), None)
+-                if path is not None:
+-                    return str(path.resolve())
+-
+-    # Just return None if no files were found
+-    return None
+-
+-# locate libgap shared object
+-GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
+-
+ # post process
+ if DOT_SAGE is not None and ' ' in DOT_SAGE:
+     if UNAME[:6] == 'CYGWIN':
+diff --git a/src/sage/groups/abelian_gps/abelian_group_gap.py b/src/sage/groups/abelian_gps/abelian_group_gap.py
+index a4b047113c5..86090b43535 100644
+--- a/src/sage/groups/abelian_gps/abelian_group_gap.py
++++ b/src/sage/groups/abelian_gps/abelian_group_gap.py
+@@ -338,7 +338,7 @@ def _element_constructor_(self, x, check=True):
+         if isinstance(x, AbelianGroupElement_gap):
+             try:
+                 if x in self._cover:
+-                    x = self.gap().NaturalHomomorphism().Image(x.gap())
++                    x = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations).Image(x.gap())
+                 else:
+                     x = x.gap()
+             except AttributeError:
+@@ -1043,7 +1043,7 @@ def natural_homomorphism(self):
+             From: Abelian group with gap, generator orders (4,)
+             To:   Quotient abelian group with generator orders (2,)
+         """
+-        phi = self.gap().NaturalHomomorphism()
++        phi = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations)
+         Hom = self._cover.Hom(self)
+         return Hom(phi)
+ 
+diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
+index 8d6e443683c..1beb01af87f 100644
+--- a/src/sage/groups/finitely_presented.py
++++ b/src/sage/groups/finitely_presented.py
+@@ -596,9 +596,9 @@ def gap(self):
+             sage: k = G.rewriting_system()
+             sage: k.gap()
+             Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules
+-            [ [ a^2, <identity ...> ], [ a*A, <identity ...> ],
+-              [ A*a, <identity ...> ], [ b^2, <identity ...> ],
+-              [ b*B, <identity ...> ], [ B*b, <identity ...> ] ]
++            [ [ a*A, <identity ...> ], [ A*a, <identity ...> ],
++              [ b*B, <identity ...> ], [ B*b, <identity ...> ],
++              [ a^2, <identity ...> ], [ b^2, <identity ...> ] ]
+         """
+         return self._gap
+ 
+diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
+index 7fc4dbe7548..e5eccd45942 100644
+--- a/src/sage/groups/fqf_orthogonal.py
++++ b/src/sage/groups/fqf_orthogonal.py
+@@ -143,7 +143,7 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
+         [2/3   0   0]
+         [  0 2/3   0]
+         [  0   0 4/3]
+-        generated by 2 elements
++        generated by 3 elements
+         sage: q = matrix.diagonal(QQ, [3/2, 1/4, 1/4])
+         sage: T = TorsionQuadraticForm(q)
+         sage: T.orthogonal_group().order()
+diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx
+index d25121aa792..dc81b71635b 100644
+--- a/src/sage/groups/libgap_wrapper.pyx
++++ b/src/sage/groups/libgap_wrapper.pyx
+@@ -25,7 +25,7 @@ Note how we call the constructor of both superclasses to initialize
+ its output via LibGAP::
+ 
+     sage: FooGroup()
+-    <pc group of size 3 with 1 generators>
++    <pc group of size 3 with 1 generator>
+     sage: type(FooGroup().gap())
+     <class 'sage.libs.gap.element.GapElement'>
+ 
+@@ -106,7 +106,7 @@ class ParentLibGAP(SageObject):
+         ....:         ParentLibGAP.__init__(self, lg)
+         ....:         Group.__init__(self)
+         sage: FooGroup()
+-        <pc group of size 3 with 1 generators>
++        <pc group of size 3 with 1 generator>
+     """
+ 
+     def __init__(self, libgap_parent, ambient=None):
+@@ -461,7 +461,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement):
+         ....:         ParentLibGAP.__init__(self, lg)
+         ....:         Group.__init__(self)
+         sage: FooGroup()
+-        <pc group of size 3 with 1 generators>
++        <pc group of size 3 with 1 generator>
+         sage: FooGroup().gens()
+         (f1,)
+     """
+diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py
+index a6d3dc02513..63956ad5f10 100644
+--- a/src/sage/groups/matrix_gps/finitely_generated.py
++++ b/src/sage/groups/matrix_gps/finitely_generated.py
+@@ -563,9 +563,6 @@ def as_permutation_group(self, algorithm=None, seed=None):
+             21499084800
+             sage: P = G.as_permutation_group()
+             sage: Psmaller = G.as_permutation_group(algorithm="smaller", seed=6)
+-            sage: P == Psmaller  # see the note below
+-            True
+-            sage: Psmaller = G.as_permutation_group(algorithm="smaller")
+             sage: P == Psmaller
+             False
+             sage: P.cardinality()
+diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
+index f2ccca042ac..47d6862333c 100644
+--- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
++++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
+@@ -427,7 +427,7 @@ cdef class LabelledBranching:
+             sage: from sage.groups.perm_gps.partn_ref2.refinement_generic import LabelledBranching
+             sage: L = LabelledBranching(3)
+             sage: L.small_generating_set()
+-            []
++            [()]
+             sage: L.add_gen(libgap.eval('(1,2,3)'))
+             sage: L.small_generating_set()
+             [(1,2,3)]
+diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
+index ebdf7c4c6eb..fb14008c8e0 100644
+--- a/src/sage/groups/perm_gps/permgroup.py
++++ b/src/sage/groups/perm_gps/permgroup.py
+@@ -926,7 +926,7 @@ def _coerce_map_from_(self, G):
+            sage: f = PG._coerce_map_from_(MG)
+            sage: mg = MG.an_element()
+            sage: p = f(mg); p
+-           (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60)
++           (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21)
+            sage: PG(p._gap_()) == p
+            True
+ 
+@@ -972,12 +972,12 @@ def _coerce_map_from_(self, G):
+             sage: P = G.as_permutation_group(algorithm='smaller', seed=5)
+             sage: P1 = G.as_permutation_group()
+             sage: P == P1
+-            False
++            True
+             sage: g1, g2, g3 = G.gens()
+             sage: P(g1*g2)
+-            (1,3,7,12)(2,4,8,10)(5,11)(6,9)
++            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
+             sage: P1(g1*g2)
+-            (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66)
++            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
+ 
+         Another check for :trac:`5583`::
+ 
+@@ -1302,7 +1302,7 @@ def gens_small(self):
+             sage: G.gens_small() # random
+             [('b','c'), ('a','c','b')] ## (on 64-bit Linux)
+             [('a','b'), ('a','c','b')] ## (on Solaris)
+-            sage: len(G.gens_small()) == 2
++            sage: len(G.gens_small()) == 2 # random
+             True
+         """
+         gens = self._libgap_().SmallGeneratingSet()
+@@ -4370,17 +4370,23 @@ def is_transitive(self, domain=None):
+ 
+         ::
+ 
+-            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
+-            sage: G.is_transitive([1,4,5])
++            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)],[(6,7)]])
++            sage: G.is_transitive([1,2,3,4,5])
+             True
+-            sage: G.is_transitive([2..6])
++            sage: G.is_transitive([1..7])
+             False
+             sage: G.is_transitive(G.non_fixed_points())
+-            True
++            False
+             sage: H = PermutationGroup([[(1,2,3)],[(4,5,6)]])
+             sage: H.is_transitive(H.non_fixed_points())
+             False
+ 
++        If `G` does not act on the domain, it always returns ``False``::
++
++            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
++            sage: G.is_transitive([1,4,5])
++            False
++
+         Note that this differs from the definition in GAP, where
+         ``IsTransitive`` returns whether the group is transitive on the
+         set of points moved by the group.
+@@ -4436,12 +4442,16 @@ def is_primitive(self, domain=None):
+             sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
+             sage: G.is_primitive([1..4])
+             False
+-            sage: G.is_primitive([1,2,3])
+-            True
+             sage: G = PermutationGroup([[(3,4,5,6)],[(3,4)]]) #S_4 on [3..6]
+             sage: G.is_primitive(G.non_fixed_points())
+             True
+ 
++        If `G` does not act on the domain, it always returns ``False``::
++
++            sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
++            sage: G.is_primitive([1,2,3])
++            False
++
+         """
+         #If the domain is not a subset of self.domain(), then the
+         #action isn't primitive.
+diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
+index 7ae1792e9de..ecaa9fd2341 100644
+--- a/src/sage/interfaces/gap.py
++++ b/src/sage/interfaces/gap.py
+@@ -1512,6 +1512,8 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
+     """
+     # Create new workspace with filename WORKSPACE
+     g = Gap(use_workspace_cache=False, max_workspace_size=None)
++    g.eval('ColorPrompt(false)')
++    g.eval('SetUserPreference("UseColorPrompt", false)')
+     g.eval('SetUserPreference("HistoryMaxLines", 30)')
+     from sage.tests.gap_packages import all_installed_packages
+     for pkg in all_installed_packages(gap=g):
+diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
+index 33a87dd5076..03b40be6856 100644
+--- a/src/sage/interfaces/gap_workspace.py
++++ b/src/sage/interfaces/gap_workspace.py
+@@ -16,7 +16,8 @@
+ import os
+ import time
+ import hashlib
+-from sage.env import DOT_SAGE, GAP_SO
++import subprocess
++from sage.env import DOT_SAGE, HOSTNAME, GAP_LIB_DIR, GAP_SHARE_DIR
+ 
+ 
+ def gap_workspace_file(system="gap", name="workspace", dir=None):
+@@ -59,11 +60,13 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
+     if dir is None:
+         dir = os.path.join(DOT_SAGE, 'gap')
+ 
+-    if GAP_SO:
+-        h = hashlib.sha1(GAP_SO.encode('utf-8')).hexdigest()
+-    else:
+-        h = 'unknown'
+-    return os.path.join(dir, '%s-%s-%s' % (system, name, h))
++    data = f'{GAP_LIB_DIR}:{GAP_SHARE_DIR}'
++    for path in GAP_LIB_DIR, GAP_SHARE_DIR:
++        sysinfo = os.path.join(path, "sysinfo.gap")
++        if os.path.exists(sysinfo):
++            data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
++    h = hashlib.sha1(data.encode('utf-8')).hexdigest()
++    return os.path.join(dir, f'{system}-{name}-{HOSTNAME}-{h}')
+ 
+ 
+ def prepare_workspace_dir(dir=None):
+diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
+index c555ea0333c..e3db3934baf 100644
+--- a/src/sage/libs/gap/element.pyx
++++ b/src/sage/libs/gap/element.pyx
+@@ -130,6 +130,7 @@ cdef char *capture_stdout(Obj func, Obj obj):
+     """
+     cdef Obj s, stream, output_text_string
+     cdef UInt res
++    cdef TypOutputFile output
+     # The only way to get a string representation of an object that is truly
+     # consistent with how it would be represented at the GAP REPL is to call
+     # ViewObj on it.  Unfortunately, ViewObj *prints* to the output stream,
+@@ -145,12 +146,12 @@ cdef char *capture_stdout(Obj func, Obj obj):
+         output_text_string = GAP_ValueGlobalVariable("OutputTextString")
+         stream = CALL_2ARGS(output_text_string, s, GAP_True)
+ 
+-        if not OpenOutputStream(stream):
++        if not OpenOutputStream(&output, stream):
+             raise GAPError("failed to open output capture stream for "
+                            "representing GAP object")
+ 
+         CALL_1ARGS(func, obj)
+-        CloseOutput()
++        CloseOutput(&output)
+         return CSTR_STRING(s)
+     finally:
+         GAP_Leave()
+diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd
+index 6d22e32540b..6111d18a5c7 100644
+--- a/src/sage/libs/gap/gap_includes.pxd
++++ b/src/sage/libs/gap/gap_includes.pxd
+@@ -76,8 +76,10 @@ cdef extern from "gap/intobj.h" nogil:
+ 
+ 
+ cdef extern from "gap/io.h" nogil:
+-    UInt OpenOutputStream(Obj stream)
+-    UInt CloseOutput()
++    ctypedef struct TypOutputFile:
++        pass
++    UInt OpenOutputStream(TypOutputFile* output, Obj stream)
++    UInt CloseOutput(TypOutputFile* output)
+ 
+ 
+ cdef extern from "gap/libgap-api.h" nogil:
+diff --git a/src/sage/libs/gap/libgap.pyx b/src/sage/libs/gap/libgap.pyx
+index b1a64e57939..6a36613aa8c 100644
+--- a/src/sage/libs/gap/libgap.pyx
++++ b/src/sage/libs/gap/libgap.pyx
+@@ -695,7 +695,7 @@ class Gap(Parent):
+             sage: libgap.List
+             <Gap function "List">
+             sage: libgap.GlobalRandomSource
+-            <RandomSource in IsGlobalRandomSource>
++            <RandomSource in IsGAPRandomSource>
+         """
+         if name in dir(self.__class__):
+             return getattr(self.__class__, name)
+diff --git a/src/sage/libs/gap/saved_workspace.py b/src/sage/libs/gap/saved_workspace.py
+index ad5adec36d0..7636707f557 100644
+--- a/src/sage/libs/gap/saved_workspace.py
++++ b/src/sage/libs/gap/saved_workspace.py
+@@ -8,7 +8,7 @@
+ 
+ import os
+ import glob
+-from sage.env import GAP_ROOT_DIR
++from sage.env import GAP_LIB_DIR
+ from sage.interfaces.gap_workspace import gap_workspace_file
+ 
+ 
+@@ -31,7 +31,7 @@ def timestamp():
+     """
+     libgap_dir = os.path.dirname(__file__)
+     libgap_files = glob.glob(os.path.join(libgap_dir, '*'))
+-    gap_packages = glob.glob(os.path.join(GAP_ROOT_DIR, 'pkg', '*'))
++    gap_packages = glob.glob(os.path.join(GAP_LIB_DIR, 'pkg', '*'))
+     files = libgap_files + gap_packages
+     if len(files) == 0:
+         print('Unable to find LibGAP files.')
+diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
+index 344ab88c42a..eaa659d64c7 100644
+--- a/src/sage/libs/gap/util.pyx
++++ b/src/sage/libs/gap/util.pyx
+@@ -13,7 +13,7 @@ Utility functions for GAP
+ #*****************************************************************************
+ 
+ from libc.signal cimport signal, SIGCHLD, SIG_DFL
+-from posix.dlfcn cimport dlopen, dlclose, RTLD_NOW, RTLD_GLOBAL
++from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
+ 
+ from cpython.exc cimport PyErr_Fetch, PyErr_Restore
+ from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
+@@ -164,33 +164,6 @@ cdef void gasman_callback() with gil:
+ ### Initialization of GAP ##################################################
+ ############################################################################
+ 
+-def gap_root():
+-    """
+-    Find the location of the GAP root install which is stored in the gap
+-    startup script.
+-
+-    EXAMPLES::
+-
+-        sage: from sage.libs.gap.util import gap_root
+-        sage: gap_root()   # random output
+-        '/home/vbraun/opt/sage-5.3.rc0/local/gap/latest'
+-    """
+-    if os.path.exists(sage.env.GAP_ROOT_DIR):
+-        return sage.env.GAP_ROOT_DIR
+-
+-    # Attempt to figure out the appropriate GAP_ROOT by reading the
+-    # local/bin/gap shell script; this is an ugly hack that exists for
+-    # historical reasons; the best approach to setting where Sage looks for
+-    # the appropriate GAP_ROOT is to set the GAP_ROOT_DIR variable
+-    SAGE_LOCAL = sage.env.SAGE_LOCAL
+-    with open(os.path.join(SAGE_LOCAL, 'bin', 'gap')) as f:
+-        gap_sh = f.read().splitlines()
+-    gapdir = next(x for x in gap_sh if x.strip().startswith('GAP_ROOT'))
+-    gapdir = gapdir.split('"')[1]
+-    gapdir = gapdir.replace('$SAGE_LOCAL', SAGE_LOCAL)
+-    return gapdir
+-
+-
+ # To ensure that we call initialize_libgap only once.
+ cdef bint _gap_is_initialized = False
+ 
+@@ -232,12 +205,12 @@ cdef initialize():
+     # this isn't portable
+ 
+     cdef void* handle
+-    libgapname = str_to_bytes(sage.env.GAP_SO)
+-    handle = dlopen(libgapname, RTLD_NOW | RTLD_GLOBAL)
++    # reload the current module to force reload of libgap (see #33446)
++    lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
++    handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
+     if handle is NULL:
+-        raise RuntimeError(
+-                "Could not dlopen() libgap even though it should already "
+-                "be loaded!")
++        err = dlerror()
++        raise RuntimeError(f"Could not reload gap library with RTLD_GLOBAL ({err})")
+     dlclose(handle)
+ 
+     # Define argv variable, which we will pass in to
+@@ -245,7 +218,7 @@ cdef initialize():
+     cdef char* argv[16]
+     argv[0] = "sage"
+     argv[1] = "-l"
+-    s = str_to_bytes(gap_root(), FS_ENCODING, "surrogateescape")
++    s = str_to_bytes(sage.env.GAP_LIB_DIR + ";" + sage.env.GAP_SHARE_DIR, FS_ENCODING, "surrogateescape")
+     argv[2] = s
+ 
+     argv[3] = "-m"
+@@ -362,15 +335,9 @@ cdef Obj gap_eval(str gap_string) except? NULL:
+         GAPError: Error, Variable: 'Complex' must have a value
+         Syntax error: ; expected in stream:1
+         Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^
++                ^^^^^
+         Error, Variable: 'with' must have a value
+-        Syntax error: ; expected in stream:1
+-        Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^^^^^^^^^
+         Error, Variable: 'bits' must have a value
+-        Syntax error: ; expected in stream:1
+-        Complex Field with 53 bits of precision;;
+-         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+         Error, Variable: 'precision' must have a value
+ 
+     Test that on a subsequent attempt we get the same message (no garbage was
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index d8ea7b07f3c..4beb1774df9 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -1705,14 +1705,7 @@ cdef object si2sa_intvec(intvec *v):
+ cdef extern from *: # hack to get at cython macro
+     int unlikely(int)
+ 
+-cdef extern from "dlfcn.h":
+-    void *dlopen(char *, long)
+-    char *dlerror()
+-    void dlclose(void *handle)
+-
+-cdef extern from "dlfcn.h":
+-    cdef long RTLD_LAZY
+-    cdef long RTLD_GLOBAL
++from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
+ 
+ cdef int overflow_check(unsigned long e, ring *_ring) except -1:
+     """
+@@ -1762,8 +1755,6 @@ cdef init_libsingular():
+ 
+     cdef void *handle = NULL
+ 
+-    from sage.env import LIBSINGULAR_PATH
+-    lib = str_to_bytes(LIBSINGULAR_PATH, FS_ENCODING, "surrogateescape")
+ 
+     # This is a workaround for https://github.com/Singular/Singular/issues/1113
+     # and can be removed once that fix makes it into release of Singular that
+@@ -1780,10 +1771,12 @@ cdef init_libsingular():
+ 
+     import platform
+     if not platform.system().startswith("CYGWIN"):
++        # reload the current module to force reload of libSingular (see #33446)
++        lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
+         handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
+         if not handle:
+             err = dlerror()
+-            raise ImportError(f"cannot load Singular library from {LIBSINGULAR_PATH} ({err})")
++            raise RuntimeError(f"Could not reload Singular library with RTLD_GLOBAL ({err})")
+ 
+     # load SINGULAR
+     siInit(lib)
+diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py
+index 2e4518ca226..c302b169b8a 100644
+--- a/src/sage/tests/gap_packages.py
++++ b/src/sage/tests/gap_packages.py
+@@ -103,7 +103,7 @@ def all_installed_packages(ignore_dot_gap=False, gap=None):
+ 
+         sage: from sage.tests.gap_packages import all_installed_packages
+         sage: all_installed_packages()
+-        (...'GAPDoc'...)
++        (...'gapdoc'...)
+         sage: all_installed_packages(ignore_dot_gap=True) == all_installed_packages(gap=gap, ignore_dot_gap=True)
+         True
+     """
diff --git a/srcpkgs/sagemath/patches/35127-fix_very_slow_test_stream.py.patch b/srcpkgs/sagemath/patches/35127-fix_very_slow_test_stream.py.patch
new file mode 100644
index 000000000000..d331a6573e1c
--- /dev/null
+++ b/srcpkgs/sagemath/patches/35127-fix_very_slow_test_stream.py.patch
@@ -0,0 +1,15 @@
+diff --git a/src/sage/data_structures/stream.py b/src/sage/data_structures/stream.py
+index f8f6dc6a186..002e925f02f 100644
+--- a/src/sage/data_structures/stream.py
++++ b/src/sage/data_structures/stream.py
+@@ -2090,8 +2090,8 @@ def compute_product(self, n, la):
+             sage: f = Stream_exact([1]) # irrelevant for this test
+             sage: g = Stream_function(lambda n: s[n], True, 0)
+             sage: h = Stream_plethysm(f, g, True, p)
+-            sage: B = p[2, 2, 1](sum(s[i] for i in range(7)))
+-            sage: all(h.compute_product(k, Partition([2, 2, 1])) == B.restrict_degree(k) for k in range(7))
++            sage: B = p[2, 2, 1](sum(p(s[i]) for i in range(7)))  # long time
++            sage: all(h.compute_product(k, Partition([2, 2, 1])) == B.restrict_degree(k) for k in range(7))  # long time
+             True
+         """
+         # This is the approximate order of the result
diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches
new file mode 100755
index 000000000000..c98da68683cc
--- /dev/null
+++ b/srcpkgs/sagemath/patches/get_patches
@@ -0,0 +1,41 @@
+#! /bin/sh
+
+URL_BASE_PR="https://github.com/sagemath/sage/pull/"
+URL_BASE_COMPARE="https://github.com/sagemath/sage/compare/9.8..."
+
+case "$1" in
+	-n)  DO=echo ;;
+esac
+
+# get_pr <PR number> <description> [ext]
+get_pr() {
+	pr=$1
+	desc=$(echo "$2" | sed -e 's/ /_/g')
+	ext=${3-diff}
+	$DO wget "$URL_BASE_PR$pr.$ext" -O "$pr-$desc.patch"
+}
+
+get_trac() {
+	ticket=$1
+	desc=$(echo "$2" | sed -e 's/ /_/g')
+	commit=$3
+	$DO wget "$URL_BASE_COMPARE$commit.diff" -O "trac-$ticket-$desc-$commit.patch"
+}
+
+# run from patches dir
+cd $(dirname "$0")
+
+# merged in 10.0.beta0
+get_trac 34851 "support singular 4.3.1.p3" 5e5737a0c
+get_pr 35068 "fix tests giac 1.9.0.35" patch
+
+# positive review
+get_pr 34994 "fix tests numpy 1.24"
+get_pr 34997 "fix edge case of integer_check"
+get_pr 35058 "skip unstable tests klyachko"
+get_pr 35094 "support gap 4.12"					# includes PR 35093
+
+# needs review 
+get_pr 34995 "support tachyon 0.99.2"
+get_pr 34980 "avoid factoring in is_prime"
+get_pr 35127 "fix very slow test stream.py"
diff --git a/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch b/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
deleted file mode 100644
index e052e306e7a1..000000000000
--- a/srcpkgs/sagemath/patches/trac-33360-avoid_factoring_in_is_prime-6330cee1a69229b2f5d8ac4a09a73d8152f5e14d.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 6330cee1a69229b2f5d8ac4a09a73d8152f5e14d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 28 Feb 2022 23:15:16 -0300
-Subject: trac 33360: avoid factoring in is_prime()
-
-In the added TEST, the ideal norm is product of two primes but factoring
-this product takes about half an hour, so factoring the ideal is slow.
-
-To fix the issue, we only factor the ideal if the norm is a prime power.
----
- src/sage/rings/number_field/number_field_ideal.py | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
-index f785f22..10d1f88 100644
---- a/src/sage/rings/number_field/number_field_ideal.py
-+++ b/src/sage/rings/number_field/number_field_ideal.py
-@@ -995,10 +995,32 @@ class NumberFieldIdeal(Ideal_generic):
-             False
-             sage: K.ideal(17).is_prime()  # ramified
-             False
-+
-+        TESTS::
-+
-+        Check that we do not factor the norm of the ideal, this used
-+        to take half an hour, see :trac:`33360`
-+
-+           sage: K.<a,b,c> = NumberField([x^2-2,x^2-3,x^2-5])
-+           sage: t = (((-2611940*c + 1925290/7653)*b - 1537130/7653*c
-+           ....:       + 10130950)*a + (1343014/7653*c - 8349770)*b
-+           ....:       + 6477058*c - 2801449990/4002519)
-+           sage: t.is_prime()
-+           False
-+
-         """
-         try:
-             return self._pari_prime is not None
-         except AttributeError:
-+            K = self.number_field().pari_nf()
-+            I = self.pari_hnf()
-+            # This would be better, but it is broken in pari 2.13.3.
-+            #   self._pari_prime = K.idealismaximal(I) or None
-+            # Instead we factor I, but only if the norm is a prime power
-+            n = K.idealnorm(I)
-+            if n.denominator() > 1 or not n.isprimepower():
-+                self._pari_prime = None
-+                return False
-             F = self.factor()  # factorization with caching
-             if len(F) != 1 or F[0][1] != 1:
-                 self._pari_prime = None
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch b/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
deleted file mode 100644
index fb9e0f5a8071..000000000000
--- a/srcpkgs/sagemath/patches/trac-33446-make_GAP_SO_unnecessary-31e3fc4ec8b8687bccd22d2e3161c86cf5553e06.patch
+++ /dev/null
@@ -1,427 +0,0 @@
-From 9feec282d039ca25bbefa50710f8217b775ce111 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Thu, 3 Mar 2022 14:47:00 -0300
-Subject: gap: do not directly dlopen() the gap library
-
-This needs the soname (as in sage.env.GAP_SO) which has issues for
-system gap as explained in #33446.
-
-Instead we dlopen() the extension module sage.libs.gap.util which,
-having a link time dependency to libgap, will indirectly dlopen() it.
-
-For the record: by the time we run dlopen() the libgap should be already
-loaded. The purpose of doing it is to change mode to RTLD_GLOBAL so that
-symbols in libgap are placed in the global symbol table. This is
-required to compiled load gap packages.
-
-An easy test that this is working ok is:
-
-    sage: libgap.LoadPackage("io")
-    true
-
-This requires optional spkg `gap_packages` to be installed.
----
- src/sage/libs/gap/util.pyx | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
-index 344ab88..aff604b 100644
---- a/src/sage/libs/gap/util.pyx
-+++ b/src/sage/libs/gap/util.pyx
-@@ -13,7 +13,7 @@ Utility functions for GAP
- #*****************************************************************************
- 
- from libc.signal cimport signal, SIGCHLD, SIG_DFL
--from posix.dlfcn cimport dlopen, dlclose, RTLD_NOW, RTLD_GLOBAL
-+from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
- 
- from cpython.exc cimport PyErr_Fetch, PyErr_Restore
- from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
-@@ -232,12 +232,12 @@ cdef initialize():
-     # this isn't portable
- 
-     cdef void* handle
--    libgapname = str_to_bytes(sage.env.GAP_SO)
--    handle = dlopen(libgapname, RTLD_NOW | RTLD_GLOBAL)
-+    # reload the current module to force reload of libgap (see #33446)
-+    lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
-+    handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
-     if handle is NULL:
--        raise RuntimeError(
--                "Could not dlopen() libgap even though it should already "
--                "be loaded!")
-+        err = dlerror()
-+        raise RuntimeError(f"Could not reload gap library with RTLD_GLOBAL ({err})")
-     dlclose(handle)
- 
-     # Define argv variable, which we will pass in to
--- 
-cgit v1.0-1-gd88e
-
-
-From 704a7953b97ab726e2af610724726aa562bc8bf8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Thu, 3 Mar 2022 23:00:07 -0300
-Subject: singular: do not directly dlopen() the singular library
-
-Same as for gap in the previous commit. Instead of requiring the soname
-(as in sage.env.LIBSINGULAR_PATH) we dlopen() the extension module
-sage.libs.singular.singular which will indirectly dlopen() libSingular.
----
- src/sage/libs/singular/singular.pyx | 15 ++++-----------
- 1 file changed, 4 insertions(+), 11 deletions(-)
-
-diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
-index d8ea7b0..4beb177 100644
---- a/src/sage/libs/singular/singular.pyx
-+++ b/src/sage/libs/singular/singular.pyx
-@@ -1705,14 +1705,7 @@ cdef object si2sa_intvec(intvec *v):
- cdef extern from *: # hack to get at cython macro
-     int unlikely(int)
- 
--cdef extern from "dlfcn.h":
--    void *dlopen(char *, long)
--    char *dlerror()
--    void dlclose(void *handle)
--
--cdef extern from "dlfcn.h":
--    cdef long RTLD_LAZY
--    cdef long RTLD_GLOBAL
-+from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
- 
- cdef int overflow_check(unsigned long e, ring *_ring) except -1:
-     """
-@@ -1762,8 +1755,6 @@ cdef init_libsingular():
- 
-     cdef void *handle = NULL
- 
--    from sage.env import LIBSINGULAR_PATH
--    lib = str_to_bytes(LIBSINGULAR_PATH, FS_ENCODING, "surrogateescape")
- 
-     # This is a workaround for https://github.com/Singular/Singular/issues/1113
-     # and can be removed once that fix makes it into release of Singular that
-@@ -1780,10 +1771,12 @@ cdef init_libsingular():
- 
-     import platform
-     if not platform.system().startswith("CYGWIN"):
-+        # reload the current module to force reload of libSingular (see #33446)
-+        lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
-         handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
-         if not handle:
-             err = dlerror()
--            raise ImportError(f"cannot load Singular library from {LIBSINGULAR_PATH} ({err})")
-+            raise RuntimeError(f"Could not reload Singular library with RTLD_GLOBAL ({err})")
- 
-     # load SINGULAR
-     siInit(lib)
--- 
-cgit v1.0-1-gd88e
-
-
-From d7145c14ef58acfbe00d8f941d2802e96ad4ba15 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 16:37:34 -0300
-Subject: singular: remove LIBSINGULAR_PATH, no longer needed
-
----
- build/pkgs/singular/spkg-configure.m4 | 63 +----------------------------------
- pkgs/sage-conf/_sage_conf/_conf.py.in |  3 --
- src/sage/env.py                       |  6 ----
- 3 files changed, 1 insertion(+), 71 deletions(-)
-
-diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4
-index af2eb85..6d3d3da 100644
---- a/build/pkgs/singular/spkg-configure.m4
-+++ b/build/pkgs/singular/spkg-configure.m4
-@@ -9,52 +9,7 @@ SAGE_SPKG_CONFIGURE([singular], [
-        AC_MSG_CHECKING([that Singular's help is working])
-        AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error\ occurred"` = x], [
-         AC_MSG_RESULT(yes)
--        dnl We have Singular. Now determine the shared library path on
--        dnl platforms on which sage.libs.singular needs to reload the library with RTLD_GLOBAL.
--        AS_CASE([$host_os],
--          [cygwin*], [dnl Nothing to do
--                     ],
--                     [dnl Use pkg-config to get singular's libdir while we're at it. As a
--                      dnl moral compromise for using pkg-config, this ultimately allows us
--                      dnl to pass an absolute path to dlopen(), which is the only approach
--                      dnl that POSIX guarantees will work.
--                      PKG_CHECK_VAR([SINGULAR_LIB_DIR], [Singular], [libdir])
--                      dnl The acl_shlibext variable is set in the top-level configure.ac.
--                      AC_LANG_PUSH(C)
--                      ORIG_LIBS="${LIBS}"
--                      LIBS="${LIBS} -ldl"
--                      AC_MSG_CHECKING([if we can dlopen($LIBSINGULAR_PATH)])
--                      LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libSingular.${acl_shlibext}"
--
--                      dnl if we can dlopen() it, substitute the name for sage_conf;
--                      dnl otherwise, fall back to using the SPKG.
--                      AC_RUN_IFELSE(
--                        [AC_LANG_PROGRAM(
--                          [[#include <dlfcn.h>]],
--                          [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
--                            if (h == 0) { return 1; } else { return dlclose(h); }]]
--                        )], [
--                          AC_MSG_RESULT(yes)
--                        ], [
--                          dnl try Debian-specific name
--                          LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libsingular-Singular.${acl_shlibext}"
--                          AC_RUN_IFELSE(
--                           [AC_LANG_PROGRAM(
--                             [[#include <dlfcn.h>]],
--                             [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
--                               if (h == 0) { return 1; } else { return dlclose(h); }]]
--                           )], [
--                             AC_MSG_RESULT(yes)
--                           ], [
--                            AC_MSG_RESULT(no)
--                            sage_spkg_install_singular=yes
--                          ], [AC_MSG_RESULT(yes)])
--                        ], [AC_MSG_RESULT(yes)])
--
--                      AC_LANG_POP()
--                      LIBS="${ORIG_LIBS}"
--                     ]
--       )], [
-+       ], [
-        AC_MSG_RESULT(no)
-        sage_spkg_install_singular=yes
-        ]
-@@ -64,20 +19,4 @@ SAGE_SPKG_CONFIGURE([singular], [
-       ])
-     ])
-   ])
--],[],[],[
--  dnl Post-check phase
--  dnl We make the sage_conf substitutions here, because the "default"
--  dnl substitution needs to be made even if we skipped the system-Singular
--  dnl checks themselves.
--  AS_IF([test "x${sage_spkg_install_singular}" = "xyes"], [
--    AS_CASE([$host_os],
--      [cygwin*], [dnl Nothing to do
--                 ],
--                 [dnl Set shared library path, needed for reloading the library with RTLD_GLOBAL
--                  LIBSINGULAR_PATH="\$SAGE_LOCAL/lib/libSingular.${acl_shlibext}"
--                 ]
--    )
--  ])
--
--  AC_SUBST(LIBSINGULAR_PATH, "${LIBSINGULAR_PATH}")
- ])
-diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in
-index 6cd28f5..d66bdb3 100644
---- a/pkgs/sage-conf/_sage_conf/_conf.py.in
-+++ b/pkgs/sage-conf/_sage_conf/_conf.py.in
-@@ -55,9 +55,6 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"
- OPENMP_CFLAGS = "@OPENMP_CFLAGS@"
- OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"
- 
--# The full absolute path to the main Singular library.
--LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)
--
- # Installation location of wheels. This is determined at configuration time
- # and does not depend on the installation location of sage-conf.
- SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels"
-diff --git a/src/sage/env.py b/src/sage/env.py
-index 911f34b..93f79de 100644
---- a/src/sage/env.py
-+++ b/src/sage/env.py
-@@ -229,12 +229,6 @@ NTL_LIBDIR = var("NTL_LIBDIR")
- LIE_INFO_DIR = var("LIE_INFO_DIR", join(SAGE_LOCAL, "lib", "LiE"))
- SINGULAR_BIN = var("SINGULAR_BIN") or "Singular"
- 
--# The path to libSingular, to be passed to dlopen(). This will
--# typically be set to an absolute path in sage_conf, but the relative
--# fallback path here works on systems where dlopen() searches the
--# system's library locations.
--LIBSINGULAR_PATH = var("LIBSINGULAR_PATH", "libSingular.so")
--
- # OpenMP
- OPENMP_CFLAGS = var("OPENMP_CFLAGS", "")
- OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
--- 
-cgit v1.0-1-gd88e
-
-
-From 92e5a211c792f86f5325d601abfddf667da6a776 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 15:49:26 -0300
-Subject: Revert "src/sage/interfaces/gap_workspace.py: Use hash of GAP_SO to
- disambiguate the workspace file, not SAGE_LOCAL"
-
-This reverts commit a801e6d85bd420b60ea75b1671856eb43ac6b18b.
-
-See #33446.
----
- src/sage/interfaces/gap_workspace.py | 7 ++-----
- 1 file changed, 2 insertions(+), 5 deletions(-)
-
-diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
-index 33a87dd..953dc85 100644
---- a/src/sage/interfaces/gap_workspace.py
-+++ b/src/sage/interfaces/gap_workspace.py
-@@ -16,7 +16,7 @@ Support for (lib)GAP workspace files
- import os
- import time
- import hashlib
--from sage.env import DOT_SAGE, GAP_SO
-+from sage.env import DOT_SAGE, SAGE_LOCAL
- 
- 
- def gap_workspace_file(system="gap", name="workspace", dir=None):
-@@ -59,10 +59,7 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
-     if dir is None:
-         dir = os.path.join(DOT_SAGE, 'gap')
- 
--    if GAP_SO:
--        h = hashlib.sha1(GAP_SO.encode('utf-8')).hexdigest()
--    else:
--        h = 'unknown'
-+    h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
-     return os.path.join(dir, '%s-%s-%s' % (system, name, h))
- 
- 
--- 
-cgit v1.0-1-gd88e
-
-
-From b45e555b5711ae10d369b568333940c2aa771053 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Fri, 4 Mar 2022 16:38:49 -0300
-Subject: gap: remove GAP_SO, no longer needed
-
----
- src/sage/env.py | 75 ---------------------------------------------------------
- 1 file changed, 75 deletions(-)
-
-diff --git a/src/sage/env.py b/src/sage/env.py
-index 93f79de..c16a094 100644
---- a/src/sage/env.py
-+++ b/src/sage/env.py
-@@ -249,81 +249,6 @@ if SAGE_GAP_MEMORY is not None:
- SAGE_GAP_COMMAND = var('SAGE_GAP_COMMAND', _gap_cmd)
- 
- 
--def _get_shared_lib_path(*libnames: str) -> Optional[str]:
--    """
--    Return the full path to a shared library file installed in
--    ``$SAGE_LOCAL/lib`` or the directories associated with the
--    Python sysconfig.
--
--    This can also be passed more than one library name (e.g. for cases where
--    some library may have multiple names depending on the platform) in which
--    case the first one found is returned.
--
--    This supports most *NIX variants (in which ``lib<libname>.so`` is found
--    under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
--    extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
--    or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
--
--    For distributions like Debian that use a multiarch layout, we also try the
--    multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
--
--    This returns ``None`` if no matching library file could be found.
--
--    EXAMPLES::
--
--        sage: from sage.env import _get_shared_lib_path
--        sage: "gap" in _get_shared_lib_path("gap")
--        True
--        sage: _get_shared_lib_path("an_absurd_lib") is None
--        True
--
--    """
--
--    for libname in libnames:
--        search_directories: List[Path] = []
--        patterns: List[str] = []
--        if sys.platform == 'cygwin':
--            # Later down we take the first matching DLL found, so search
--            # SAGE_LOCAL first so that it takes precedence
--            if SAGE_LOCAL:
--                search_directories.append(Path(SAGE_LOCAL) / 'bin')
--            search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
--            # Note: The following is not very robust, since if there are multible
--            # versions for the same library this just selects one more or less
--            # at arbitrary. However, practically speaking, on Cygwin, there
--            # will only ever be one version
--            patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
--        else:
--            if sys.platform == 'darwin':
--                ext = 'dylib'
--            else:
--                ext = 'so'
--
--            if SAGE_LOCAL:
--                search_directories.append(Path(SAGE_LOCAL) / 'lib')
--            libdir = sysconfig.get_config_var('LIBDIR')
--            if libdir is not None:
--                libdir = Path(libdir)
--                search_directories.append(libdir)
--
--                multiarchlib = sysconfig.get_config_var('MULTIARCH')
--                if multiarchlib is not None:
--                    search_directories.append(libdir / multiarchlib),
--
--            patterns = [f'lib{libname}.{ext}']
--
--        for directory in search_directories:
--            for pattern in patterns:
--                path = next(directory.glob(pattern), None)
--                if path is not None:
--                    return str(path.resolve())
--
--    # Just return None if no files were found
--    return None
--
--# locate libgap shared object
--GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
--
- # post process
- if DOT_SAGE is not None and ' ' in DOT_SAGE:
-     if UNAME[:6] == 'CYGWIN':
--- 
-cgit v1.0-1-gd88e
-
-
-From 31e3fc4ec8b8687bccd22d2e3161c86cf5553e06 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Mar 2022 12:10:37 -0300
-Subject: gap_workspace_file: include hostname and gap version
-
----
- src/sage/interfaces/gap_workspace.py | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
-index 953dc85..8c03b6b 100644
---- a/src/sage/interfaces/gap_workspace.py
-+++ b/src/sage/interfaces/gap_workspace.py
-@@ -16,7 +16,8 @@ Support for (lib)GAP workspace files
- import os
- import time
- import hashlib
--from sage.env import DOT_SAGE, SAGE_LOCAL
-+import subprocess
-+from sage.env import DOT_SAGE, SAGE_LOCAL, HOSTNAME, GAP_ROOT_DIR
- 
- 
- def gap_workspace_file(system="gap", name="workspace", dir=None):
-@@ -59,8 +60,12 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
-     if dir is None:
-         dir = os.path.join(DOT_SAGE, 'gap')
- 
--    h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
--    return os.path.join(dir, '%s-%s-%s' % (system, name, h))
-+    data = SAGE_LOCAL
-+    sysinfo = os.path.join(GAP_ROOT_DIR, "sysinfo.gap")
-+    if os.path.exists(sysinfo):
-+        data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
-+    h = hashlib.sha1(data.encode('utf-8')).hexdigest()
-+    return os.path.join(dir, '%s-%s-%s-%s' % (system, name, HOSTNAME, h))
- 
- 
- def prepare_workspace_dir(dir=None):
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch b/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
deleted file mode 100644
index 70b1fed99ce4..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-01-python_3.11-de38bac21e2.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From de38bac21e276c6dba95b8b33f7457a0ac56bdeb Mon Sep 17 00:00:00 2001
-From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
-Date: Tue, 25 Oct 2022 19:43:53 -0700
-Subject: [PATCH] src/sage: Apply python-3.11.patch from
- https://github.com/void-linux/void-packages/commit/6229f313450ecae88743b4d5e99da2ed4de44e07
-
----
- src/sage/cpython/cython_metaclass.h | 2 +-
- src/sage/libs/gmp/pylong.pyx        | 8 +++-----
- src/sage/symbolic/ginac/numeric.cpp | 1 -
- 3 files changed, 4 insertions(+), 7 deletions(-)
-
-diff --git a/src/sage/cpython/cython_metaclass.h b/src/sage/cpython/cython_metaclass.h
-index cc620a4dac7..6487342b71e 100644
---- a/src/sage/cpython/cython_metaclass.h
-+++ b/src/sage/cpython/cython_metaclass.h
-@@ -66,7 +66,7 @@ static CYTHON_INLINE int Sage_PyType_Ready(PyTypeObject* t)
-         }
- 
-         /* Now, set t.__class__ to metaclass */
--        Py_TYPE(t) = metaclass;
-+        Py_SET_TYPE(t, metaclass);
-         PyType_Modified(t);
-     }
-     else
-diff --git a/src/sage/libs/gmp/pylong.pyx b/src/sage/libs/gmp/pylong.pyx
-index 388be32c55e..e772b60e3e0 100644
---- a/src/sage/libs/gmp/pylong.pyx
-+++ b/src/sage/libs/gmp/pylong.pyx
-@@ -32,7 +32,7 @@ from cpython.longintrepr cimport _PyLong_New, py_long, digit, PyLong_SHIFT
- from .mpz cimport *
- 
- cdef extern from *:
--    Py_ssize_t* Py_SIZE_PTR "&Py_SIZE"(object)
-+    void Py_SET_SIZE(object, Py_ssize_t)
-     int hash_bits """
-         #ifdef _PyHASH_BITS
-         _PyHASH_BITS         /* Python 3 */
-@@ -57,10 +57,8 @@ cdef mpz_get_pylong_large(mpz_srcptr z):
-     mpz_export(L.ob_digit, NULL,
-             -1, sizeof(digit), 0, PyLong_nails, z)
-     if mpz_sgn(z) < 0:
--        # Set correct size (use a pointer to hack around Cython's
--        # non-support for lvalues).
--        sizeptr = Py_SIZE_PTR(L)
--        sizeptr[0] = -pylong_size
-+        # Set correct size
-+        Py_SET_SIZE(L, -pylong_size)
-     return L
- 
- 
-diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp
-index 22060441760..b40ed64edb5 100644
---- a/src/sage/symbolic/ginac/numeric.cpp
-+++ b/src/sage/symbolic/ginac/numeric.cpp
-@@ -52,7 +52,6 @@
- #define register
- #define PY_SSIZE_T_CLEAN
- #include <Python.h>
--#include <longintrepr.h>
- #include "flint/fmpz.h"
- #include "flint/fmpz_factor.h"
- 
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch b/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
deleted file mode 100644
index 0bb1f5f68b0e..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-02-python_3.11-argspec-fix-9eb08f3afde.patch
+++ /dev/null
@@ -1,168 +0,0 @@
-From 9eb08f3afde3266bbd667e196513240a0fe245f4 Mon Sep 17 00:00:00 2001
-From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
-Date: Tue, 25 Oct 2022 22:52:56 -0700
-Subject: [PATCH] inspect.ArgSpec -> inspect.FullArgSpec
-
----
- src/sage/misc/cachefunc.pyx         |  4 ++--
- src/sage/misc/decorators.py         |  6 ++++--
- src/sage/misc/function_mangling.pyx |  2 +-
- src/sage/misc/sageinspect.py        | 24 +++++++++++++-----------
- 4 files changed, 20 insertions(+), 16 deletions(-)
-
-diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx
-index 9fa967ce737..72042ef13d6 100644
---- a/src/sage/misc/cachefunc.pyx
-+++ b/src/sage/misc/cachefunc.pyx
-@@ -2818,7 +2818,7 @@ cdef class CachedMethod():
-                 except Exception:
-                     pass
-             if self.nargs == 0:
--                args, varargs, keywords, defaults = sage_getargspec(f)
-+                args, varargs, keywords, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-                 if varargs is None and keywords is None and len(args)<=1:
-                     self.nargs = 1
-                 else:
-@@ -2954,7 +2954,7 @@ cdef class CachedSpecialMethod(CachedMethod):
-         # we need to analyse the argspec
-         f = self._cachedfunc.f
-         if self.nargs == 0:
--            args, varargs, keywords, defaults = sage_getargspec(f)
-+            args, varargs, keywords, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-             if varargs is None and keywords is None and len(args)<=1:
-                 self.nargs = 1
-                 Caller = CachedMethodCallerNoArgs(inst, f, name=name, do_pickle=self._cachedfunc.do_pickle)
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 28c52448813..311a5105739 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -32,7 +32,8 @@ from copy import copy
- 
- from sage.misc.sageinspect import (sage_getsource, sage_getsourcelines,
-                                    sage_getargspec)
--from inspect import ArgSpec
-+
-+from inspect import FullArgSpec
- 
- 
- def sage_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
-@@ -499,7 +500,8 @@ class options():
-                     list(self.options))
-             defaults = (argspec.defaults or ()) + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
-+            return FullArgSpec(args, argspec.varargs, argspec.keywords, defaults,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
-         wrapper._sage_argspec_ = argspec
- 
-diff --git a/src/sage/misc/function_mangling.pyx b/src/sage/misc/function_mangling.pyx
-index 0ac03cf0715..e1bb7978953 100644
---- a/src/sage/misc/function_mangling.pyx
-+++ b/src/sage/misc/function_mangling.pyx
-@@ -116,7 +116,7 @@ cdef class ArgumentFixer:
-     """
-     def __init__(self, f, classmethod = False):
-         try:
--            arg_names, varargs, varkw, defaults = sage_getargspec(f)
-+            arg_names, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
-         except AttributeError:
-             # This error occurs if f is defined in a Cython file and the
-             # source file has gone.
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index fbca2defc20..a3821cb56b9 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -359,7 +359,7 @@ def _extract_embedded_signature(docstring, name):
-         docstring = L[1] if len(L) > 1 else ''  # Remove first line, keep the rest
-         def_string = "def " + name + signature + ": pass"
-         try:
--            return docstring, inspect.ArgSpec(*_sage_getargspec_cython(def_string))
-+            return docstring, inspect.FullArgSpec(*_sage_getargspec_cython(def_string))
-         except SyntaxError:
-             docstring = os.linesep.join(L)
-     return docstring, None
-@@ -1135,8 +1135,9 @@ def _sage_getargspec_from_ast(source):
-     vararg = getattr(ast_args.vararg, 'arg', None)
-     kwarg = getattr(ast_args.kwarg, 'arg', None)
- 
--    return inspect.ArgSpec(args, vararg, kwarg,
--                           tuple(defaults) if defaults else None)
-+    return inspect.FullArgSpec(args, vararg, kwarg,
-+                               tuple(defaults) if defaults else None,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
- 
- def _sage_getargspec_cython(source):
-@@ -1152,7 +1153,7 @@ def _sage_getargspec_cython(source):
- 
-     OUTPUT:
- 
--    - an instance of :obj:`inspect.ArgSpec`, i.e., a named tuple
-+    - an instance of :class:`inspect.FullArgSpec`, i.e., a named tuple
- 
-     EXAMPLES::
- 
-@@ -1662,11 +1663,11 @@ def sage_getargspec(obj):
-         return sage_getargspec(obj.__call__)
-     if isinstance(obj, (lazy_attribute, AbstractMethod)):
-         source = sage_getsource(obj)
--        return inspect.ArgSpec(*_sage_getargspec_cython(source))
-+        return inspect.FullArgSpec(*_sage_getargspec_cython(source))
-     if not callable(obj):
-         raise TypeError("obj is not a code object")
-     try:
--        return inspect.ArgSpec(*obj._sage_argspec_())
-+        return inspect.FullArgSpec(*obj._sage_argspec_())
-     except (AttributeError, TypeError):
-         pass
-     # If we are lucky, the function signature is embedded in the docstring.
-@@ -1682,7 +1683,7 @@ def sage_getargspec(obj):
-         # Note that this may give a wrong result for the constants!
-         try:
-             args, varargs, varkw = inspect.getargs(obj.__code__)
--            return inspect.ArgSpec(args, varargs, varkw, obj.__defaults__)
-+            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__)
-         except (TypeError, AttributeError):
-             pass
-     if isclassinstance(obj):
-@@ -1717,7 +1718,7 @@ def sage_getargspec(obj):
-         except TypeError: # happens for Python builtins
-             source = ''
-         if source:
--            return inspect.ArgSpec(*_sage_getargspec_cython(source))
-+            return inspect.FullArgSpec(*_sage_getargspec_cython(source))
-         else:
-             func_obj = obj
- 
-@@ -1730,7 +1731,7 @@ def sage_getargspec(obj):
-         except TypeError: # arg is not a code object
-             # The above "hopefully" was wishful thinking:
-             try:
--                return inspect.ArgSpec(*_sage_getargspec_cython(sage_getsource(obj)))
-+                return inspect.FullArgSpec(*_sage_getargspec_cython(sage_getsource(obj)))
-             except TypeError: # This happens for Python builtins
-                 # The best we can do is to return a generic argspec
-                 args = []
-@@ -1740,7 +1741,8 @@ def sage_getargspec(obj):
-         defaults = func_obj.__defaults__
-     except AttributeError:
-         defaults = None
--    return inspect.ArgSpec(args, varargs, varkw, defaults)
-+    return inspect.FullArgSpec(args, varargs, varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults={}, annotations={})
- 
- 
- def formatannotation(annotation, base_module=None):
-@@ -1811,7 +1813,7 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
-     :func:`sage_getargspec`. Since :func:`sage_getargspec` works for
-     Cython functions while Python's inspect module does not, it makes
-     sense to keep this function for formatting instances of
--    ``inspect.ArgSpec``.
-+    ``inspect.FullArgSpec``.
- 
-     EXAMPLES::
- 
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch b/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
deleted file mode 100644
index cd2fa11622c3..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-03-python3.11-final_fixes-7b6fa565f42.patch
+++ /dev/null
@@ -1,1279 +0,0 @@
-From 8955607c71cb94e4a810b89f113b7b220a351417 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Nov 2022 11:26:10 -0300
-Subject: [PATCH 01/11] dict_del_by_value: move python internal definitions to
- a separate file
-
----
- src/sage/cpython/dict_del_by_value.pyx | 153 ++++++++---------------
- src/sage/cpython/dict_internal.h       | 165 +++++++++++++++++++++++++
- 2 files changed, 214 insertions(+), 104 deletions(-)
- create mode 100644 src/sage/cpython/dict_internal.h
-
-diff --git a/src/sage/cpython/dict_del_by_value.pyx b/src/sage/cpython/dict_del_by_value.pyx
-index 488bf9c84cc..3894554c13d 100644
---- a/src/sage/cpython/dict_del_by_value.pyx
-+++ b/src/sage/cpython/dict_del_by_value.pyx
-@@ -19,13 +19,8 @@ AUTHORS:
- #                  https://www.gnu.org/licenses/
- # ****************************************************************************
- 
--import weakref
--from weakref import KeyedRef
--
- from cpython.list cimport PyList_New
--from cpython cimport Py_XINCREF, Py_XDECREF
- 
--from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
- cdef extern from "Python.h":
-     ctypedef struct PyDictKeysObject
- 
-@@ -34,99 +29,47 @@ cdef extern from "Python.h":
-         PyDictKeysObject * ma_keys
-         PyObject ** ma_values
- 
--    #we need this redefinition because we want to be able to call
--    #PyWeakref_GetObject with borrowed references. This is the recommended
--    #strategy according to Cython/Includes/cpython/__init__.pxd
--    PyObject* PyWeakref_GetObject(PyObject * wr)
-     int PyList_SetItem(object list, Py_ssize_t index, PyObject * item) except -1
--    int PyWeakref_Check(PyObject * ob)
--####
--#definitions replicated from CPython's Objects/dict-common.h
--#(this file is not exported from CPython, so we need to be
--#careful the definitions are in step with what happens there.
--
--ctypedef void* dict_lookup_func  # Precise definition not needed
--
--ctypedef union IndexBlock:
--    int8_t as_1[8]
--    int16_t as_2[4]
--    int32_t as_4[2]
--    int64_t as_8[1]
--
--ctypedef struct MyPyDictKeysObject:
--    Py_ssize_t dk_refcnt
--    Py_ssize_t dk_size
--    dict_lookup_func dk_lookup
--    Py_ssize_t dk_usable
--    Py_ssize_t dk_nentries
--    IndexBlock dk_indices
--
--ctypedef struct PyDictKeyEntry:
--    Py_hash_t me_hash
--    PyObject * me_key
--    PyObject * me_value
--
--cdef Py_ssize_t DKIX_EMPTY = -1
--cdef Py_ssize_t DKIX_DUMMY = -2
--cdef Py_ssize_t DKIX_ERROR = -3
--
--#####
--#These routines are copied from CPython's Object/dictobject.c
--#in order to access PyDictKeysObject fields
--
--cdef inline int DK_IXSIZE(MyPyDictKeysObject *keys):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        return 1
--    elif s <= 0xffff:
--        return 2
--    elif s <= 0xffffffff:
--        return 4
--    else:
--        return 8
--
--cdef inline PyDictKeyEntry * DK_ENTRIES(MyPyDictKeysObject *keys):
--    return <PyDictKeyEntry*> &(keys.dk_indices.as_1[keys.dk_size * DK_IXSIZE(keys)])
--
--cdef inline Py_ssize_t dk_get_index(MyPyDictKeysObject *keys, Py_ssize_t i):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        return keys.dk_indices.as_1[i]
--    elif s <= 0xffff:
--        return keys.dk_indices.as_2[i]
--    elif s <= 0xffffffff:
--        return keys.dk_indices.as_4[i]
--    else:
--        return keys.dk_indices.as_8[i]
--
--cdef inline void dk_set_index(MyPyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix):
--    cdef Py_ssize_t s = keys.dk_size
--    if s <= 0xff:
--        keys.dk_indices.as_1[i] = ix
--    elif s <= 0xffff:
--        keys.dk_indices.as_2[i] = ix
--    elif s <= 0xffffffff:
--        keys.dk_indices.as_4[i] = ix
--    else:
--        keys.dk_indices.as_8[i] = ix
--
--#End of replication of Object/dictobject.c
--######
--
--cdef dict_lookup_func lookdict
--
--cdef dict_lookup_func DK_LOOKUP(PyDictObject *mp):
--    return (<MyPyDictKeysObject *>(mp.ma_keys)).dk_lookup
--
--def init_lookdict():
--    global lookdict
--    # A dict which a non-string key uses the generic "lookdict"
--    # as lookup function
--    cdef object D = {}
--    D[0] = 0
--    lookdict = DK_LOOKUP(<PyDictObject *>D)
--
--init_lookdict()
-+
-+cdef extern from "dict_internal.h":
-+    Py_ssize_t DK_MASK(PyDictKeysObject *)
-+    PyDictKeyEntry * DK_ENTRIES(PyDictKeysObject *keys)
-+
-+    Py_ssize_t dictkeys_get_index (PyDictKeysObject *keys, Py_ssize_t i)
-+    void dictkeys_set_index (PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+
-+    Py_ssize_t DKIX_EMPTY, DKIX_DUMMY
-+    int PERTURB_SHIFT
-+
-+    ctypedef struct PyDictKeyEntry:
-+        Py_hash_t me_hash
-+        PyObject * me_key
-+        PyObject * me_value
-+
-+
-+# dk_lookup was removed in python 3.11
-+DEF HAS_DK_LOOKUP = PY_VERSION_HEX < 0x30b0000
-+
-+IF HAS_DK_LOOKUP:
-+
-+    cdef extern from *:
-+        """
-+        #define DK_LOOKUP(dk) ((dk)->dk_lookup)
-+        """
-+        ctypedef void * dict_lookup_func  # Precise definition not needed
-+        dict_lookup_func DK_LOOKUP(PyDictKeysObject *mp)
-+
-+    cdef dict_lookup_func lookdict
-+
-+    def init_lookdict():
-+        global lookdict
-+        # A dict which a non-string key uses the generic "lookdict"
-+        # as lookup function
-+        cdef object D = {}
-+        D[0] = 0
-+        lookdict = DK_LOOKUP((<PyDictObject *>D).ma_keys)
-+
-+    init_lookdict()
- 
- cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_t hash) except -1:
-     """
-@@ -177,9 +120,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-         sage: for i in range(10^3+10): newA = A(); M[newA] = prev; prev = newA
-         sage: del a
-     """
--    keys = <MyPyDictKeysObject *>(mp.ma_keys)
-+    keys = mp.ma_keys
-     cdef size_t perturb
--    cdef size_t mask = <size_t> keys.dk_size-1
-+    cdef size_t mask = DK_MASK(keys)
-     cdef PyDictKeyEntry *entries = DK_ENTRIES(keys)
-     cdef PyDictKeyEntry *ep
- 
-@@ -187,7 +130,7 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-         raise TypeError("del_dictitem_by_exact_value cannot be applied to a shared key dict")
- 
-     cdef size_t i = <size_t>hash & mask
--    ix = dk_get_index(keys, i)
-+    ix = dictkeys_get_index(keys, i)
- 
-     if ix == DKIX_EMPTY:
-         # key not found
-@@ -196,9 +139,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-     ep = &(entries[ix])
-     perturb = hash
-     while (ep.me_value != value or ep.me_hash != hash):
--        perturb = perturb >> 5 #this is the value of PERTURB_SHIFT
-+        perturb = perturb >> PERTURB_SHIFT
-         i = mask & (i * 5 + perturb + 1)
--        ix = dk_get_index(keys, i)
-+        ix = dictkeys_get_index(keys, i)
-         if ix == DKIX_EMPTY:
-             # key not found
-             return 0
-@@ -206,7 +149,9 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
- 
-     # We need the lookup function to be the generic lookdict, otherwise
-     # deletions may not work correctly
--    keys.dk_lookup = lookdict
-+    IF HAS_DK_LOOKUP:
-+        # Can this fail? In any case dk_lookup was removed in python 3.11
-+        assert DK_LOOKUP(keys) is lookdict
- 
-     T = PyList_New(2)
-     PyList_SetItem(T, 0, ep.me_key)
-@@ -214,7 +159,7 @@ cdef int del_dictitem_by_exact_value(PyDictObject *mp, PyObject *value, Py_hash_
-     ep.me_key = NULL
-     ep.me_value = NULL
-     mp.ma_used -= 1
--    dk_set_index(keys, i, DKIX_DUMMY)
-+    dictkeys_set_index(keys, i, DKIX_DUMMY)
-     #We have transferred the to-be-deleted references to the list T
-     #we now delete the list so that the actual decref happens through a
-     #deallocation routine that uses the Python Trashcan macros to
-diff --git a/src/sage/cpython/dict_internal.h b/src/sage/cpython/dict_internal.h
-new file mode 100644
-index 00000000000..06c7a16b275
---- /dev/null
-+++ b/src/sage/cpython/dict_internal.h
-@@ -0,0 +1,165 @@
-+/* This contains internal definitions for python dictionaries,
-+ * mostly copied from cpython sourcecode.
-+ *
-+ * Moved here to make it easier to maintain in the face of python
-+ * changes.
-+ * */
-+
-+/************************************************************/
-+/* Copied verbatim from cpython 3.8 (Objects/dict-common.h) */
-+/************************************************************/
-+
-+#ifndef Py_DICT_COMMON_H
-+#define Py_DICT_COMMON_H
-+
-+typedef struct {
-+    /* Cached hash code of me_key. */
-+    Py_hash_t me_hash;
-+    PyObject *me_key;
-+    PyObject *me_value; /* This field is only meaningful for combined tables */
-+} PyDictKeyEntry;
-+
-+/* dict_lookup_func() returns index of entry which can be used like DK_ENTRIES(dk)[index].
-+ * -1 when no entry found, -3 when compare raises error.
-+ */
-+typedef Py_ssize_t (*dict_lookup_func)
-+    (PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr);
-+
-+#define DKIX_EMPTY (-1)
-+#define DKIX_DUMMY (-2)  /* Used internally */
-+#define DKIX_ERROR (-3)
-+
-+/* See dictobject.c for actual layout of DictKeysObject */
-+struct _dictkeysobject {
-+    Py_ssize_t dk_refcnt;
-+
-+    /* Size of the hash table (dk_indices). It must be a power of 2. */
-+    Py_ssize_t dk_size;
-+
-+    /* Function to lookup in the hash table (dk_indices):
-+
-+       - lookdict(): general-purpose, and may return DKIX_ERROR if (and
-+         only if) a comparison raises an exception.
-+
-+       - lookdict_unicode(): specialized to Unicode string keys, comparison of
-+         which can never raise an exception; that function can never return
-+         DKIX_ERROR.
-+
-+       - lookdict_unicode_nodummy(): similar to lookdict_unicode() but further
-+         specialized for Unicode string keys that cannot be the <dummy> value.
-+
-+       - lookdict_split(): Version of lookdict() for split tables. */
-+    dict_lookup_func dk_lookup;
-+
-+    /* Number of usable entries in dk_entries. */
-+    Py_ssize_t dk_usable;
-+
-+    /* Number of used entries in dk_entries. */
-+    Py_ssize_t dk_nentries;
-+
-+    /* Actual hash table of dk_size entries. It holds indices in dk_entries,
-+       or DKIX_EMPTY(-1) or DKIX_DUMMY(-2).
-+
-+       Indices must be: 0 <= indice < USABLE_FRACTION(dk_size).
-+
-+       The size in bytes of an indice depends on dk_size:
-+
-+       - 1 byte if dk_size <= 0xff (char*)
-+       - 2 bytes if dk_size <= 0xffff (int16_t*)
-+       - 4 bytes if dk_size <= 0xffffffff (int32_t*)
-+       - 8 bytes otherwise (int64_t*)
-+
-+       Dynamically sized, SIZEOF_VOID_P is minimum. */
-+    char dk_indices[];  /* char is required to avoid strict aliasing. */
-+
-+    /* "PyDictKeyEntry dk_entries[dk_usable];" array follows:
-+       see the DK_ENTRIES() macro */
-+};
-+
-+#endif
-+
-+
-+/***********************************************************/
-+/* Copied verbatim from cpython 3.8 (Objects/dictobject.c) */
-+/***********************************************************/
-+
-+#define PERTURB_SHIFT 5
-+#define DK_SIZE(dk) ((dk)->dk_size)
-+#if SIZEOF_VOID_P > 4
-+#define DK_IXSIZE(dk)                          \
-+    (DK_SIZE(dk) <= 0xff ?                     \
-+        1 : DK_SIZE(dk) <= 0xffff ?            \
-+            2 : DK_SIZE(dk) <= 0xffffffff ?    \
-+                4 : sizeof(int64_t))
-+#else
-+#define DK_IXSIZE(dk)                          \
-+    (DK_SIZE(dk) <= 0xff ?                     \
-+        1 : DK_SIZE(dk) <= 0xffff ?            \
-+            2 : sizeof(int32_t))
-+#endif
-+#define DK_ENTRIES(dk) \
-+    ((PyDictKeyEntry*)(&((int8_t*)((dk)->dk_indices))[DK_SIZE(dk) * DK_IXSIZE(dk)]))
-+
-+#define DK_MASK(dk) (((dk)->dk_size)-1)
-+
-+/* lookup indices.  returns DKIX_EMPTY, DKIX_DUMMY, or ix >=0 */
-+static inline Py_ssize_t
-+dictkeys_get_index(PyDictKeysObject *keys, Py_ssize_t i)
-+{
-+    Py_ssize_t s = DK_SIZE(keys);
-+    Py_ssize_t ix;
-+
-+    if (s <= 0xff) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    else if (s <= 0xffff) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (s > 0xffffffff) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    assert(ix >= DKIX_DUMMY);
-+    return ix;
-+}
-+
-+/* write to indices. */
-+static inline void
-+dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+{
-+    Py_ssize_t s = DK_SIZE(keys);
-+
-+    assert(ix >= DKIX_DUMMY);
-+
-+    if (s <= 0xff) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        assert(ix <= 0x7f);
-+        indices[i] = (char)ix;
-+    }
-+    else if (s <= 0xffff) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fff);
-+        indices[i] = (int16_t)ix;
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (s > 0xffffffff) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        indices[i] = ix;
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fffffff);
-+        indices[i] = (int32_t)ix;
-+    }
-+}
-+
-+/************************************************************/
--- 
-2.38.1
-
-
-From 76040803c8ae150baef449edce67ebdafb2ee896 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Sun, 6 Nov 2022 11:53:24 -0300
-Subject: [PATCH 02/11] dict_del_by_value: add internal definitions for python
- 3.11
-
----
- src/sage/cpython/dict_internal.h | 77 ++++++++++++++++++++++++++++++++
- 1 file changed, 77 insertions(+)
-
-diff --git a/src/sage/cpython/dict_internal.h b/src/sage/cpython/dict_internal.h
-index 06c7a16b275..42a57bcb468 100644
---- a/src/sage/cpython/dict_internal.h
-+++ b/src/sage/cpython/dict_internal.h
-@@ -5,6 +5,8 @@
-  * changes.
-  * */
- 
-+#if PY_VERSION_HEX < 0x30b0000
-+
- /************************************************************/
- /* Copied verbatim from cpython 3.8 (Objects/dict-common.h) */
- /************************************************************/
-@@ -163,3 +165,78 @@ dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
- }
- 
- /************************************************************/
-+
-+#else   /* Python >= 3.11 */
-+
-+#define Py_BUILD_CORE
-+#include <internal/pycore_dict.h>
-+
-+/************************************************************/
-+/* Copied verbatim from cpython 3.11 (Objects/dictobject.c) */
-+/************************************************************/
-+
-+#define PERTURB_SHIFT 5
-+#define DK_MASK(dk) (DK_SIZE(dk)-1)
-+
-+/* lookup indices.  returns DKIX_EMPTY, DKIX_DUMMY, or ix >=0 */
-+static inline Py_ssize_t
-+dictkeys_get_index(const PyDictKeysObject *keys, Py_ssize_t i)
-+{
-+    int log2size = DK_LOG_SIZE(keys);
-+    Py_ssize_t ix;
-+
-+    if (log2size < 8) {
-+        const int8_t *indices = (const int8_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    else if (log2size < 16) {
-+        const int16_t *indices = (const int16_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (log2size >= 32) {
-+        const int64_t *indices = (const int64_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+#endif
-+    else {
-+        const int32_t *indices = (const int32_t*)(keys->dk_indices);
-+        ix = indices[i];
-+    }
-+    assert(ix >= DKIX_DUMMY);
-+    return ix;
-+}
-+
-+/* write to indices. */
-+static inline void
-+dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix)
-+{
-+    int log2size = DK_LOG_SIZE(keys);
-+
-+    assert(ix >= DKIX_DUMMY);
-+    assert(keys->dk_version == 0);
-+
-+    if (log2size < 8) {
-+        int8_t *indices = (int8_t*)(keys->dk_indices);
-+        assert(ix <= 0x7f);
-+        indices[i] = (char)ix;
-+    }
-+    else if (log2size < 16) {
-+        int16_t *indices = (int16_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fff);
-+        indices[i] = (int16_t)ix;
-+    }
-+#if SIZEOF_VOID_P > 4
-+    else if (log2size >= 32) {
-+        int64_t *indices = (int64_t*)(keys->dk_indices);
-+        indices[i] = ix;
-+    }
-+#endif
-+    else {
-+        int32_t *indices = (int32_t*)(keys->dk_indices);
-+        assert(ix <= 0x7fffffff);
-+        indices[i] = (int32_t)ix;
-+    }
-+}
-+
-+#endif
--- 
-2.38.1
-
-
-From 014c2ac9a6f6de25d4e31fe0bdaf819e9c67d24b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 06:47:18 -0300
-Subject: [PATCH 03/11] deprecated uu -> base64
-
----
- src/sage/rings/polynomial/pbori/gbrefs.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/rings/polynomial/pbori/gbrefs.py b/src/sage/rings/polynomial/pbori/gbrefs.py
-index 76e3924715d..70dc795cbab 100644
---- a/src/sage/rings/polynomial/pbori/gbrefs.py
-+++ b/src/sage/rings/polynomial/pbori/gbrefs.py
-@@ -1,6 +1,6 @@
- import gzip
- from io import StringIO
--import uu
-+import base64 as uu
- import re
- from types import ModuleType
- from .PyPolyBoRi import Polynomial
--- 
-2.38.1
-
-
-From dc8e155994a870a5e0b01a690a3fec8975197973 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 06:47:34 -0300
-Subject: [PATCH 04/11] sage.misc.fpickle: fix for python 3.11
-
----
- src/sage/misc/fpickle.pyx | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/src/sage/misc/fpickle.pyx b/src/sage/misc/fpickle.pyx
-index 502080e2c10..c5d544765bb 100644
---- a/src/sage/misc/fpickle.pyx
-+++ b/src/sage/misc/fpickle.pyx
-@@ -34,6 +34,12 @@ def reduce_code(co):
-         sage: def foo(N): return N+1
-         sage: sage.misc.fpickle.reduce_code(foo.__code__)
-         (<cyfunction code_ctor at ...>, ...)
-+
-+    Test that the constructed code matches the original code:
-+
-+        sage: ctor, args = sage.misc.fpickle.reduce_code(foo.__code__)
-+        sage: ctor(*args) == foo.__code__
-+        True
-     """
-     if co.co_freevars or co.co_cellvars:
-         raise ValueError("Cannot pickle code objects from closures")
-@@ -44,7 +50,12 @@ def reduce_code(co):
-     co_args += (co.co_kwonlyargcount, co.co_nlocals,
-                 co.co_stacksize, co.co_flags, co.co_code,
-                 co.co_consts, co.co_names, co.co_varnames, co.co_filename,
--                co.co_name, co.co_firstlineno, co.co_lnotab)
-+                co.co_name)
-+    if sys.version_info.minor >= 11:
-+        co_args += (co.co_qualname, co.co_firstlineno,
-+                    co.co_linetable, co.co_exceptiontable)
-+    else:
-+        co_args += (co.co_firstlineno, co.co_lnotab)
- 
-     return (code_ctor, co_args)
- 
--- 
-2.38.1
-
-
-From 8b0dac2322d4a888c607c56d3b5a72ff71df4147 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 08:15:43 -0300
-Subject: [PATCH 05/11] Fix FullArgSpec usage after
- 9eb08f3afde3266bbd667e196513240a0fe245f4
-
- - `kwonlydefaults` default is `[]` rather than `{}`
- - `argspec.keywords` changed to `argspec.varkw`
- - `ArgSpec` changed to `FullArgSpec`
----
- src/sage/coding/abstract_code.py | 2 +-
- src/sage/misc/decorators.py      | 7 ++++---
- src/sage/misc/sageinspect.py     | 9 +++++----
- 3 files changed, 10 insertions(+), 8 deletions(-)
-
-diff --git a/src/sage/coding/abstract_code.py b/src/sage/coding/abstract_code.py
-index ba2ec68a038..238a165c021 100644
---- a/src/sage/coding/abstract_code.py
-+++ b/src/sage/coding/abstract_code.py
-@@ -123,7 +123,7 @@ def _explain_constructor(cl):
-         reqs = "The constructor requires the arguments {}.".format(args)
-     else:
-         reqs = "The constructor requires no arguments."
--    if argspec.varargs or argspec.keywords:
-+    if argspec.varargs or argspec.varkw:
-         var = "It accepts unspecified arguments as well.\n"
-     else:
-         var = ""
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 311a5105739..271e243050f 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -423,7 +423,8 @@ class suboptions():
-             defaults = (argspec.defaults if argspec.defaults is not None else ()) \
-                         + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
-+            return FullArgSpec(args, argspec.varargs, argspec.varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
-         wrapper._sage_argspec_ = argspec
- 
-         return wrapper
-@@ -500,8 +501,8 @@ class options():
-                     list(self.options))
-             defaults = (argspec.defaults or ()) + tuple(self.options.values())
-             # Note: argspec.defaults is not always a tuple for some reason
--            return FullArgSpec(args, argspec.varargs, argspec.keywords, defaults,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+            return FullArgSpec(args, argspec.varargs, argspec.varkw, defaults,
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         wrapper._sage_argspec_ = argspec
- 
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index a3821cb56b9..ce9a74f931d 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -1137,7 +1137,7 @@ def _sage_getargspec_from_ast(source):
- 
-     return inspect.FullArgSpec(args, vararg, kwarg,
-                                tuple(defaults) if defaults else None,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
- def _sage_getargspec_cython(source):
-@@ -1683,7 +1683,8 @@ def sage_getargspec(obj):
-         # Note that this may give a wrong result for the constants!
-         try:
-             args, varargs, varkw = inspect.getargs(obj.__code__)
--            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__)
-+            return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__,
-+                                       kwonlyargs=[], kwonlydefaults=None, annotations={})
-         except (TypeError, AttributeError):
-             pass
-     if isclassinstance(obj):
-@@ -1742,7 +1743,7 @@ def sage_getargspec(obj):
-     except AttributeError:
-         defaults = None
-     return inspect.FullArgSpec(args, varargs, varkw, defaults,
--                               kwonlyargs=[], kwonlydefaults={}, annotations={})
-+                               kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
- def formatannotation(annotation, base_module=None):
-@@ -1788,7 +1789,7 @@ def formatannotation(annotation, base_module=None):
- 
- 
- def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
--                       kwonlyargs=(), kwonlydefaults={}, annotations={},
-+                       kwonlyargs=(), kwonlydefaults=None, annotations={},
-                        formatarg=str,
-                        formatvarargs=lambda name: '*' + name,
-                        formatvarkw=lambda name: '**' + name,
--- 
-2.38.1
-
-
-From db45aebfd6bd8413bec0fda218410d72deacd398 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 07:13:38 -0300
-Subject: [PATCH 06/11] warnings: ignore deprecation for 'import cgi' in cython
-
----
- src/sage/all.py | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index 6aef26c42a9..92d36d1fd26 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -104,6 +104,11 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message='The distutils(.sysconfig module| package) is deprecated',
-                         module='Cython|distutils|numpy|sage.env|sage.features')
- 
-+# triggered by cython 0.29.32
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message="'cgi' is deprecated and slated for removal in Python 3.13",
-+                        module='Cython')
-+
- ################ end setup warnings ###############################
- 
- 
--- 
-2.38.1
-
-
-From 664fc008ed50c2f61fb3df3020c0d81b41170628 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 20:39:12 -0300
-Subject: [PATCH 07/11] warnings: ignore deprecation for 'import sre_constants'
- in pyparsing
-
----
- src/sage/all.py | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index 92d36d1fd26..ea0712308b4 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -109,6 +109,11 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message="'cgi' is deprecated and slated for removal in Python 3.13",
-                         module='Cython')
- 
-+# triggered by pyparsing 2.4.7
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message="module 'sre_constants' is deprecated",
-+                        module='pyparsing')
-+
- ################ end setup warnings ###############################
- 
- 
--- 
-2.38.1
-
-
-From 08e1161c23caeeed5ad0e0237df8172eb8806ee5 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:40:17 -0300
-Subject: [PATCH 08/11] warnings: ignore deprecation of
- importlib.resources.path/read_binary
-
----
- src/sage/all.py                    | 6 ++++++
- src/sage/repl/display/formatter.py | 3 +++
- 2 files changed, 9 insertions(+)
-
-diff --git a/src/sage/all.py b/src/sage/all.py
-index ea0712308b4..fedf2a17aab 100644
---- a/src/sage/all.py
-+++ b/src/sage/all.py
-@@ -114,6 +114,12 @@ warnings.filterwarnings('ignore', category=DeprecationWarning,
-                         message="module 'sre_constants' is deprecated",
-                         module='pyparsing')
- 
-+# importlib.resources.path and ...read_binary are deprecated in python 3.11,
-+# but the replacement importlib.resources.files needs python 3.9
-+warnings.filterwarnings('ignore', category=DeprecationWarning,
-+                        message=r'(path|read_binary) is deprecated\. Use files\(\) instead\.',
-+                        module='sage.repl.rich_output.output_(graphics|graphics3d|video)')
-+
- ################ end setup warnings ###############################
- 
- 
-diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py
-index 488f0bf2791..7e06656d880 100644
---- a/src/sage/repl/display/formatter.py
-+++ b/src/sage/repl/display/formatter.py
-@@ -143,6 +143,9 @@ class SageDisplayFormatter(DisplayFormatter):
- 
-             sage: import os
-             sage: import importlib.resources
-+            sage: import warnings
-+            sage: warnings.filterwarnings('ignore', category=DeprecationWarning,
-+            ....:     message=r'path is deprecated\. Use files\(\) instead\.')
-             sage: from sage.repl.rich_output.backend_ipython import BackendIPython
-             sage: backend = BackendIPython()
-             sage: shell = get_test_shell()
--- 
-2.38.1
-
-
-From 44480f4827e2bc1ed8daf6f4504a22ae6e8be4a4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 07:14:01 -0300
-Subject: [PATCH 09/11] doctests: fixes due to ArgSpec -> FullArgSpec change
-
----
- src/sage/interfaces/singular.py            |  3 +-
- src/sage/libs/singular/standard_options.py |  3 +-
- src/sage/misc/cachefunc.pyx                |  6 +-
- src/sage/misc/decorators.py                |  9 ++-
- src/sage/misc/lazy_import.pyx              |  4 +-
- src/sage/misc/sageinspect.py               | 94 ++++++++++------------
- src/sage/parallel/decorate.py              |  3 +-
- src/sage/plot/plot3d/plot3d.py             | 18 +++--
- src/sage/sets/set_from_iterator.py         |  4 +-
- 9 files changed, 76 insertions(+), 68 deletions(-)
-
-diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
-index 9c9586d8bc7..1dea77cdff0 100644
---- a/src/sage/interfaces/singular.py
-+++ b/src/sage/interfaces/singular.py
-@@ -2734,7 +2734,8 @@ def singular_gb_standard_options(func):
-         sage: P.<x,y> = QQ[]
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.interreduced_basis)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getsourcelines(I.interreduced_basis)
-         (['    @handle_AA_and_QQbar\n',
-           '    @singular_gb_standard_options\n',
-diff --git a/src/sage/libs/singular/standard_options.py b/src/sage/libs/singular/standard_options.py
-index 6797cb05001..5d74da3ce3a 100644
---- a/src/sage/libs/singular/standard_options.py
-+++ b/src/sage/libs/singular/standard_options.py
-@@ -117,7 +117,8 @@ def libsingular_gb_standard_options(func):
-         sage: P.<x,y> = QQ[]
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.interreduced_basis)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getsourcelines(I.interreduced_basis)
-         (['    @handle_AA_and_QQbar\n',
-           '    @singular_gb_standard_options\n',
-diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx
-index 72042ef13d6..cea3071115d 100644
---- a/src/sage/misc/cachefunc.pyx
-+++ b/src/sage/misc/cachefunc.pyx
-@@ -931,9 +931,9 @@ cdef class CachedFunction():
-             sage: I = P*[x,y]
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(I.groebner_basis)   # indirect doctest
--            ArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
--            varargs='args', keywords='kwds', defaults=('', None, None,
--            False))
-+            FullArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
-+                        varargs='args', varkw='kwds', defaults=('', None, None, False),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         """
-         return sage_getargspec(self.f)
-diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
-index 271e243050f..dd9123f5004 100644
---- a/src/sage/misc/decorators.py
-+++ b/src/sage/misc/decorators.py
-@@ -93,7 +93,8 @@ def sage_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
-         5
-         sage: from sage.misc.sageinspect import sage_getargspec
-         sage: sage_getargspec(g)
--        ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['x'], varargs=None, varkw=None, defaults=None,
-+                    kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Demonstrate that it correctly gets the source lines and the source
-     file, which is essential for interactive code edition; note that we
-@@ -392,7 +393,8 @@ class suboptions():
- 
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(f)
--            ArgSpec(args=['arrow_size'], varargs='args', keywords='kwds', defaults=(2,))
-+            FullArgSpec(args=['arrow_size'], varargs='args', varkw='kwds', defaults=(2,),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         @sage_wraps(func)
-         def wrapper(*args, **kwds):
-@@ -460,7 +462,8 @@ class options():
-             sage: f1 = o(f)
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(f1)
--            ArgSpec(args=['rgbcolor'], varargs='args', keywords='kwds', defaults=((0, 0, 1),))
-+            FullArgSpec(args=['rgbcolor'], varargs='args', varkw='kwds', defaults=((0, 0, 1),),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         self.options = options
-         self.original_opts = options.pop('__original_opts', False)
-diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx
-index 2d4413cd1a3..018078b0cf2 100644
---- a/src/sage/misc/lazy_import.pyx
-+++ b/src/sage/misc/lazy_import.pyx
-@@ -351,7 +351,9 @@ cdef class LazyImport():
-             sage: from sage.misc.lazy_import import LazyImport
-             sage: rm = LazyImport('sage.all', 'random_matrix')
-             sage: rm._sage_argspec_()
--            ArgSpec(args=['ring', 'nrows', 'ncols', 'algorithm', 'implementation'], varargs='args', keywords='kwds', defaults=(None, 'randomize', None))
-+            FullArgSpec(args=['ring', 'nrows', 'ncols', 'algorithm', 'implementation'],
-+                        varargs='args', varkw='kwds', defaults=(None, 'randomize', None),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         return sageinspect.sage_getargspec(self.get_object())
- 
-diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
-index ce9a74f931d..619ff6da661 100644
---- a/src/sage/misc/sageinspect.py
-+++ b/src/sage/misc/sageinspect.py
-@@ -109,7 +109,7 @@ defined Cython code, and with rather tricky argument lines::
-     sage: print(sage_getsource(foo))                                                                        # optional - sage.misc.cython
-     def foo(unsigned int x=1, a=')"', b={not (2+1==3):'bar'}, *args, **kwds): return
-     sage: sage_getargspec(foo)                                                                              # optional - sage.misc.cython
--    ArgSpec(args=['x', 'a', 'b'], varargs='args', keywords='kwds', defaults=(1, ')"', {False: 'bar'}))
-+    FullArgSpec(args=['x', 'a', 'b'], varargs='args', varkw='kwds', defaults=(1, ')"', {False: 'bar'}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- """
- 
-@@ -343,7 +343,7 @@ def _extract_embedded_signature(docstring, name):
-         File: sage/misc/nested_class.pyx (starting at line ...)
-         ...
-         sage: _extract_embedded_signature(MainClass.NestedClass.NestedSubClass.dummy.__doc__, 'dummy')[1]
--        ArgSpec(args=['self', 'x', 'r'], varargs='args', keywords='kwds', defaults=((1, 2, 3.4),))
-+        FullArgSpec(args=['self', 'x', 'r'], varargs='args', varkw='kwds', defaults=((1, 2, 3.4),), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _extract_embedded_signature(range.__call__.__doc__, '__call__')
-         ('Call self as a function.', None)
-     """
-@@ -1107,22 +1107,18 @@ def _sage_getargspec_from_ast(source):
- 
-     EXAMPLES::
- 
--        sage: import warnings
--        sage: warnings.filterwarnings('ignore',
--        ....:                         r'inspect.getargspec\(\) is deprecated',
--        ....:                         DeprecationWarning)
-         sage: import inspect, sage.misc.sageinspect as sms
-         sage: from_ast = sms._sage_getargspec_from_ast
-         sage: s = "def f(a, b=2, c={'a': [4, 5.5, False]}, d=(None, True)):\n    return"
-         sage: from_ast(s)
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)))
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: context = {}
-         sage: exec(compile(s, '<string>', 'single'), context)
--        sage: inspect.getargspec(context['f'])
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)))
--        sage: from_ast(s) == inspect.getargspec(context['f'])
-+        sage: inspect.getfullargspec(context['f'])
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(2, {'a': [4, 5.5, False]}, (None, True)), kwonlyargs=[], kwonlydefaults=None, annotations={})
-+        sage: from_ast(s) == inspect.getfullargspec(context['f'])
-         True
--        sage: set(from_ast(sms.sage_getsource(x)) == inspect.getargspec(x) for x in [factor, identity_matrix, Graph.__init__])
-+        sage: set(from_ast(sms.sage_getsource(x)) == inspect.getfullargspec(x) for x in [factor, identity_matrix, Graph.__init__])
-         {True}
-     """
-     ast_args = ast.parse(source.lstrip()).body[0].args
-@@ -1159,23 +1155,23 @@ def _sage_getargspec_cython(source):
- 
-         sage: from sage.misc.sageinspect import _sage_getargspec_cython as sgc
-         sage: sgc("cpdef double abc(self, Element x=None, Parent base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc("def __init__(self, x=None, unsigned int base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def o(p, r={}, *q, **s) except? -1:')
--        ArgSpec(args=['p', 'r'], varargs='q', keywords='s', defaults=({},))
-+        FullArgSpec(args=['p', 'r'], varargs='q', varkw='s', defaults=({},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('cpdef how(r=(None, "u:doing?")):')
--        ArgSpec(args=['r'], varargs=None, keywords=None, defaults=((None, 'u:doing?'),))
-+        FullArgSpec(args=['r'], varargs=None, varkw=None, defaults=((None, 'u:doing?'),), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def _(x="):"):')
--        ArgSpec(args=['x'], varargs=None, keywords=None, defaults=('):',))
-+        FullArgSpec(args=['x'], varargs=None, varkw=None, defaults=('):',), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(z = {(1, 2, 3): True}):\n    return z')
--        ArgSpec(args=['z'], varargs=None, keywords=None, defaults=({(1, 2, 3): True},))
-+        FullArgSpec(args=['z'], varargs=None, varkw=None, defaults=({(1, 2, 3): True},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(double x, z = {(1, 2, 3): True}):\n    return z')
--        ArgSpec(args=['x', 'z'], varargs=None, keywords=None, defaults=({(1, 2, 3): True},))
-+        FullArgSpec(args=['x', 'z'], varargs=None, varkw=None, defaults=({(1, 2, 3): True},), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(*args): pass')
--        ArgSpec(args=[], varargs='args', keywords=None, defaults=None)
-+        FullArgSpec(args=[], varargs='args', varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sgc('def f(**args): pass')
--        ArgSpec(args=[], varargs=None, keywords='args', defaults=None)
-+        FullArgSpec(args=[], varargs=None, varkw='args', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Some malformed input is detected::
- 
-@@ -1207,17 +1203,17 @@ def _sage_getargspec_cython(source):
- 
-         sage: def dummy_python(self, *args, x=1): pass
-         sage: sgc("def dummy_python(self, *args, x=1): pass")
--        ArgSpec(args=['self', 'x'], varargs='args', keywords=None, defaults=(1,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: cython("def dummy_cython(self, *args, x=1): pass")
-         sage: sgc("def dummy_cython(self, *args, x=1): pass")
--        ArgSpec(args=['self', 'x'], varargs='args', keywords=None, defaults=(1,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In some examples above, a syntax error was raised when a type
-     definition contains a pointer. An exception is made for ``char*``,
-     since C strings are acceptable input in public Cython functions::
- 
-         sage: sgc('def f(char *x = "a string", z = {(1,2,3): True}): pass')
--        ArgSpec(args=['x', 'z'], varargs=None, keywords=None, defaults=('a string', {(1, 2, 3): True}))
-+        FullArgSpec(args=['x', 'z'], varargs=None, varkw=None, defaults=('a string', {(1, 2, 3): True}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
- 
-     AUTHORS:
-@@ -1503,40 +1499,40 @@ def sage_getargspec(obj):
-         sage: def f(x, y, z=1, t=2, *args, **keywords):
-         ....:     pass
-         sage: sage_getargspec(f)
--        ArgSpec(args=['x', 'y', 'z', 't'], varargs='args', keywords='keywords', defaults=(1, 2))
-+        FullArgSpec(args=['x', 'y', 'z', 't'], varargs='args', varkw='keywords', defaults=(1, 2), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     We now run sage_getargspec on some functions from the Sage library::
- 
-         sage: sage_getargspec(identity_matrix)
--        ArgSpec(args=['ring', 'n', 'sparse'], varargs=None, keywords=None, defaults=(0, False))
-+        FullArgSpec(args=['ring', 'n', 'sparse'], varargs=None, varkw=None, defaults=(0, False), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(factor)
--        ArgSpec(args=['n', 'proof', 'int_', 'algorithm', 'verbose'], varargs=None, keywords='kwds', defaults=(None, False, 'pari', 0))
-+        FullArgSpec(args=['n', 'proof', 'int_', 'algorithm', 'verbose'], varargs=None, varkw='kwds', defaults=(None, False, 'pari', 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In the case of a class or a class instance, the ``ArgSpec`` of the
-     ``__new__``, ``__init__`` or ``__call__`` method is returned::
- 
-         sage: P.<x,y> = QQ[]
-         sage: sage_getargspec(P)
--        ArgSpec(args=['base_ring', 'n', 'names', 'order'], varargs=None, keywords=None, defaults=('degrevlex',))
-+        FullArgSpec(args=['base_ring', 'n', 'names', 'order'], varargs=None, varkw=None, defaults=('degrevlex',), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(P.__class__)
--        ArgSpec(args=['self', 'x'], varargs='args', keywords='kwds', defaults=(0,))
-+        FullArgSpec(args=['self', 'x'], varargs='args', varkw='kwds', defaults=(0,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following tests against various bugs that were fixed in
-     :trac:`9976`::
- 
-         sage: from sage.rings.polynomial.real_roots import bernstein_polynomial_factory_ratlist
-         sage: sage_getargspec(bernstein_polynomial_factory_ratlist.coeffs_bitsize)
--        ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: from sage.rings.polynomial.pbori.pbori import BooleanMonomialMonoid
-         sage: sage_getargspec(BooleanMonomialMonoid.gen)
--        ArgSpec(args=['self', 'i'], varargs=None, keywords=None, defaults=(0,))
-+        FullArgSpec(args=['self', 'i'], varargs=None, varkw=None, defaults=(0,), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: I = P*[x,y]
-         sage: sage_getargspec(I.groebner_basis)
--        ArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
--        varargs='args', keywords='kwds', defaults=('', None, None, False))
-+        FullArgSpec(args=['self', 'algorithm', 'deg_bound', 'mult_bound', 'prot'],
-+        varargs='args', varkw='kwds', defaults=('', None, None, False), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: cython("cpdef int foo(x,y) except -1: return 1")
-         sage: sage_getargspec(foo)
--        ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['x', 'y'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     If a ``functools.partial`` instance is involved, we see no other meaningful solution
-     than to return the argspec of the underlying function::
-@@ -1546,7 +1542,7 @@ def sage_getargspec(obj):
-         sage: import functools
-         sage: f1 = functools.partial(f, 1,c=2)
-         sage: sage_getargspec(f1)
--        ArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, keywords=None, defaults=(1,))
-+        FullArgSpec(args=['a', 'b', 'c', 'd'], varargs=None, varkw=None, defaults=(1,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     TESTS:
- 
-@@ -1572,14 +1568,14 @@ def sage_getargspec(obj):
-         sage: print(sage.misc.sageinspect.sage_getsource(O))
-         def foo(x, a=')"', b={(2+1):'bar', not 1:3, 3<<4:5}): return
-         sage: spec = sage.misc.sageinspect.sage_getargspec(O)
--        sage: spec.args, spec.varargs, spec.keywords
-+        sage: spec.args, spec.varargs, spec.varkw
-         (['x', 'a', 'b'], None, None)
-         sage: spec.defaults[0]
-         ')"'
-         sage: sorted(spec.defaults[1].items(), key=lambda x: str(x))
-         [(3, 'bar'), (48, 5), (False, 3)]
-         sage: sage.misc.sageinspect.sage_getargspec(O.__call__)
--        ArgSpec(args=['self', 'm', 'n'], varargs=None, keywords=None, defaults=None)
-+        FullArgSpec(args=['self', 'm', 'n'], varargs=None, varkw=None, defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     ::
- 
-@@ -1588,13 +1584,13 @@ def sage_getargspec(obj):
-         def foo(x, a='\')"', b={not (2+1==3):'bar'}): return
-         <BLANKLINE>
-         sage: sage.misc.sageinspect.sage_getargspec(foo)
--        ArgSpec(args=['x', 'a', 'b'], varargs=None, keywords=None, defaults=('\')"', {False: 'bar'}))
-+        FullArgSpec(args=['x', 'a', 'b'], varargs=None, varkw=None, defaults=('\')"', {False: 'bar'}), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following produced a syntax error before the patch at :trac:`11913`,
-     see also :trac:`26906`::
- 
-         sage: sage.misc.sageinspect.sage_getargspec(r.lm)                         # optional - rpy2
--        ArgSpec(args=['self'], varargs='args', keywords='kwds', defaults=None)
-+        FullArgSpec(args=['self'], varargs='args', varkw='kwds', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     The following was fixed in :trac:`16309`::
- 
-@@ -1608,23 +1604,23 @@ def sage_getargspec(obj):
-         ....:     cpdef meet(categories, bint as_list = False, tuple ignore_axioms=(), tuple axioms=()): pass
-         ....: ''')
-         sage: sage_getargspec(Foo.join)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(Bar.join)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: sage_getargspec(Bar.meet)
--        ArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, keywords=None, defaults=(False, (), ()))
-+        FullArgSpec(args=['categories', 'as_list', 'ignore_axioms', 'axioms'], varargs=None, varkw=None, defaults=(False, (), ()), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test that :trac:`17009` is fixed::
- 
-         sage: sage_getargspec(gap)
--        ArgSpec(args=['self', 'x', 'name'], varargs=None, keywords=None, defaults=(None,))
-+        FullArgSpec(args=['self', 'x', 'name'], varargs=None, varkw=None, defaults=(None,), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     By :trac:`17814`, the following gives the correct answer (previously, the
-     defaults would have been found ``None``)::
- 
-         sage: from sage.misc.nested_class import MainClass
-         sage: sage_getargspec(MainClass.NestedClass.NestedSubClass.dummy)
--        ArgSpec(args=['self', 'x', 'r'], varargs='args', keywords='kwds', defaults=((1, 2, 3.4),))
-+        FullArgSpec(args=['self', 'x', 'r'], varargs='args', varkw='kwds', defaults=((1, 2, 3.4),), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     In :trac:`18249` was decided to return a generic signature for Python
-     builtin functions, rather than to raise an error (which is what Python's
-@@ -1632,7 +1628,7 @@ def sage_getargspec(obj):
- 
-         sage: import inspect
-         sage: sage_getargspec(range)
--        ArgSpec(args=[], varargs='args', keywords='kwds', defaults=None)
-+        FullArgSpec(args=[], varargs='args', varkw='kwds', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test that :trac:`28524` is fixed::
- 
-@@ -1819,14 +1815,10 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
-     EXAMPLES::
- 
-         sage: from sage.misc.sageinspect import sage_formatargspec
--        sage: from inspect import formatargspec # deprecated in Python 3
-         sage: args = ['a', 'b', 'c']
-         sage: defaults = [3]
-         sage: sage_formatargspec(args, defaults=defaults)
-         '(a, b, c=3)'
--        sage: import warnings; warnings.simplefilter('ignore')  # ignore DeprecationWarning
--        sage: formatargspec(args, defaults=defaults) == sage_formatargspec(args, defaults=defaults)
--        True
-     """
-     def formatargandannotation(arg):
-         result = formatarg(arg)
-@@ -2649,11 +2641,11 @@ def __internal_tests():
-     Test _sage_getargspec_cython with multiple default arguments and a type::
- 
-         sage: _sage_getargspec_cython("def init(self, x=None, base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _sage_getargspec_cython("def __init__(self, x=None, base=0):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords=None, defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw=None, defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
-         sage: _sage_getargspec_cython("def __init__(self, x=None, unsigned int base=0, **keys):")
--        ArgSpec(args=['self', 'x', 'base'], varargs=None, keywords='keys', defaults=(None, 0))
-+        FullArgSpec(args=['self', 'x', 'base'], varargs=None, varkw='keys', defaults=(None, 0), kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-     Test _extract_embedded_position:
- 
-diff --git a/src/sage/parallel/decorate.py b/src/sage/parallel/decorate.py
-index c14518af570..3a7152d5ac9 100644
---- a/src/sage/parallel/decorate.py
-+++ b/src/sage/parallel/decorate.py
-@@ -243,7 +243,8 @@ for a in args[0]))
-             ....:     return x + y
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(p(f))
--            ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['x', 'y'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         from sage.misc.sageinspect import sage_getargspec
-         return sage_getargspec(self.func)
-diff --git a/src/sage/plot/plot3d/plot3d.py b/src/sage/plot/plot3d/plot3d.py
-index 64b11a0442a..174765980f7 100644
---- a/src/sage/plot/plot3d/plot3d.py
-+++ b/src/sage/plot/plot3d/plot3d.py
-@@ -329,19 +329,24 @@ class _Coordinates():
-             sage: t1,t2,t3=T.to_cartesian(lambda a,b: 2*a+b)
-             sage: from sage.misc.sageinspect import sage_getargspec
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: sage_getargspec(t2)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: sage_getargspec(t3)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-             sage: def g(a,b): return 2*a+b
-             sage: t1,t2,t3=T.to_cartesian(g)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: t1,t2,t3=T.to_cartesian(2*a+b)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['a', 'b'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
- 
-         If we cannot guess the right parameter names, then the
-         parameters are named `u` and `v`::
-@@ -352,7 +357,8 @@ class _Coordinates():
-             sage: T = _ArbitraryCoordinates((x + y, x - y, z), z,[x,y])
-             sage: t1,t2,t3=T.to_cartesian(operator.add)
-             sage: sage_getargspec(t1)
--            ArgSpec(args=['u', 'v'], varargs=None, keywords=None, defaults=None)
-+            FullArgSpec(args=['u', 'v'], varargs=None, varkw=None, defaults=None,
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-             sage: [h(1,2) for h in T.to_cartesian(operator.mul)]
-             [3.0, -1.0, 2.0]
-             sage: [h(u=1,v=2) for h in T.to_cartesian(operator.mul)]
-diff --git a/src/sage/sets/set_from_iterator.py b/src/sage/sets/set_from_iterator.py
-index 3a2360383ea..74015c4433d 100644
---- a/src/sage/sets/set_from_iterator.py
-+++ b/src/sage/sets/set_from_iterator.py
-@@ -526,7 +526,9 @@ class Decorator():
-             sage: d = Decorator()
-             sage: d.f = find_local_minimum
-             sage: sage_getargspec(d) # indirect doctest
--            ArgSpec(args=['f', 'a', 'b', 'tol', 'maxfun'], varargs=None, keywords=None, defaults=(1.48e-08, 500))
-+            FullArgSpec(args=['f', 'a', 'b', 'tol', 'maxfun'],
-+                        varargs=None, varkw=None, defaults=(1.48e-08, 500),
-+                        kwonlyargs=[], kwonlydefaults=None, annotations={})
-         """
-         from sage.misc.sageinspect import sage_getargspec
-         return sage_getargspec(self.f)
--- 
-2.38.1
-
-
-From 482dd1ac3d2bcaa94dd935e3add1a5165674b146 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:12:38 -0300
-Subject: [PATCH 10/11] doctests: AssertionError message changed in python 3.11
-
----
- src/sage/misc/lazy_format.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/misc/lazy_format.py b/src/sage/misc/lazy_format.py
-index e3050695b25..b58ea155862 100644
---- a/src/sage/misc/lazy_format.py
-+++ b/src/sage/misc/lazy_format.py
-@@ -78,7 +78,7 @@ class LazyFormat(str):
-         ....:               LazyFormat("%s is wrong")%IDontLikeBeingPrinted())
-         Traceback (most recent call last):
-         ...
--        AssertionError: <unprintable AssertionError object>
-+        AssertionError: ...
-     """
- 
-     def __mod__(self, args):
--- 
-2.38.1
-
-
-From 7b6fa565f426e28e14be3b22c202301f9d530e9e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
-Date: Mon, 31 Oct 2022 22:13:13 -0300
-Subject: [PATCH 11/11] doctests: message added more info in python 3.11
-
----
- src/sage/repl/attach.py | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/sage/repl/attach.py b/src/sage/repl/attach.py
-index 39da6ee4acd..20b848e4f04 100644
---- a/src/sage/repl/attach.py
-+++ b/src/sage/repl/attach.py
-@@ -54,6 +54,7 @@ character-by-character::
-         exec(code, globals)
-       File ".../foobar.sage....py", line ..., in <module>
-         raise ValueError("third")   # this should appear in the source snippet
-+    ...
-     ValueError: third
-     sage: detach(src)
- """
--- 
-2.38.1
-
diff --git a/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch b/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
deleted file mode 100644
index 4c26dfdb6843..000000000000
--- a/srcpkgs/sagemath/patches/trac-33842-04-python3.11_fix_32_bit.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
-index b0c80f61480..1c9a53387a0 100644
---- a/src/sage/arith/long.pxd
-+++ b/src/sage/arith/long.pxd
-@@ -124,7 +124,7 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         ....:         if err == 0:
-         ....:             return value
-         ....:         elif err == ERR_OVERFLOW:
--        ....:             raise OverflowError("integer_check_long: overflow")
-+        ....:             raise OverflowError(f"integer_check_long: overflow ({x})")
-         ....:     elif err == ERR_TYPE:
-         ....:         raise TypeError("integer_check_long: wrong type")
-         ....:     elif err == ERR_INDEX:
-@@ -136,24 +136,23 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         ....: def long_max():
-         ....:     return smallInteger(LONG_MAX)
-         ....: ''')
--        sage: types = (ZZ, QQ, int)
-         sage: L = [1, 12345, 10^9, 2^30, long_max()//9, long_max()//3, long_max()]
-         sage: L += [-x for x in L] + [0, long_min()]
-         sage: for v in L:
--        ....:     for t in (Integer, int):
-+        ....:     for t in (Integer, int, QQ):
-         ....:         assert check_long(t(v)) == v
-         sage: check_long(2^100)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long(long_max() + 1)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long(long_min() - 1)
-         Traceback (most recent call last):
-         ...
--        OverflowError: integer_check_long: overflow
-+        OverflowError: integer_check_long: overflow (...)
-         sage: check_long("hello")
-         Traceback (most recent call last):
-         ...
-@@ -162,6 +161,36 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
-         Traceback (most recent call last):
-         ...
-         TypeError: integer_check_long: bad __index__
-+
-+    Repeat the overflow tests with python integers:
-+
-+        sage: check_long(int(2^100))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(int(long_max() + 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(int(long_min() - 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+
-+    And again with rationals:
-+
-+        sage: check_long(QQ(2^100))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(QQ(long_max() + 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-+        sage: check_long(QQ(long_min() - 1))
-+        Traceback (most recent call last):
-+        ...
-+        OverflowError: integer_check_long: overflow (...)
-     """
-     cdef int c = integer_check_long_py(x, value, err)
-     if c:
-@@ -193,35 +222,93 @@ cdef inline long dig(const digit* D, int n):
- 
- cdef inline bint integer_check_long_py(x, long* value, int* err):
-     """
--    Part of ``integer_check_long`` in ``long.pxd``, checking only for
--    Python objects of type ``int`` and ``long``. See that function for
--    documentation and tests.
-+    Return whether ``x`` is a python object of type ``int``.
-+
-+    If possible, compute the value of this integer as C long and store
-+    it in ``*value``.
-+
-+    Errors are returned as an error indicator ``*err`` (without raising
-+    any Python exception).
-+
-+    Possible errors when returning ``True``:
-+
-+    - ``0``: ``x`` was successfully converted to a C long and its value
-+      is stored in ``*value``.
-+
-+    - ``ERR_OVERFLOW``: ``x`` is a python object of type ``int`` but
-+      too large to store in a C long.
-+
-+    Possible errors when returning ``False``:
-+
-+    - ``ERR_TYPE``: ``x`` is not a python object of type ``int``.
-+
-+    EXAMPLES:
-+
-+    We create a pure Python wrapper of this function::
-+
-+        sage: cython('''  # optional - sage.misc.cython
-+        ....: from sage.arith.long cimport *
-+        ....: def check_long_py(x):
-+        ....:     cdef long value
-+        ....:     cdef int err
-+        ....:     cdef bint c = integer_check_long_py(x, &value, &err)
-+        ....:     if c:
-+        ....:         if err == 0:
-+        ....:             return value
-+        ....:         elif err == ERR_OVERFLOW:
-+        ....:             return f"Overflow ({x})"
-+        ....:     elif err == ERR_TYPE:
-+        ....:         return f"Bad type ({x})"
-+        ....:     return f"This should never happen ({x})"
-+        ....: from libc.limits cimport LONG_MIN, LONG_MAX
-+        ....: def long_min():
-+        ....:     return LONG_MIN
-+        ....: def long_max():
-+        ....:     return LONG_MAX
-+        ....: ''')
-+        sage: L = [1, 12345, 10^9, 2^30, long_max()//9, long_max()//3, long_max()]
-+        sage: L += [-x for x in L] + [0, long_min()]
-+        sage: for v in L:
-+        ....:     assert check_long_py(int(v)) == v
-+        sage: check_long_py(int(2^100))
-+        'Overflow (...)'
-+        sage: check_long_py(int(long_max() + 1))
-+        'Overflow (...)'
-+        sage: check_long_py(int(long_min() - 1))
-+        'Overflow (...)'
-+        sage: check_long_py(389)
-+        'Bad type (...)'
-+        sage: check_long_py("hello")
-+        'Bad type (...)'
-+        sage: check_long_py(2/3)
-+        'Bad type (...)'
-     """
--    if not isinstance(x, long):
--        if isinstance(x, int):
--            # This can happen only on Python 2
--            value[0] = PyInt_AS_LONG(x)
--            err[0] = 0
--            return 1
-+    if not isinstance(x, int):
-         err[0] = ERR_TYPE
-         return 0
- 
--    # x is a Python "long" (called "int" on Python 3)
-+    # x is a Python "int" (aka PyLongObject or py_long in cython)
-     cdef const digit* D = (<py_long>x).ob_digit
-     cdef Py_ssize_t size = Py_SIZE(x)
- 
--    # We assume that PyLong_SHIFT is 15 on a 32-bit system and 30 on a
--    # 64-bit system. This is not guaranteed by Python, but it is the
--    # default configuration.
-+    # We assume PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT.
-+    # This is true in all the default configurations:
-+    # - BITS_IN_LONG = 63, PyLong_SHIFT = 30
-+    # - BITS_IN_LONG = 31, PyLong_SHIFT = 15 (python <= 3.10)
-+    # - BITS_IN_LONG = 31, PyLong_SHIFT = 30 (new in python 3.11)
-+    # cf. https://trac.sagemath.org/ticket/33842#comment:130
-     #
--    # This way, we know that 1 and 2 digits certainly fit in a C long
--    # and 4 or more digits never fit. For 3 digits, we need an explicit
--    # overflow check.
-+    # This way, we know that 1 digit certainly fits in a C long
-+    # and 4 or more digits never fit.
-+    # For 2 or 3 digits, we need an explicit overflow check.
-     cdef int BITS_IN_LONG = 8 * sizeof(long) - 1
--    if not (2 * PyLong_SHIFT <= BITS_IN_LONG < 4 * PyLong_SHIFT):
--        raise AssertionError
-+    if not (PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT):
-+        raise AssertionError(
-+                f"PyLong_SHIFT = {PyLong_SHIFT}, "
-+                f"BITS_IN_LONG = {BITS_IN_LONG}")
- 
-     cdef long lead
-+    cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
-     cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
-     if size == 0:
-         value[0] = 0
-@@ -233,9 +320,20 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
-         value[0] = -dig(D, 0)
-         err[0] = 0
-     elif size == 2:
-+        if BITS_IN_LONG < 2 * PyLong_SHIFT and D[1] >= lead_2_overflow:
-+            err[0] = ERR_OVERFLOW
-+            return 1
-         value[0] = dig(D, 0) + dig(D, 1)
-         err[0] = 0
-     elif size == -2:
-+        if BITS_IN_LONG < 2 * PyLong_SHIFT and D[1] >= lead_2_overflow:
-+            if D[0] == 0 and D[1] == lead_2_overflow:
-+                # Special case for LONG_MIN
-+                value[0] = (<long>-1) << BITS_IN_LONG
-+                err[0] = 0
-+            else:
-+                err[0] = ERR_OVERFLOW
-+            return 1
-         value[0] = -(dig(D, 0) + dig(D, 1))
-         err[0] = 0
-     elif size == 3:
diff --git a/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch b/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
deleted file mode 100644
index 977a42400e59..000000000000
--- a/srcpkgs/sagemath/patches/trac-34118-update_sympy_to_1.11.1-5db5d4e56243c609f44afc1f21c112b026f9e1fe.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-commit 5db5d4e56243c609f44afc1f21c112b026f9e1fe
-Author: Oscar Benjamin <oscar.j.benjamin@gmail.com>
-Date:   Mon Jul 11 21:24:01 2022 +0100
-
-    Update doctests for SymPy 1.11
-    
-    Doctests related to SymPy's rsolve function are updated in:
-    
-    src/sage/calculus/test_sympy.py
-    src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-    
-    The form of the output from SymPy has changed since
-    
-    https://github.com/sympy/sympy/pull/23567
-
-diff --git a/src/sage/calculus/test_sympy.py b/src/sage/calculus/test_sympy.py
-index 7cf7f3f6bfd..927e6ee4fb6 100644
---- a/src/sage/calculus/test_sympy.py
-+++ b/src/sage/calculus/test_sympy.py
-@@ -193,7 +193,7 @@ This was fixed in Sympy, see :trac:`14437`::
-     sage: u = Function('u')
-     sage: n = Symbol('n', integer=True)
-     sage: f = u(n+2) - u(n+1) + u(n)/4
--    sage: 2**n * rsolve(f,u(n))
--    C1*n + C0
-+    sage: expand(2**n * rsolve(f,u(n)))
-+    2*C1*n + C0
- 
- """
-diff --git a/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py b/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-index 1062f4f7e8c..f53f813d793 100644
---- a/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-+++ b/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
-@@ -382,7 +382,7 @@ Sage example in ./recequadiff.tex, line 1798::
-   sage: from sympy import rsolve_hyper
-   sage: from sympy.abc import n
-   sage: rsolve_hyper([-2,1],2**(n+2),n)
--  2**n*C0 + 2**(n + 2)*(C0 + n/2)
-+  2**n*C0 + 2**(n + 1)*n
- 
- """
- 
diff --git a/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch b/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
deleted file mode 100644
index b544a3eef7dd..000000000000
--- a/srcpkgs/sagemath/patches/trac-34391-upgrade_gap_4.12-a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e.patch
+++ /dev/null
@@ -1,526 +0,0 @@
-From aeff992d53a65a705dca5cd5216bcb97c218dce7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:14:03 +0200
-Subject: Adapt to API changes in OpenOutputStream and CloseOutput
-
----
- src/sage/libs/gap/element.pyx      | 5 +++--
- src/sage/libs/gap/gap_includes.pxd | 6 ++++--
- 2 files changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
-index be43c4c..e268116 100644
---- a/src/sage/libs/gap/element.pyx
-+++ b/src/sage/libs/gap/element.pyx
-@@ -130,6 +130,7 @@ cdef char *capture_stdout(Obj func, Obj obj):
-     """
-     cdef Obj s, stream, output_text_string
-     cdef UInt res
-+    cdef TypOutputFile output
-     # The only way to get a string representation of an object that is truly
-     # consistent with how it would be represented at the GAP REPL is to call
-     # ViewObj on it.  Unfortunately, ViewObj *prints* to the output stream,
-@@ -145,12 +146,12 @@ cdef char *capture_stdout(Obj func, Obj obj):
-         output_text_string = GAP_ValueGlobalVariable("OutputTextString")
-         stream = CALL_2ARGS(output_text_string, s, GAP_True)
- 
--        if not OpenOutputStream(stream):
-+        if not OpenOutputStream(&output, stream):
-             raise GAPError("failed to open output capture stream for "
-                            "representing GAP object")
- 
-         CALL_1ARGS(func, obj)
--        CloseOutput()
-+        CloseOutput(&output)
-         return CSTR_STRING(s)
-     finally:
-         GAP_Leave()
-diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd
-index 5a9ab48..34035fe 100644
---- a/src/sage/libs/gap/gap_includes.pxd
-+++ b/src/sage/libs/gap/gap_includes.pxd
-@@ -76,8 +76,10 @@ cdef extern from "gap/intobj.h" nogil:
- 
- 
- cdef extern from "gap/io.h" nogil:
--    UInt OpenOutputStream(Obj stream)
--    UInt CloseOutput()
-+    ctypedef struct TypOutputFile:
-+        pass
-+    UInt OpenOutputStream(TypOutputFile* output, Obj stream)
-+    UInt CloseOutput(TypOutputFile* output)
- 
- 
- cdef extern from "gap/libgap-api.h" nogil:
--- 
-cgit v1.0-1-gd88e
-
-
-From c3367b4290981e5e93b7a30c48b02f1ae3770dc8 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:14:53 +0200
-Subject: Disable colored prompt as it breaks the pexpect interface
-
----
- src/sage/interfaces/gap.py | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
-index c34fe53..569caa2 100644
---- a/src/sage/interfaces/gap.py
-+++ b/src/sage/interfaces/gap.py
-@@ -1512,6 +1512,8 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
-     """
-     # Create new workspace with filename WORKSPACE
-     g = Gap(use_workspace_cache=False, max_workspace_size=None)
-+    g.eval('ColorPrompt(false)')
-+    g.eval('SetUserPreference("UseColorPrompt", false)')
-     g.eval('SetUserPreference("HistoryMaxLines", 30)')
-     from sage.tests.gap_packages import all_installed_packages
-     for pkg in all_installed_packages(gap=g):
--- 
-cgit v1.0-1-gd88e
-
-
-From 3b63e998e4d6118fc86b13b940c8f3d3b8307a50 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:16:03 +0200
-Subject: Port NaturalHomomorphism uses
-
----
- src/sage/groups/abelian_gps/abelian_group_gap.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/sage/groups/abelian_gps/abelian_group_gap.py b/src/sage/groups/abelian_gps/abelian_group_gap.py
-index a4b0471..86090b4 100644
---- a/src/sage/groups/abelian_gps/abelian_group_gap.py
-+++ b/src/sage/groups/abelian_gps/abelian_group_gap.py
-@@ -338,7 +338,7 @@ class AbelianGroup_gap(UniqueRepresentation, GroupMixinLibGAP, ParentLibGAP, Abe
-         if isinstance(x, AbelianGroupElement_gap):
-             try:
-                 if x in self._cover:
--                    x = self.gap().NaturalHomomorphism().Image(x.gap())
-+                    x = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations).Image(x.gap())
-                 else:
-                     x = x.gap()
-             except AttributeError:
-@@ -1043,7 +1043,7 @@ class AbelianGroupQuotient_gap(AbelianGroup_gap):
-             From: Abelian group with gap, generator orders (4,)
-             To:   Quotient abelian group with generator orders (2,)
-         """
--        phi = self.gap().NaturalHomomorphism()
-+        phi = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations)
-         Hom = self._cover.Hom(self)
-         return Hom(phi)
- 
--- 
-cgit v1.0-1-gd88e
-
-
-From bc40764be044653e06f2da3497e1e05da08251f7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Mon, 29 Aug 2022 23:17:36 +0200
-Subject: Fix tests with GAP 4.12
-
----
- src/doc/en/thematic_tutorials/lie/weyl_groups.rst  | 12 ++++++------
- src/sage/coding/codecan/autgroup_can_label.pyx     |  2 +-
- src/sage/coding/linear_code.py                     | 22 +++++++++++-----------
- .../root_system/hecke_algebra_representation.py    |  2 +-
- src/sage/combinat/symmetric_group_algebra.py       |  2 +-
- src/sage/groups/finitely_presented.py              |  6 +++---
- src/sage/groups/fqf_orthogonal.py                  |  2 +-
- src/sage/groups/libgap_wrapper.pyx                 |  6 +++---
- .../perm_gps/partn_ref2/refinement_generic.pyx     |  2 +-
- src/sage/groups/perm_gps/permgroup.py              |  8 ++++----
- src/sage/libs/gap/libgap.pyx                       |  2 +-
- src/sage/libs/gap/util.pyx                         |  8 +-------
- src/sage/tests/gap_packages.py                     |  2 +-
- 13 files changed, 35 insertions(+), 41 deletions(-)
-
-diff --git a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-index c917338..182e74a 100644
---- a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-+++ b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
-@@ -139,12 +139,12 @@ string, which you can print::
-     X.1      1  1  1  1  1  1  1  1  1  1  1  1  1
-     X.2      1 -1  1  1 -1  1  1 -1 -1 -1  1  1  1
-     X.3      2  .  2 -1  .  2  2  .  .  . -1  2  2
--    X.4      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
--    X.5      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
--    X.6      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
--    X.7      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
--    X.8      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
--    X.9      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
-+    X.4      3 -1 -1  .  1  3 -1 -1 -1  1  . -1  3
-+    X.5      3  1 -1  . -1  3 -1  1  1 -1  . -1  3
-+    X.6      3 -1  3  . -1 -1 -1 -1  1  1  . -1  3
-+    X.7      3 -1 -1  .  1 -1  3 -1  1 -1  . -1  3
-+    X.8      3  1  3  .  1 -1 -1  1 -1 -1  . -1  3
-+    X.9      3  1 -1  . -1 -1  3  1 -1  1  . -1  3
-     X.10     4 -2  . -1  .  .  .  2  .  .  1  . -4
-     X.11     4  2  . -1  .  .  . -2  .  .  1  . -4
-     X.12     6  . -2  .  . -2 -2  .  .  .  .  2  6
-diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx
-index de5db98..c83b926 100644
---- a/src/sage/coding/codecan/autgroup_can_label.pyx
-+++ b/src/sage/coding/codecan/autgroup_can_label.pyx
-@@ -76,7 +76,7 @@ columns do share the same coloring::
-     ((1,),
-      (2,),
-      (3, 5, 4),
--     (6, 19, 16, 9, 21, 10, 8, 15, 14, 11, 20, 13, 12, 7, 17, 18))
-+     (6, 19, 16, 21, 9, 10, 15, 8, 20, 11, 14, 13, 7, 12, 18, 17))
- 
- We can also restrict the group action to linear isometries::
- 
-diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py
-index e8e32f8..9d45160 100644
---- a/src/sage/coding/linear_code.py
-+++ b/src/sage/coding/linear_code.py
-@@ -466,27 +466,27 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric):
-             0
-             sage: C = codes.HammingCode(GF(4, 'z'), 3)
-             sage: C.automorphism_group_gens()
--            ([((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
-+                Defn: z |--> z + 1),
-+              ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z + 1),
--              ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
--                Defn: z |--> z),
-               ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-              362880)
-             sage: C.automorphism_group_gens(equivalence="linear")
--            ([((z + 1, 1, z + 1, z + 1, z + 1, z, 1, z, 1, 1, 1, 1, z + 1, z + 1, z + 1, z, z, 1, z, z, z); (1,15,2,8,16,18,3)(4,9,12,13,20,10,11)(5,21,14,6,7,19,17), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((z + 1, z + 1, z + 1, z + 1, z + 1, 1, z, 1, z, z, z, 1, z, 1, 1, 1, z + 1, z + 1, z + 1, 1, z); (1,15,21,8,9)(2,18,5,3,11,16,7,10,19,13,12,4,17,6,20), Ring endomorphism of Finite Field in z of size 2^2
-+              ((z + 1, z + 1, z + 1, z, 1, 1, z, z, 1, z + 1, z, 1, 1, z, 1, z + 1, z, z + 1, z + 1, 1, z); (1,3,18,2,17,6,19)(4,15,13,20,7,14,16)(5,11,8,21,12,9,10), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
-               ((z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1); (), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-              181440)
-             sage: C.automorphism_group_gens(equivalence="permutational")
--            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
-+            ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
-+              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,18)(3,19)(4,10)(5,16)(8,13)(9,14)(11,21)(15,20), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
--              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,17)(2,8)(3,14)(4,10)(7,12)(9,19)(13,18)(15,20), Ring endomorphism of Finite Field in z of size 2^2
-+              ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z),
-               ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,13)(3,14)(4,20)(5,11)(8,18)(9,19)(10,15)(16,21), Ring endomorphism of Finite Field in z of size 2^2
-                 Defn: z |--> z)],
-@@ -692,10 +692,10 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric):
-             sage: C_iso == aut_group_can_label.get_canonical_form()
-             True
-             sage: aut_group_can_label.get_autom_gens()
--            [((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
-+            [((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
-+               Defn: z |--> z + 1),
-+             ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
-                Defn: z |--> z + 1),
--             ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
--               Defn: z |--> z),
-              ((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
-                Defn: z |--> z)]
-         """
-diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py
-index bde2823..bffcc85 100644
---- a/src/sage/combinat/root_system/hecke_algebra_representation.py
-+++ b/src/sage/combinat/root_system/hecke_algebra_representation.py
-@@ -355,7 +355,7 @@ class HeckeAlgebraRepresentation(WithEqualityById, SageObject):
-             sage: q1, q2 = K.gens()
-             sage: KW = W.algebra(K)
-             sage: x = KW.an_element(); x
--            123 + 3*32 + 2*3 + e
-+            123 + 3*2312 + 2*31 + e
- 
-             sage: T = KW.demazure_lusztig_operators(q1,q2)
-             sage: T12 = T.Tw( (1,2) )
-diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py
-index c3d6755..da953d2 100644
---- a/src/sage/combinat/symmetric_group_algebra.py
-+++ b/src/sage/combinat/symmetric_group_algebra.py
-@@ -101,7 +101,7 @@ def SymmetricGroupAlgebra(R, W, category=None):
-         sage: SGA.group()
-         Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space)
-         sage: SGA.an_element()
--        s1*s2*s3 + 3*s3*s2 + 2*s3 + 1
-+        s1*s2*s3 + 3*s2*s3*s1*s2 + 2*s3*s1 + 1
- 
-     The preferred way to construct the symmetric group algebra is to
-     go through the usual ``algebra`` method::
-diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
-index 2a61bbf..d26891a 100644
---- a/src/sage/groups/finitely_presented.py
-+++ b/src/sage/groups/finitely_presented.py
-@@ -596,9 +596,9 @@ class RewritingSystem():
-             sage: k = G.rewriting_system()
-             sage: k.gap()
-             Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules
--            [ [ a^2, <identity ...> ], [ a*A, <identity ...> ],
--              [ A*a, <identity ...> ], [ b^2, <identity ...> ],
--              [ b*B, <identity ...> ], [ B*b, <identity ...> ] ]
-+            [ [ a*A, <identity ...> ], [ A*a, <identity ...> ],
-+              [ b*B, <identity ...> ], [ B*b, <identity ...> ],
-+              [ a^2, <identity ...> ], [ b^2, <identity ...> ] ]
-         """
-         return self._gap
- 
-diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
-index 75de408..dd7d84d 100644
---- a/src/sage/groups/fqf_orthogonal.py
-+++ b/src/sage/groups/fqf_orthogonal.py
-@@ -143,7 +143,7 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
-         [2/3   0   0]
-         [  0 2/3   0]
-         [  0   0 4/3]
--        generated by 2 elements
-+        generated by 3 elements
-         sage: q = matrix.diagonal(QQ, [3/2, 1/4, 1/4])
-         sage: T = TorsionQuadraticForm(q)
-         sage: T.orthogonal_group().order()
-diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx
-index a76afc2..9340c0d 100644
---- a/src/sage/groups/libgap_wrapper.pyx
-+++ b/src/sage/groups/libgap_wrapper.pyx
-@@ -25,7 +25,7 @@ Note how we call the constructor of both superclasses to initialize
- its output via LibGAP::
- 
-     sage: FooGroup()
--    <pc group of size 3 with 1 generators>
-+    <pc group of size 3 with 1 generator>
-     sage: type(FooGroup().gap())
-     <class 'sage.libs.gap.element.GapElement'>
- 
-@@ -106,7 +106,7 @@ class ParentLibGAP(SageObject):
-         ....:         ParentLibGAP.__init__(self, lg)
-         ....:         Group.__init__(self)
-         sage: FooGroup()
--        <pc group of size 3 with 1 generators>
-+        <pc group of size 3 with 1 generator>
-     """
- 
-     def __init__(self, libgap_parent, ambient=None):
-@@ -461,7 +461,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement):
-         ....:         ParentLibGAP.__init__(self, lg)
-         ....:         Group.__init__(self)
-         sage: FooGroup()
--        <pc group of size 3 with 1 generators>
-+        <pc group of size 3 with 1 generator>
-         sage: FooGroup().gens()
-         (f1,)
-     """
-diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-index 2fcb036..ca73c6b 100644
---- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-+++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
-@@ -427,7 +427,7 @@ cdef class LabelledBranching:
-             sage: from sage.groups.perm_gps.partn_ref2.refinement_generic import LabelledBranching
-             sage: L = LabelledBranching(3)
-             sage: L.small_generating_set()
--            []
-+            [()]
-             sage: L.add_gen(libgap.eval('(1,2,3)'))
-             sage: L.small_generating_set()
-             [(1,2,3)]
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 4908934..34ba0cc 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -913,7 +913,7 @@ class PermutationGroup_generic(FiniteGroup):
-            sage: f = PG._coerce_map_from_(MG)
-            sage: mg = MG.an_element()
-            sage: p = f(mg); p
--           (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60)
-+           (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21)
-            sage: PG(p._gap_()) == p
-            True
- 
-@@ -959,12 +959,12 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: P = G.as_permutation_group(algorithm='smaller', seed=5)
-             sage: P1 = G.as_permutation_group()
-             sage: P == P1
--            False
-+            True
-             sage: g1, g2, g3 = G.gens()
-             sage: P(g1*g2)
--            (1,3,7,12)(2,4,8,10)(5,11)(6,9)
-+            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
-             sage: P1(g1*g2)
--            (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66)
-+            (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
- 
-         Another check for :trac:`5583`::
- 
-diff --git a/src/sage/libs/gap/libgap.pyx b/src/sage/libs/gap/libgap.pyx
-index b1a64e5..6a36613 100644
---- a/src/sage/libs/gap/libgap.pyx
-+++ b/src/sage/libs/gap/libgap.pyx
-@@ -695,7 +695,7 @@ class Gap(Parent):
-             sage: libgap.List
-             <Gap function "List">
-             sage: libgap.GlobalRandomSource
--            <RandomSource in IsGlobalRandomSource>
-+            <RandomSource in IsGAPRandomSource>
-         """
-         if name in dir(self.__class__):
-             return getattr(self.__class__, name)
-diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
-index 344ab88..6350987 100644
---- a/src/sage/libs/gap/util.pyx
-+++ b/src/sage/libs/gap/util.pyx
-@@ -362,15 +362,9 @@ cdef Obj gap_eval(str gap_string) except? NULL:
-         GAPError: Error, Variable: 'Complex' must have a value
-         Syntax error: ; expected in stream:1
-         Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^
-+                ^^^^^
-         Error, Variable: 'with' must have a value
--        Syntax error: ; expected in stream:1
--        Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^^^^^^^^^
-         Error, Variable: 'bits' must have a value
--        Syntax error: ; expected in stream:1
--        Complex Field with 53 bits of precision;;
--         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-         Error, Variable: 'precision' must have a value
- 
-     Test that on a subsequent attempt we get the same message (no garbage was
-diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py
-index 2e4518c..c302b16 100644
---- a/src/sage/tests/gap_packages.py
-+++ b/src/sage/tests/gap_packages.py
-@@ -103,7 +103,7 @@ def all_installed_packages(ignore_dot_gap=False, gap=None):
- 
-         sage: from sage.tests.gap_packages import all_installed_packages
-         sage: all_installed_packages()
--        (...'GAPDoc'...)
-+        (...'gapdoc'...)
-         sage: all_installed_packages(ignore_dot_gap=True) == all_installed_packages(gap=gap, ignore_dot_gap=True)
-         True
-     """
--- 
-cgit v1.0-1-gd88e
-
-
-From cbc902a79ff9ec01d4d4eb9a767a1c661fb5dda7 Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:17:42 +0200
-Subject: Adapt test to new is_transitive and is_primitive behavior
-
----
- src/sage/groups/perm_gps/permgroup.py | 22 ++++++++++++++++------
- 1 file changed, 16 insertions(+), 6 deletions(-)
-
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 34ba0cc..5832b98 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -4359,17 +4359,23 @@ class PermutationGroup_generic(FiniteGroup):
- 
-         ::
- 
--            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
--            sage: G.is_transitive([1,4,5])
-+            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)],[(6,7)]])
-+            sage: G.is_transitive([1,2,3,4,5])
-             True
--            sage: G.is_transitive([2..6])
-+            sage: G.is_transitive([1..7])
-             False
-             sage: G.is_transitive(G.non_fixed_points())
--            True
-+            False
-             sage: H = PermutationGroup([[(1,2,3)],[(4,5,6)]])
-             sage: H.is_transitive(H.non_fixed_points())
-             False
- 
-+        If `G` does not act on the domain, it always returns ``False``::
-+
-+            sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
-+            sage: G.is_transitive([1,4,5])
-+            False
-+
-         Note that this differs from the definition in GAP, where
-         ``IsTransitive`` returns whether the group is transitive on the
-         set of points moved by the group.
-@@ -4425,12 +4431,16 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
-             sage: G.is_primitive([1..4])
-             False
--            sage: G.is_primitive([1,2,3])
--            True
-             sage: G = PermutationGroup([[(3,4,5,6)],[(3,4)]]) #S_4 on [3..6]
-             sage: G.is_primitive(G.non_fixed_points())
-             True
- 
-+        If `G` does not act on the domain, it always returns ``False``::
-+
-+            sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
-+            sage: G.is_primitive([1,2,3])
-+            False
-+
-         """
-         #If the domain is not a subset of self.domain(), then the
-         #action isn't primitive.
--- 
-cgit v1.0-1-gd88e
-
-
-From 80dd6b338236f170efca1fc3545df18ce8d8795c Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:18:06 +0200
-Subject: Mark test as random. With gap 4.12 on x86_64 it is no longer 2
-
----
- src/sage/groups/perm_gps/permgroup.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
-index 5832b98..c1230a3 100644
---- a/src/sage/groups/perm_gps/permgroup.py
-+++ b/src/sage/groups/perm_gps/permgroup.py
-@@ -1287,7 +1287,7 @@ class PermutationGroup_generic(FiniteGroup):
-             sage: G.gens_small() # random
-             [('b','c'), ('a','c','b')] ## (on 64-bit Linux)
-             [('a','b'), ('a','c','b')] ## (on Solaris)
--            sage: len(G.gens_small()) == 2
-+            sage: len(G.gens_small()) == 2 # random
-             True
-         """
-         gens = self._libgap_().SmallGeneratingSet()
--- 
-cgit v1.0-1-gd88e
-
-
-From a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e Mon Sep 17 00:00:00 2001
-From: Antonio Rojas <arojas@archlinux.org>
-Date: Fri, 30 Sep 2022 19:18:30 +0200
-Subject: Remove test that is now redundant, all seeds give the same answer
-
----
- src/sage/groups/matrix_gps/finitely_generated.py | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py
-index a6d3dc0..63956ad 100644
---- a/src/sage/groups/matrix_gps/finitely_generated.py
-+++ b/src/sage/groups/matrix_gps/finitely_generated.py
-@@ -563,9 +563,6 @@ class FinitelyGeneratedMatrixGroup_gap(MatrixGroup_gap):
-             21499084800
-             sage: P = G.as_permutation_group()
-             sage: Psmaller = G.as_permutation_group(algorithm="smaller", seed=6)
--            sage: P == Psmaller  # see the note below
--            True
--            sage: Psmaller = G.as_permutation_group(algorithm="smaller")
-             sage: P == Psmaller
-             False
-             sage: P.cardinality()
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch b/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
deleted file mode 100644
index 8fedcb78cf71..000000000000
--- a/srcpkgs/sagemath/patches/trac-34465-fix_invalid_escape_sequence-04971318f032caf8dc1c0de9489346d894409091.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-commit 04971318f032caf8dc1c0de9489346d894409091
-Author: John H. Palmieri <jhpalmieri64@gmail.com>
-Date:   Wed Aug 31 14:22:26 2022 -0700
-
-    trac 34465: fix invalid escape sequence in functions/special.py
-
-diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py
-index 02596e49620..901f02f9bee 100644
---- a/src/sage/functions/special.py
-+++ b/src/sage/functions/special.py
-@@ -849,7 +849,7 @@ class EllipticF(BuiltinFunction):
-     - :wikipedia:`Elliptic_integral#Incomplete_elliptic_integral_of_the_first_kind`
-     """
-     def __init__(self):
--        """
-+        r"""
-         EXAMPLES::
- 
-             sage: loads(dumps(elliptic_f))
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
deleted file mode 100644
index ccafad5070c4..000000000000
--- a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15.patch
+++ /dev/null
@@ -1,1750 +0,0 @@
-diff --git a/build/pkgs/giac/patches/pari_2_15.patch b/build/pkgs/giac/patches/pari_2_15.patch
-new file mode 100644
-index 0000000000..d2900a5ffc
---- /dev/null
-+++ b/build/pkgs/giac/patches/pari_2_15.patch
-@@ -0,0 +1,21 @@
-+ANYARG patch
-+
-+diff --git a/src/pari.cc b/src/pari.cc
-+index 76ce8e1..50d08ab 100644
-+--- a/src/pari.cc
-++++ b/src/pari.cc
-+@@ -40,6 +40,13 @@ using namespace std;
-+ 
-+ #ifdef HAVE_LIBPARI
-+ 
-++// Anyarg disappeared from PARI 2.15.0
-++#ifdef __cplusplus
-++#  define ANYARG ...
-++#else
-++#  define ANYARG
-++#endif
-++
-+ #ifdef HAVE_PTHREAD_H
-+ #include <pthread.h>
-+ #endif
-+
-diff --git a/build/pkgs/pari/checksums.ini b/build/pkgs/pari/checksums.ini
-index b736feed31..bafd0f36f4 100644
---- a/build/pkgs/pari/checksums.ini
-+++ b/build/pkgs/pari/checksums.ini
-@@ -1,5 +1,5 @@
- tarball=pari-VERSION.tar.gz
--sha1=e01647aab7e96a8cb4922cf26a4f224337c6647f
--md5=922f740fcdf8630b30d63dc76b58f756
--cksum=297133525
-+sha1=cba9b279f67d5efe2fbbccf3be6e9725f816cf07
-+md5=76d430f1bea1b07fa2ad9712deeaa736
-+cksum=1990743897
- upstream_url=https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-VERSION.tar.gz
-diff --git a/build/pkgs/pari/package-version.txt b/build/pkgs/pari/package-version.txt
-index a1a4224dd5..68e69e405e 100644
---- a/build/pkgs/pari/package-version.txt
-+++ b/build/pkgs/pari/package-version.txt
-@@ -1 +1 @@
--2.13.3
-+2.15.0
-diff --git a/src/doc/de/tutorial/tour_numtheory.rst b/src/doc/de/tutorial/tour_numtheory.rst
-index a012234c99..e3149fe949 100644
---- a/src/doc/de/tutorial/tour_numtheory.rst
-+++ b/src/doc/de/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ implementiert.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/en/tutorial/tour_numtheory.rst b/src/doc/en/tutorial/tour_numtheory.rst
-index 3064d100e2..075e0ac0ad 100644
---- a/src/doc/en/tutorial/tour_numtheory.rst
-+++ b/src/doc/en/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ NumberField class.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/es/tutorial/tour_numtheory.rst b/src/doc/es/tutorial/tour_numtheory.rst
-index a1f7d1a87b..48e5376cfe 100644
---- a/src/doc/es/tutorial/tour_numtheory.rst
-+++ b/src/doc/es/tutorial/tour_numtheory.rst
-@@ -140,7 +140,7 @@ Varios métodos relacionados están implementados en la clase ``NumberField``::
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/fr/tutorial/tour_numtheory.rst b/src/doc/fr/tutorial/tour_numtheory.rst
-index 871092f5fa..d1b2fee883 100644
---- a/src/doc/fr/tutorial/tour_numtheory.rst
-+++ b/src/doc/fr/tutorial/tour_numtheory.rst
-@@ -159,7 +159,7 @@ dans la classe NumberField.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/ja/tutorial/tour_numtheory.rst b/src/doc/ja/tutorial/tour_numtheory.rst
-index 47af68c862..4d4ed52d50 100644
---- a/src/doc/ja/tutorial/tour_numtheory.rst
-+++ b/src/doc/ja/tutorial/tour_numtheory.rst
-@@ -161,7 +161,7 @@ Sageには :math:`p` \-進数体も組込まれている.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/pt/tutorial/tour_numtheory.rst b/src/doc/pt/tutorial/tour_numtheory.rst
-index 6371b491ea..a3dc973a93 100644
---- a/src/doc/pt/tutorial/tour_numtheory.rst
-+++ b/src/doc/pt/tutorial/tour_numtheory.rst
-@@ -157,7 +157,7 @@ NumberField.
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus 
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/doc/ru/tutorial/tour_numtheory.rst b/src/doc/ru/tutorial/tour_numtheory.rst
-index 652abfbc99..a985d49fbd 100644
---- a/src/doc/ru/tutorial/tour_numtheory.rst
-+++ b/src/doc/ru/tutorial/tour_numtheory.rst
-@@ -150,7 +150,7 @@ Sage содержит стандартные функции теории чис
-     Univariate Quotient Polynomial Ring in a over Rational Field with modulus
-     x^3 + x^2 - 2*x + 8
-     sage: K.units()
--    (3*a^2 + 13*a + 13,)
-+    (-3*a^2 - 13*a - 13,)
-     sage: K.discriminant()
-     -503
-     sage: K.class_group()
-diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py
-index e57076646f..fec75d07c1 100644
---- a/src/sage/arith/misc.py
-+++ b/src/sage/arith/misc.py
-@@ -1465,13 +1465,13 @@ def divisors(n):
- 
-         sage: K.<a> = QuadraticField(7)
-         sage: divisors(K.ideal(7))
--        [Fractional ideal (1), Fractional ideal (-a), Fractional ideal (7)]
-+        [Fractional ideal (1), Fractional ideal (a), Fractional ideal (7)]
-         sage: divisors(K.ideal(3))
-         [Fractional ideal (1), Fractional ideal (3),
--        Fractional ideal (-a + 2), Fractional ideal (-a - 2)]
-+        Fractional ideal (a - 2), Fractional ideal (a + 2)]
-         sage: divisors(K.ideal(35))
--        [Fractional ideal (1), Fractional ideal (5), Fractional ideal (-a),
--        Fractional ideal (7), Fractional ideal (-5*a), Fractional ideal (35)]
-+        [Fractional ideal (1), Fractional ideal (5), Fractional ideal (a),
-+        Fractional ideal (7), Fractional ideal (5*a), Fractional ideal (35)]
- 
-     TESTS::
- 
-@@ -2569,7 +2569,7 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds):
- 
-         sage: K.<i> = QuadraticField(-1)
-         sage: factor(122 - 454*i)
--        (-3*i - 2) * (-i - 2)^3 * (i + 1)^3 * (i + 4)
-+        (-i) * (-i - 2)^3 * (i + 1)^3 * (-2*i + 3) * (i + 4)
- 
-     To access the data in a factorization::
- 
-diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-index cdfc11a9e5..b6e1280d6e 100644
---- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-+++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
-@@ -7825,9 +7825,9 @@ class DynamicalSystem_projective_field(DynamicalSystem_projective,
-             sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, y^2, QQbar(sqrt(2))*z^2])
-             sage: f.reduce_base_field()
-             Dynamical System of Projective Space of dimension 2 over Number Field in a with
--            defining polynomial y^4 - 4*y^2 + 1 with a = 1.931851652578137?
-+            defining polynomial y^4 - 4*y^2 + 1 with a = -0.5176380902050415?
-               Defn: Defined on coordinates by sending (x : y : z) to
--                    (x^2 + (a^2 - 2)*y^2 : y^2 : (a^3 - 3*a)*z^2)
-+                    (x^2 + (-a^2 + 2)*y^2 : y^2 : (a^3 - 3*a)*z^2)
- 
-         ::
- 
-diff --git a/src/sage/ext_data/pari/simon/ellQ.gp b/src/sage/ext_data/pari/simon/ellQ.gp
-index 420af8f6a2..65e8386779 100644
---- a/src/sage/ext_data/pari/simon/ellQ.gp
-+++ b/src/sage/ext_data/pari/simon/ellQ.gp
-@@ -40,7 +40,7 @@
-   gp > \r ellcommon.gp
-   gp > \r ellQ.gp
- 
--  The main function is ellrank(), which takes as an argument
-+  The main function is ellQ_ellrank(), which takes as an argument
-   any elliptic curve in the form [a1,a2,a3,a4,a6]
-   the result is a vector [r,s,v], where
-     r is a lower bound for the rank,
-@@ -50,7 +50,7 @@
-   Example:
- 
-   gp > ell = [1,2,3,4,5];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
-   %1 = [1, 1, [[1,2]]
-   In this example, the rank is exactly 1, and [1,2] has infinite order.
- 
-@@ -92,7 +92,7 @@
-   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- 
-   Explications succintes :
--  La fonction ellrank() accepte toutes les courbes sous la forme
-+  La fonction ellQ_ellrank() accepte toutes les courbes sous la forme
-   [a1,a2,a3,a4,a6]
-   Les coefficients peuvent etre entiers ou non.
-   L'algorithme utilise est celui de la 2-descente.
-@@ -100,7 +100,7 @@
-   Il suffit de taper : 
- 
-   gp > ell = [a1,a2,a3,a4,a6];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
- 
-   Retourne un vecteur [r,s,v] ou
-     r est le rang probable (c'est toujours une minoration du rang),
-@@ -110,7 +110,7 @@
-   Exemple :
- 
-   gp > ell = [1,2,3,4,5];
--  gp > ellrank(ell)
-+  gp > ellQ_ellrank(ell)
-   %1 = [1, 1, [[1,2]]
-   Ici, le rang est exactement 1, et le point [1,2] est d'ordre infini.
- 
-@@ -1571,12 +1571,12 @@ if( DEBUGLEVEL_ell >= 4, print("    end of ell2descent_gen"));
-     print("rank(E/Q)    >= ",m1)
-   );
- }
--{ellrank(ell,help=[]) =
-+{ellQ_ellrank(ell,help=[]) =
- \\ Algorithm of 2-descent on the elliptic curve ell.
- \\ help is a list of known points on ell.
- my(urst,urst1,den,eqell,tors2,bnf,rang,time1);
- 
--if( DEBUGLEVEL_ell >= 3, print("   starting ellrank"));
-+if( DEBUGLEVEL_ell >= 3, print("   starting ellQ_ellrank"));
-   if( #ell < 13, ell = ellinit(ell));
- 
- \\ kill the coefficients a1 and a3
-@@ -1630,7 +1630,7 @@ if( DEBUGLEVEL_ell >= 1, print(" Elliptic curve: Y^2 = ",eqell));
-   ));
- 
-   rang[3] = ellchangepoint(rang[3],ellinverturst(urst));
--if( DEBUGLEVEL_ell >= 3, print("   end of ellrank"));
-+if( DEBUGLEVEL_ell >= 3, print("   end of ellQ_ellrank"));
- 
-   return(rang);
- }
-@@ -2106,13 +2106,13 @@ if( DEBUGLEVEL_ell >= 3, print("   end of ell2descent_viaisog"));
- {
- \\                  functions for elliptic curves
-   addhelp(ell2descent_complete,
--    "ell2descent_complete(e1,e2,e3): Performs a complete 2-descent on the elliptic curve y^2 = (x-e1)*(x-e2)*(x-e3). See ?ellrank for the format of the output.");
-+    "ell2descent_complete(e1,e2,e3): Performs a complete 2-descent on the elliptic curve y^2 = (x-e1)*(x-e2)*(x-e3). See ?ellQ_ellrank for the format of the output.");
-   addhelp(ell2descent_gen,
--    "ell2descent_gen((E,bnf,k=1,help=[]): E is a vector of the form [0,A,0,B,C], (or the result of ellinit of such a vector) A,B,C integers such that x^3+A*x^2+B*x+C; bnf is the corresponding bnfinit(,1); Performs 2-descent on the elliptic curve Ek: k*y^2=x^3+A*x^2+B*x+C. See ?ellrank for the format of the output.");
-+    "ell2descent_gen((E,bnf,k=1,help=[]): E is a vector of the form [0,A,0,B,C], (or the result of ellinit of such a vector) A,B,C integers such that x^3+A*x^2+B*x+C; bnf is the corresponding bnfinit(,1); Performs 2-descent on the elliptic curve Ek: k*y^2=x^3+A*x^2+B*x+C. See ?ellQ_ellrank for the format of the output.");
-   addhelp(ell2descent_viaisog,
--    "ell2descent_viaisog(E,help=[]): E is an elliptic curve of the form [0,a,0,b,0], with a, b integers. Performs a 2-descent via isogeny on E. See ?ellrank for the format of the output.");
--  addhelp(ellrank,
--    "ellrank(E,help=[]): E is any elliptic curve defined over Q. Returns a vector [r,s,v], where r is a lower bound for the rank of E, s is the rank of its 2-Selmer group and v is a list of independant points in E(Q)/2E(Q). If help is a vector of nontrivial points on E, the result might be faster. This function might be used in conjunction with elltors2(E). See also ?default_ellQ");
-+    "ell2descent_viaisog(E,help=[]): E is an elliptic curve of the form [0,a,0,b,0], with a, b integers. Performs a 2-descent via isogeny on E. See ?ellQ_ellrank for the format of the output.");
-+  addhelp(ellQ_ellrank,
-+    "ellQ_ellrank(E,help=[]): E is any elliptic curve defined over Q. Returns a vector [r,s,v], where r is a lower bound for the rank of E, s is the rank of its 2-Selmer group and v is a list of independant points in E(Q)/2E(Q). If help is a vector of nontrivial points on E, the result might be faster. This function might be used in conjunction with elltors2(E). See also ?default_ellQ");
-   addhelp(ellhalf,
-     "ellhalf(E,P): returns the vector of all points Q on the elliptic curve E such that 2Q = P");
-   addhelp(ellredgen,
-@@ -2143,7 +2143,7 @@ if( DEBUGLEVEL_ell >= 3, print("   end of ell2descent_viaisog"));
- 
- \\                  others
-   addhelp(default_ellQ,
--    "default_ellQ(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, ELLREDGENFLAG, COMPLETE, MAXPROB, LIMBIGPRIME): set the value of the global variables used for ellrank() and other related functions. DEBUGLEVEL_ell: 0-5: choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; ELLREDGENFLAG: if != 0, try to reduce the generators at the end; COMPLETE: if != 0 and full 2-torsion, use complete 2-descent, otherwise via 2-isogeny; MAXPROB, LIMBIGPRIME: technical.");
-+    "default_ellQ(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, ELLREDGENFLAG, COMPLETE, MAXPROB, LIMBIGPRIME): set the value of the global variables used for ellQ_ellrank() and other related functions. DEBUGLEVEL_ell: 0-5: choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; ELLREDGENFLAG: if != 0, try to reduce the generators at the end; COMPLETE: if != 0 and full 2-torsion, use complete 2-descent, otherwise via 2-isogeny; MAXPROB, LIMBIGPRIME: technical.");
- /*  addhelp(DEBUGLEVEL_ell,
-     "DEBUGLEVEL_ell: Choose a higher value of this global variable to have more details of the computations printed during the 2-descent algorithm. 0 = don't print anything; 1 = (default) just print the result; 2 = print more details including the Selmer group and the nontrivial quartics.");
- */
-diff --git a/src/sage/ext_data/pari/simon/qfsolve.gp b/src/sage/ext_data/pari/simon/qfsolve.gp
-index 501fb50828..2107288c1d 100644
---- a/src/sage/ext_data/pari/simon/qfsolve.gp
-+++ b/src/sage/ext_data/pari/simon/qfsolve.gp
-@@ -434,146 +434,6 @@ my(cc);
- return([U3~*G3*U3,red[2]*U1*U2*U3]);
- }
- 
--\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
--\\        QUADRATIC FORMS MINIMIZATION         \\
--\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
--
--\\ Minimization of the quadratic form G, with nonzero determinant.
--\\ of dimension n>=2.
--\\ G must by symmetric and have integral coefficients.
--\\ Returns [G',U,factd] with U in GLn(Q) such that G'=U~*G*U*constant
--\\ is integral and has minimal determinant.
--\\ In dimension 3 or 4, may return a prime p
--\\ if the reduction at p is impossible because of the local non solvability.
--\\ If given, factdetG must be equal to factor(abs(det(G))).
--{qfminimize(G,factdetG) =
--my(factd,U,Ker,Ker2,sol,aux,di);
--my(p);
--my(n,lf,i,vp,dimKer,dimKer2,m);
--
--  n = length(G);
--  factd = matrix(0,2);
--  if( !factdetG, factdetG = factor(matdet(G)));
--
--  lf = length(factdetG[,1]);
--  i = 1; U = matid(n);
--
--  while(i <= lf,
--    vp = factdetG[i,2];
--    if( vp == 0, i++; next);
--    p = factdetG[i,1];
--    if( p == -1, i++; next);
--if( DEBUGLEVEL_qfsolve >= 4, print("    p = ",p,"^",vp));
--
--\\ The case vp = 1 can be minimized only if n is odd.
--    if( vp == 1 && n%2 == 0,
--      factd = concat(factd~, Mat([p,1])~)~;
--      i++; next
--    );
--    Ker = kermodp(G,p); dimKer = Ker[1]; Ker = Ker[2];
--
--\\ Rem: we must have dimKer <= vp
--if( DEBUGLEVEL_qfsolve >= 4, print("    dimKer = ",dimKer));
--\\ trivial case: dimKer = n
--    if( dimKer == n, 
--if( DEBUGLEVEL_qfsolve >= 4, print("     case 0: dimKer = n"));
--      G /= p;
--      factdetG[i,2] -= n;
--      next
--    );
--    G = Ker~*G*Ker;
--    U = U*Ker;
--
--\\ 1st case: dimKer < vp
--\\ then the kernel mod p contains a kernel mod p^2
--    if( dimKer < vp,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 1: dimker < vp"));
--      if( dimKer == 1,
--\\        G[,1] /= p; G[1,] /= p;
--        G[,1] /= p; G[1,] = G[1,]/p;
--        U[,1] /= p;
--        factdetG[i,2] -= 2
--      , 
--        Ker2 = kermodp(matrix(dimKer,dimKer,j,k,G[j,k]/p),p);
--        dimKer2 = Ker2[1]; Ker2 = Ker2[2];
--        for( j = 1, dimKer2, Ker2[,j] /= p);
--        Ker2 = matdiagonalblock([Ker2,matid(n-dimKer)]);
--        G = Ker2~*G*Ker2;
--        U = U*Ker2;
--        factdetG[i,2] -= 2*dimKer2
--);
--
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 1"));
--      next
--    );
--
--\\ Now, we have vp = dimKer 
--\\ 2nd case: the dimension of the kernel is >=2
--\\ and contains an element of norm 0 mod p^2
--
--\\ search for an element of norm p^2... in the kernel
--    if( dimKer > 2 || 
--       (dimKer == 2 && issquare( di = Mod((G[1,2]^2-G[1,1]*G[2,2])/p^2,p))),
--      if( dimKer > 2,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 2.1"));
--        dimKer = 3;
--        sol = qfsolvemodp(matrix(3,3,j,k,G[j,k]/p),p)
--      ,
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 2.2"));
--        if( G[1,1]%p^2 == 0, 
--          sol = [1,0]~
--        , sol = [-G[1,2]/p+sqrt(di),Mod(G[1,1]/p,p)]~
--        )
--      );
--      sol = centerlift(sol);
--      sol /= content(sol);
--if( DEBUGLEVEL_qfsolve >= 4, print("    sol = ",sol));
--      Ker = vectorv(n, j, if( j<= dimKer, sol[j], 0)); \\ fill with 0's
--      Ker = completebasis(Ker,1);
--      Ker[,n] /= p;
--      G = Ker~*G*Ker;
--      U = U*Ker;
--      factdetG[i,2] -= 2;
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 2"));
--      next
--    );
--
--\\ Now, we have vp = dimKer <= 2 
--\\   and the kernel contains no vector with norm p^2...
--
--\\ In some cases, exchanging the kernel and the image
--\\ makes the minimization easy.
--
--    m = (n-1)\2-1;
--    if( ( vp == 1 && issquare(Mod(-(-1)^m*matdet(G)/G[1,1],p)))
--     || ( vp == 2 && n%2 == 1 && n >= 5)
--     || ( vp == 2 && n%2 == 0 && !issquare(Mod((-1)^m*matdet(G)/p^2,p)))
--    , 
--if( DEBUGLEVEL_qfsolve >= 4, print("    case 3"));
--      Ker = matid(n);
--      for( j = dimKer+1, n, Ker[j,j] = p);
--      G = Ker~*G*Ker/p;
--      U = U*Ker;
--      factdetG[i,2] -= 2*dimKer-n;
--if( DEBUGLEVEL_qfsolve >= 4, print("    end of case 3"));
--      next
--    );
--
--\\ Minimization was not possible se far.
--\\ If n == 3 or 4, this proves the local non-solubility at p.
--    if( n == 3 || n == 4, 
--if( DEBUGLEVEL_qfsolve >= 1, print(" no local solution at ",p));
--      return(p));
--
--if( DEBUGLEVEL_qfsolve >= 4, print("    prime ",p," finished"));
--    factd = concat(factd~,Mat([p,vp])~)~;
--    i++
--  );
--\\ apply LLL to avoid coefficients explosion
--  aux = qflll(U/content(U));
--return([aux~*G*aux,U*aux,factd]);
--}
--
- \\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- \\          CLASS GROUP COMPUTATIONS           \\
- \\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
-diff --git a/src/sage/geometry/polyhedron/backend_field.py b/src/sage/geometry/polyhedron/backend_field.py
-index 6b921d23a6..2f32c58b1e 100644
---- a/src/sage/geometry/polyhedron/backend_field.py
-+++ b/src/sage/geometry/polyhedron/backend_field.py
-@@ -265,7 +265,7 @@ class Polyhedron_field(Polyhedron_base):
-              An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0,
-              An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0)
-             sage: p.Vrepresentation()                                           # optional - sage.rings.number_field
--            (A vertex at (0.?e-15, 0.707106781186548?),
-+            (A vertex at (0.?e-16, 0.7071067811865475?),
-              A vertex at (1.414213562373095?, 0),
-              A vertex at (4.000000000000000?, 0.372677996249965?))
-         """
-@@ -308,7 +308,7 @@ class Polyhedron_field(Polyhedron_base):
-              An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0,
-              An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0)
-             sage: p.Vrepresentation()                                           # optional - sage.rings.number_field
--            (A vertex at (0.?e-15, 0.707106781186548?),
-+            (A vertex at (0.?e-16, 0.7071067811865475?),
-              A vertex at (1.414213562373095?, 0),
-              A vertex at (4.000000000000000?, 0.372677996249965?))
-         """
-diff --git a/src/sage/geometry/polyhedron/backend_normaliz.py b/src/sage/geometry/polyhedron/backend_normaliz.py
-index 86b89632a5..ca8a43b248 100644
---- a/src/sage/geometry/polyhedron/backend_normaliz.py
-+++ b/src/sage/geometry/polyhedron/backend_normaliz.py
-@@ -53,7 +53,7 @@ def _number_field_elements_from_algebraics_list_of_lists_of_lists(listss, **kwds
-         1.732050807568878?
-         sage: from sage.geometry.polyhedron.backend_normaliz import _number_field_elements_from_algebraics_list_of_lists_of_lists
-         sage: K, results, hom = _number_field_elements_from_algebraics_list_of_lists_of_lists([[[rt2], [1]], [[rt3]], [[1], []]]); results  # optional - sage.rings.number_field
--        [[[-a^3 + 3*a], [1]], [[-a^2 + 2]], [[1], []]]
-+        [[[-a^3 + 3*a], [1]], [[a^2 - 2]], [[1], []]]
-     """
-     from sage.rings.qqbar import number_field_elements_from_algebraics
-     numbers = []
-diff --git a/src/sage/groups/matrix_gps/isometries.py b/src/sage/groups/matrix_gps/isometries.py
-index f9111a2c92..cca45e7175 100644
---- a/src/sage/groups/matrix_gps/isometries.py
-+++ b/src/sage/groups/matrix_gps/isometries.py
-@@ -11,11 +11,11 @@ EXAMPLES::
-     sage: L = IntegralLattice("D4")
-     sage: O = L.orthogonal_group()
-     sage: O
--    Group of isometries with 5 generators (
--    [-1  0  0  0]  [0 0 0 1]  [-1 -1 -1 -1]  [ 1  1  0  0]  [ 1  0  0  0]
--    [ 0 -1  0  0]  [0 1 0 0]  [ 0  0  1  0]  [ 0  0  1  0]  [-1 -1 -1 -1]
--    [ 0  0 -1  0]  [0 0 1 0]  [ 0  1  0  1]  [ 0  1  0  1]  [ 0  0  1  0]
--    [ 0  0  0 -1], [1 0 0 0], [ 0 -1 -1  0], [ 0 -1 -1  0], [ 0  0  0  1]
-+    Group of isometries with 3 generators (
-+    [0 0 0 1]  [ 1  1  0  0]  [ 1  0  0  0]
-+    [0 1 0 0]  [ 0  0  1  0]  [-1 -1 -1 -1]
-+    [0 0 1 0]  [ 0  1  0  1]  [ 0  0  1  0]
-+    [1 0 0 0], [ 0 -1 -1  0], [ 0  0  0  1]
-     )
- 
- Basic functionality is provided by GAP::
-diff --git a/src/sage/interfaces/genus2reduction.py b/src/sage/interfaces/genus2reduction.py
-index 56ae04b235..7a4794daf2 100644
---- a/src/sage/interfaces/genus2reduction.py
-+++ b/src/sage/interfaces/genus2reduction.py
-@@ -143,31 +143,31 @@ class ReductionData(SageObject):
-        sur un corps de valuation discrète", Trans. AMS 348 (1996),
-        4577-4610, Section 7.2, Proposition 4).
-     """
--    def __init__(self, pari_result, P, Q, minimal_equation, minimal_disc,
--                 local_data, conductor, prime_to_2_conductor_only):
-+    def __init__(self, pari_result, P, Q, Pmin, Qmin, minimal_disc,
-+                 local_data, conductor):
-         self.pari_result = pari_result
-         self.P = P
-         self.Q = Q
--        self.minimal_equation = minimal_equation
-+        self.Pmin = Pmin
-+        self.Qmin = Qmin
-         self.minimal_disc = minimal_disc
-         self.local_data = local_data
-         self.conductor = conductor
--        self.prime_to_2_conductor_only = prime_to_2_conductor_only
- 
-     def _repr_(self):
--        if self.prime_to_2_conductor_only:
--            ex = ' (away from 2)'
--        else:
--            ex = ''
-         if self.Q == 0:
-             yterm = ''
-         else:
-             yterm = '+ (%s)*y '%self.Q
-+
-         s = 'Reduction data about this proper smooth genus 2 curve:\n'
-         s += '\ty^2 %s= %s\n'%(yterm, self.P)
--        s += 'A Minimal Equation (away from 2):\n\ty^2 = %s\n'%self.minimal_equation
--        s += 'Minimal Discriminant (away from 2):  %s\n'%self.minimal_disc
--        s += 'Conductor%s: %s\n'%(ex, self.conductor)
-+        if self.Qmin:
-+            s += 'A Minimal Equation:\n\ty^2 + (%s)y = %s\n'%(self.Qmin, self.Pmin)
-+        else:
-+            s += 'A Minimal Equation:\n\ty^2 = %s\n'%self.Pmin
-+        s += 'Minimal Discriminant: %s\n'%self.minimal_disc
-+        s += 'Conductor: %s\n'%self.conductor
-         s += 'Local Data:\n%s'%self._local_data_str()
-         return s
- 
-@@ -242,17 +242,7 @@ class Genus2reduction(SageObject):
-         sage: factor(R.conductor)
-         5^4 * 2267
- 
--    This means that only the odd part of the conductor is known.
--
--    ::
--
--        sage: R.prime_to_2_conductor_only
--        True
--
--    The discriminant is always minimal away from 2, but possibly not at
--    2.
--
--    ::
-+    The discriminant is always minimal::
- 
-         sage: factor(R.minimal_disc)
-         2^3 * 5^5 * 2267
-@@ -264,10 +254,10 @@ class Genus2reduction(SageObject):
-         sage: R
-         Reduction data about this proper smooth genus 2 curve:
-             y^2 + (x^3 - 2*x^2 - 2*x + 1)*y = -5*x^5
--        A Minimal Equation (away from 2):
--            y^2 = x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855
--        Minimal Discriminant (away from 2):  56675000
--        Conductor (away from 2): 1416875
-+        A Minimal Equation:
-+            y^2 ...
-+        Minimal Discriminant: 56675000
-+        Conductor: 1416875
-         Local Data:
-             p=2
-             (potential) stable reduction:  (II), j=1
-@@ -293,10 +283,10 @@ class Genus2reduction(SageObject):
-         sage: genus2reduction(0, x^6 + 3*x^3 + 63)
-         Reduction data about this proper smooth genus 2 curve:
-                 y^2 = x^6 + 3*x^3 + 63
--        A Minimal Equation (away from 2):
--                y^2 = x^6 + 3*x^3 + 63
--        Minimal Discriminant (away from 2):  10628388316852992
--        Conductor (away from 2): 2893401
-+        A Minimal Equation:
-+                y^2 ...
-+        Minimal Discriminant: -10628388316852992
-+        Conductor: 2893401
-         Local Data:
-                 p=2
-                 (potential) stable reduction:  (V), j1+j2=0, j1*j2=0
-@@ -327,9 +317,9 @@ class Genus2reduction(SageObject):
-         sage: genus2reduction(x^3-x^2-1, x^2 - x)
-         Reduction data about this proper smooth genus 2 curve:
-                 y^2 + (x^3 - x^2 - 1)*y = x^2 - x
--        A Minimal Equation (away from 2):
--                y^2 = x^6 + 58*x^5 + 1401*x^4 + 18038*x^3 + 130546*x^2 + 503516*x + 808561
--        Minimal Discriminant (away from 2):  169
-+        A Minimal Equation:
-+                y^2 ...
-+        Minimal Discriminant: -169
-         Conductor: 169
-         Local Data:
-                 p=13
-@@ -370,10 +360,10 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^3 - 2*x^2 - 2*x + 1, -5*x^5)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^3 - 2*x^2 - 2*x + 1)*y = -5*x^5
--            A Minimal Equation (away from 2):
--                    y^2 = x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855
--            Minimal Discriminant (away from 2):  56675000
--            Conductor (away from 2): 1416875
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 56675000
-+            Conductor: 1416875
-             Local Data:
-                     p=2
-                     (potential) stable reduction:  (II), j=1
-@@ -389,9 +379,9 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^2 + 1, -5*x^5)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^2 + 1)*y = -5*x^5
--            A Minimal Equation (away from 2):
--                    y^2 = -20*x^5 + x^4 + 2*x^2 + 1
--            Minimal Discriminant (away from 2):  48838125
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 48838125
-             Conductor: 32025
-             Local Data:
-                     p=3
-@@ -412,9 +402,9 @@ class Genus2reduction(SageObject):
-             sage: genus2reduction(x^3 + x^2 + x,-2*x^5 + 3*x^4 - x^3 - x^2 - 6*x - 2)
-             Reduction data about this proper smooth genus 2 curve:
-                     y^2 + (x^3 + x^2 + x)*y = -2*x^5 + 3*x^4 - x^3 - x^2 - 6*x - 2
--            A Minimal Equation (away from 2):
--                    y^2 = x^6 + 18*x^3 + 36*x^2 - 27
--            Minimal Discriminant (away from 2):  1520984142
-+            A Minimal Equation:
-+                    y^2 ...
-+            Minimal Discriminant: 1520984142
-             Conductor: 954
-             Local Data:
-                     p=2
-@@ -436,18 +426,10 @@ class Genus2reduction(SageObject):
-             raise ValueError("Q (=%s) must have degree at most 3" % Q)
- 
-         res = pari.genus2red([P, Q])
--
-         conductor = ZZ(res[0])
--        minimal_equation = R(res[2])
--
--        minimal_disc = QQ(res[2].poldisc()).abs()
--        if minimal_equation.degree() == 5:
--            minimal_disc *= minimal_equation[5]**2
--        # Multiply with suitable power of 2 of the form 2^(2*(d-1) - 12)
--        b = 2 * (minimal_equation.degree() - 1)
--        k = QQ((12 - minimal_disc.valuation(2), b)).ceil()
--        minimal_disc >>= 12 - b*k
--        minimal_disc = ZZ(minimal_disc)
-+        Pmin = R(res[2][0])
-+        Qmin = R(res[2][1])
-+        minimal_disc = ZZ(pari.hyperelldisc(res[2]))
- 
-         local_data = {}
-         for red in res[3]:
-@@ -468,9 +450,7 @@ class Genus2reduction(SageObject):
- 
-             local_data[p] = data
- 
--        prime_to_2_conductor_only = (-1 in res[1].component(2))
--        return ReductionData(res, P, Q, minimal_equation, minimal_disc, local_data,
--                             conductor, prime_to_2_conductor_only)
-+        return ReductionData(res, P, Q, Pmin, Qmin, minimal_disc, local_data, conductor)
- 
-     def __reduce__(self):
-         return _reduce_load_genus2reduction, tuple([])
-diff --git a/src/sage/lfunctions/dokchitser.py b/src/sage/lfunctions/dokchitser.py
-index fec450d7bc..236402c293 100644
---- a/src/sage/lfunctions/dokchitser.py
-+++ b/src/sage/lfunctions/dokchitser.py
-@@ -337,6 +337,7 @@ class Dokchitser(SageObject):
-             # After init_coeffs is called, future calls to this method should
-             # return the full output for further parsing
-             raise RuntimeError("unable to create L-series, due to precision or other limits in PARI")
-+        t = t.replace("  *** _^_: Warning: normalizing a series with 0 leading term.\n", "")
-         return t
- 
-     def __check_init(self):
-diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py
-index d2b20f1891..6c31efe239 100644
---- a/src/sage/lfunctions/pari.py
-+++ b/src/sage/lfunctions/pari.py
-@@ -339,7 +339,7 @@ def lfun_eta_quotient(scalings, exponents):
-         0.0374412812685155
- 
-         sage: lfun_eta_quotient([6],[4])
--        [[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4])]], 0, [0, 1], 2, 36, 1]
-+        [[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4]), 0]], 0, [0, 1], 2, 36, 1]
- 
-         sage: lfun_eta_quotient([2,1,4], [5,-2,-2])
-         Traceback (most recent call last):
-diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py
-index e5a2aa2517..0efcb15de0 100644
---- a/src/sage/libs/pari/tests.py
-+++ b/src/sage/libs/pari/tests.py
-@@ -356,7 +356,7 @@ Constructors::
-     [2, 4]~*x + [1, 3]~
- 
-     sage: pari(3).Qfb(7, 1)
--    Qfb(3, 7, 1, 0.E-19)
-+    Qfb(3, 7, 1)
-     sage: pari(3).Qfb(7, 2)
-     Traceback (most recent call last):
-     ...
-@@ -512,7 +512,7 @@ Basic functions::
-     sage: pari('sqrt(-2)').frac()
-     Traceback (most recent call last):
-     ...
--    PariError: incorrect type in gfloor (t_COMPLEX)
-+    PariError: incorrect type in gfrac (t_COMPLEX)
- 
-     sage: pari('1+2*I').imag()
-     2
-diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py
-index 25d93cac92..157ebabe29 100644
---- a/src/sage/modular/cusps_nf.py
-+++ b/src/sage/modular/cusps_nf.py
-@@ -1220,7 +1220,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/modform_hecketriangle/hecke_triangle_group_element.py b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-index a881336596..090d1bfaf0 100644
---- a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-+++ b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py
-@@ -43,7 +43,7 @@ def coerce_AA(p):
-         sage: AA(p)._exact_field()
-         Number Field in a with defining polynomial y^8 ... with a in ...
-         sage: coerce_AA(p)._exact_field()
--        Number Field in a with defining polynomial y^4 - 1910*y^2 - 3924*y + 681058 with a in 39.710518724...?
-+        Number Field in a with defining polynomial y^4 - 1910*y^2 - 3924*y + 681058 with a in ...?
-     """
-     el = AA(p)
-     el.simplify()
-diff --git a/src/sage/modular/modsym/p1list_nf.py b/src/sage/modular/modsym/p1list_nf.py
-index 222caacca8..f9d969732c 100644
---- a/src/sage/modular/modsym/p1list_nf.py
-+++ b/src/sage/modular/modsym/p1list_nf.py
-@@ -58,7 +58,7 @@ Lift an MSymbol to a matrix in `SL(2, R)`:
- 
-     sage: alpha = MSymbol(N, a + 2, 3*a^2)
-     sage: alpha.lift_to_sl2_Ok()
--    [-3*a^2 + a + 12, 25*a^2 - 50*a + 100, a + 2, a^2 - 3*a + 3]
-+    [-1, 4*a^2 - 13*a + 23, a + 2, 5*a^2 + 3*a - 3]
-     sage: Ok = k.ring_of_integers()
-     sage: M = Matrix(Ok, 2, alpha.lift_to_sl2_Ok())
-     sage: det(M)
-@@ -945,11 +945,11 @@ class P1NFList(SageObject):
-             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])
--            1
-+            5
- 
-         ::
- 
-diff --git a/src/sage/modules/free_quadratic_module_integer_symmetric.py b/src/sage/modules/free_quadratic_module_integer_symmetric.py
-index a206f0c721..aeb19ab669 100644
---- a/src/sage/modules/free_quadratic_module_integer_symmetric.py
-+++ b/src/sage/modules/free_quadratic_module_integer_symmetric.py
-@@ -1168,11 +1168,11 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
-             sage: A4 = IntegralLattice("A4")
-             sage: Aut = A4.orthogonal_group()
-             sage: Aut
--            Group of isometries with 5 generators (
--            [-1  0  0  0]  [0 0 0 1]  [-1 -1 -1  0]  [ 1  0  0  0]  [ 1  0  0  0]
--            [ 0 -1  0  0]  [0 0 1 0]  [ 0  0  0 -1]  [-1 -1 -1 -1]  [ 0  1  0  0]
--            [ 0  0 -1  0]  [0 1 0 0]  [ 0  0  1  1]  [ 0  0  0  1]  [ 0  0  1  1]
--            [ 0  0  0 -1], [1 0 0 0], [ 0  1  0  0], [ 0  0  1  0], [ 0  0  0 -1]
-+            Group of isometries with 4 generators (
-+            [0 0 0 1]  [-1 -1 -1  0]  [ 1  0  0  0]  [ 1  0  0  0]
-+            [0 0 1 0]  [ 0  0  0 -1]  [-1 -1 -1 -1]  [ 0  1  0  0]
-+            [0 1 0 0]  [ 0  0  1  1]  [ 0  0  0  1]  [ 0  0  1  1]
-+            [1 0 0 0], [ 0  1  0  0], [ 0  0  1  0], [ 0  0  0 -1]
-             )
- 
-         The group acts from the right on the lattice and its discriminant group::
-@@ -1180,19 +1180,19 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
-             sage: x = A4.an_element()
-             sage: g = Aut.an_element()
-             sage: g
--            [ 1  1  1  0]
--            [ 0  0 -1  0]
--            [ 0  0  1  1]
--            [ 0 -1 -1 -1]
-+            [-1 -1 -1  0]
-+            [ 0  0  1  0]
-+            [ 0  0 -1 -1]
-+            [ 0  1  1  1]
-             sage: x*g
--            (1, 1, 1, 0)
-+            (-1, -1, -1, 0)
-             sage: (x*g).parent()==A4
-             True
-             sage: (g*x).parent()
-             Vector space of dimension 4 over Rational Field
-             sage: y = A4.discriminant_group().an_element()
-             sage: y*g
--            (1)
-+            (4)
- 
-         If the group is finite we can compute the usual things::
- 
-@@ -1208,10 +1208,10 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b
- 
-             sage: A2 = IntegralLattice(matrix.identity(3),Matrix(ZZ,2,3,[1,-1,0,0,1,-1]))
-             sage: A2.orthogonal_group()
--            Group of isometries with 3 generators (
--            [-1/3  2/3  2/3]  [ 2/3  2/3 -1/3]  [1 0 0]
--            [ 2/3 -1/3  2/3]  [ 2/3 -1/3  2/3]  [0 0 1]
--            [ 2/3  2/3 -1/3], [-1/3  2/3  2/3], [0 1 0]
-+            Group of isometries with 2 generators (
-+            [ 2/3  2/3 -1/3]  [1 0 0]
-+            [ 2/3 -1/3  2/3]  [0 0 1]
-+            [-1/3  2/3  2/3], [0 1 0]
-             )
- 
-         It can be negative definite as well::
-diff --git a/src/sage/quadratic_forms/binary_qf.py b/src/sage/quadratic_forms/binary_qf.py
-index cfa3ada73e..5ac823bc6c 100755
---- a/src/sage/quadratic_forms/binary_qf.py
-+++ b/src/sage/quadratic_forms/binary_qf.py
-@@ -141,7 +141,7 @@ class BinaryQF(SageObject):
-                   and a.degree() == 2 and a.parent().ngens() == 2):
-                 x, y = a.parent().gens()
-                 a, b, c = [a.monomial_coefficient(mon) for mon in [x**2, x*y, y**2]]
--            elif isinstance(a, pari_gen) and a.type() in ('t_QFI', 't_QFR'):
-+            elif isinstance(a, pari_gen) and a.type() in ('t_QFI', 't_QFR', 't_QFB'):
-                 # a has 3 or 4 components
-                 a, b, c = a[0], a[1], a[2]
-         try:
-diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py
-index 8290b6c4fa..0fc43f33c6 100644
---- a/src/sage/quadratic_forms/genera/genus.py
-+++ b/src/sage/quadratic_forms/genera/genus.py
-@@ -3088,8 +3088,8 @@ class GenusSymbol_global_ring():
-             sage: G = Genus(matrix(ZZ, 3, [6,3,0, 3,6,0, 0,0,2]))
-             sage: G.representatives()
-             (
--            [2 0 0]  [ 2 -1  0]
--            [0 6 3]  [-1  2  0]
-+            [2 0 0]  [ 2  1  0]
-+            [0 6 3]  [ 1  2  0]
-             [0 3 6], [ 0  0 18]
-             )
- 
-diff --git a/src/sage/quadratic_forms/qfsolve.py b/src/sage/quadratic_forms/qfsolve.py
-index ddde95e04f..d5e15d9f83 100644
---- a/src/sage/quadratic_forms/qfsolve.py
-+++ b/src/sage/quadratic_forms/qfsolve.py
-@@ -70,7 +70,7 @@ def qfsolve(G):
- 
-         sage: M = Matrix(QQ, [[3, 0, 0, 0], [0, 5, 0, 0], [0, 0, -7, 0], [0, 0, 0, -11]])
-         sage: qfsolve(M)
--        (3, -4, -3, -2)
-+        (3, 4, -3, -2)
-     """
-     ret = G.__pari__().qfsolve()
-     if ret.type() == 't_COL':
-diff --git a/src/sage/quadratic_forms/quadratic_form__automorphisms.py b/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-index c36c667e3b..3d72cf3be1 100644
---- a/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-+++ b/src/sage/quadratic_forms/quadratic_form__automorphisms.py
-@@ -300,9 +300,9 @@ def automorphism_group(self):
-         sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1])
-         sage: Q.automorphism_group()
-         Matrix group over Rational Field with 3 generators (
--        [-1  0  0]  [0 0 1]  [ 0  0  1]
--        [ 0 -1  0]  [0 1 0]  [-1  0  0]
--        [ 0  0 -1], [1 0 0], [ 0  1  0]
-+        [ 0  0  1]  [1 0 0]  [ 1  0  0]
-+        [-1  0  0]  [0 0 1]  [ 0 -1  0]
-+        [ 0  1  0], [0 1 0], [ 0  0  1]
-         )
- 
-     ::
-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 9129ecb56a..d5a4cb8f22 100644
---- a/src/sage/rings/finite_rings/finite_field_prime_modn.py
-+++ b/src/sage/rings/finite_rings/finite_field_prime_modn.py
-@@ -111,7 +111,7 @@ class FiniteField_prime_modn(FiniteField_generic, integer_mod_ring.IntegerModRin
-             sage: RF13 = K.residue_field(pp)
-             sage: RF13.hom([GF(13)(1)])
-             Ring morphism:
--             From: Residue field of Fractional ideal (w + 18)
-+             From: Residue field of Fractional ideal (-w - 18)
-              To:   Finite Field of size 13
-              Defn: 1 |--> 1
- 
-diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx
-index 7596f2a302..1e1869f1b1 100644
---- a/src/sage/rings/finite_rings/residue_field.pyx
-+++ b/src/sage/rings/finite_rings/residue_field.pyx
-@@ -20,13 +20,13 @@ monogenic (i.e., 2 is an essential discriminant divisor)::
- 
-     sage: K.<a> = 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)
-+    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)
-     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`::
- 
-@@ -258,9 +258,9 @@ class ResidueFieldFactory(UniqueFactory):
-     the index of ``ZZ[a]`` in the maximal order for all ``a``::
- 
-         sage: K.<a> = NumberField(x^3 + x^2 - 2*x + 8); P = K.ideal(2).factor()[0][0]; P
--        Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F = K.residue_field(P); F
--        Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F(a)
-         0
-         sage: B = K.maximal_order().basis(); B
-@@ -270,7 +270,7 @@ class ResidueFieldFactory(UniqueFactory):
-         sage: F(B[2])
-         0
-         sage: F
--        Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+        Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
-         sage: F.degree()
-         1
- 
-@@ -730,15 +730,15 @@ class ResidueField_generic(Field):
-         EXAMPLES::
- 
-             sage: I = QQ[3^(1/3)].factor(5)[1][0]; I
--            Fractional ideal (-a + 2)
-+            Fractional ideal (a - 2)
-             sage: k = I.residue_field(); k
--            Residue field of Fractional ideal (-a + 2)
-+            Residue field of Fractional ideal (a - 2)
-             sage: f = k.lift_map(); f
-             Lifting map:
--              From: Residue field of Fractional ideal (-a + 2)
-+              From: Residue field of Fractional ideal (a - 2)
-               To:   Maximal Order in Number Field in a with defining polynomial x^3 - 3 with a = 1.442249570307409?
-             sage: f.domain()
--            Residue field of Fractional ideal (-a + 2)
-+            Residue field of Fractional ideal (a - 2)
-             sage: f.codomain()
-             Maximal Order in Number Field in a with defining polynomial x^3 - 3 with a = 1.442249570307409?
-             sage: f(k.0)
-@@ -768,7 +768,7 @@ class ResidueField_generic(Field):
- 
-             sage: K.<a> = NumberField(x^3-11)
-             sage: F = K.ideal(37).factor(); F
--            (Fractional ideal (37, a + 9)) * (Fractional ideal (37, a + 12)) * (Fractional ideal (2*a - 5))
-+            (Fractional ideal (37, a + 9)) * (Fractional ideal (37, a + 12)) * (Fractional ideal (-2*a + 5))
-             sage: k = K.residue_field(F[0][0])
-             sage: l = K.residue_field(F[1][0])
-             sage: k == l
-@@ -846,7 +846,7 @@ cdef class ReductionMap(Map):
-             sage: F.reduction_map()
-             Partially defined reduction map:
-               From: Number Field in a with defining polynomial x^3 + x^2 - 2*x + 8
--              To:   Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1)
-+              To:   Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
- 
-             sage: K.<theta_5> = CyclotomicField(5)
-             sage: F = K.factor(7)[0][0].residue_field()
-diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py
-index e99dff850f..759cbfb334 100644
---- a/src/sage/rings/number_field/S_unit_solver.py
-+++ b/src/sage/rings/number_field/S_unit_solver.py
-@@ -1781,20 +1781,20 @@ def sieve_ordering(SUK, q):
-         sage: SUK = K.S_unit_group(S=3)
-         sage: sieve_data = list(sieve_ordering(SUK, 19))
-         sage: sieve_data[0]
--        (Fractional ideal (xi - 3),
--         Fractional ideal (-2*xi^2 + 3),
-+        (Fractional ideal (-2*xi^2 + 3),
-+         Fractional ideal (-xi + 3),
-          Fractional ideal (2*xi + 1))
- 
-         sage: sieve_data[1]
--        (Residue field of Fractional ideal (xi - 3),
--         Residue field of Fractional ideal (-2*xi^2 + 3),
-+        (Residue field of Fractional ideal (-2*xi^2 + 3),
-+         Residue field of Fractional ideal (-xi + 3),
-          Residue field of Fractional ideal (2*xi + 1))
- 
-         sage: sieve_data[2]
--        ([18, 7, 16, 4], [18, 9, 12, 8], [18, 3, 10, 10])
-+        ([18, 12, 16, 8], [18, 16, 10, 4], [18, 10, 12, 10])
- 
-         sage: sieve_data[3]
--        (486, 648, 11664)
-+        (648, 2916, 3888)
-     """
- 
-     K = SUK.number_field()
-diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py
-index beb047ae02..b7c8c33d0b 100644
---- a/src/sage/rings/number_field/bdd_height.py
-+++ b/src/sage/rings/number_field/bdd_height.py
-@@ -248,7 +248,7 @@ def bdd_norm_pr_ideal_gens(K, norm_list):
-         sage: from sage.rings.number_field.bdd_height import bdd_norm_pr_ideal_gens
-         sage: K.<g> = QuadraticField(123)
-         sage: bdd_norm_pr_ideal_gens(K, range(5))
--        {0: [0], 1: [1], 2: [-g - 11], 3: [], 4: [2]}
-+        {0: [0], 1: [1], 2: [g + 11], 3: [], 4: [2]}
- 
-     ::
- 
-diff --git a/src/sage/rings/number_field/class_group.py b/src/sage/rings/number_field/class_group.py
-index 018ff5f5c6..73c0462cd1 100644
---- a/src/sage/rings/number_field/class_group.py
-+++ b/src/sage/rings/number_field/class_group.py
-@@ -221,11 +221,11 @@ class FractionalIdealClass(AbelianGroupWithValuesElement):
-             Class group of order 76 with structure C38 x C2
-             of Number Field in a with defining polynomial x^2 + 20072
-             sage: I = (G.0)^11; I
--            Fractional ideal class (41, 1/2*a + 5)
-+            Fractional ideal class (33, 1/2*a + 8)
-             sage: J = G(I.ideal()^5); J
--            Fractional ideal class (115856201, 1/2*a + 40407883)
-+            Fractional ideal class (39135393, 1/2*a + 13654253)
-             sage: J.reduce()
--            Fractional ideal class (57, 1/2*a + 44)
-+            Fractional ideal class (73, 1/2*a + 47)
-             sage: J == I^5
-             True
-         """
-diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py
-index 79acd053bb..e060148e4d 100644
---- a/src/sage/rings/number_field/galois_group.py
-+++ b/src/sage/rings/number_field/galois_group.py
-@@ -944,7 +944,7 @@ class GaloisGroup_v2(GaloisGroup_perm):
-             sage: K.<b> = 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,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)]
-+            [(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)]
-             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 58463d570d..ff65634e99 100644
---- a/src/sage/rings/number_field/number_field.py
-+++ b/src/sage/rings/number_field/number_field.py
-@@ -3643,7 +3643,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: L.<b> = K.extension(x^2 - 3, x^2 + 1)
-             sage: M.<c> = 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
- 
-@@ -4227,7 +4227,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             (y^2 + 6, Mod(1/6*y, y^2 + 6), Mod(6*y, y^2 + 1/6))
-         """
-         f = self.absolute_polynomial()._pari_with_name('y')
--        if f.pollead() == f.content().denominator() == 1:
-+        f = f * f.content().denominator()
-+        if f.pollead() == 1:
-             g = f
-             alpha = beta = g.variable().Mod(g)
-         else:
-@@ -4821,7 +4822,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: K.<a> = 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))]
-@@ -5166,7 +5167,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: [K.ideal(g).factor() for g in gens]
-             [(Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1)),
--            Fractional ideal (-a),
-+            Fractional ideal (a),
-             (Fractional ideal (2, a + 1))^2,
-             1]
- 
-@@ -5751,7 +5752,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: K.elements_of_norm(3)
-             []
-             sage: K.elements_of_norm(50)
--            [-7*a + 1, 5*a - 5, 7*a + 1]
-+            [-a - 7, 5*a - 5, 7*a + 1]
- 
-         TESTS:
- 
-@@ -5863,7 +5864,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             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 (-3*a - 2))
-+            (Fractional ideal (a + 1)) * (Fractional ideal (-a - 2))^-1 * (Fractional ideal (2*a + 1))^-1 * (Fractional ideal (-2*a + 3))
- 
-         An example over a relative number field::
- 
-@@ -6460,9 +6461,9 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: new_basis = k.reduced_basis(prec=120)
-             sage: [c.minpoly() for c in new_basis]
-             [x - 1,
--             x^2 - 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^6 - 3*x^5 - 102*x^4 + 315*x^3 + 10254*x^2 - 80955*x + 198147,
-              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)
-@@ -7058,7 +7059,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-              -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,
--             -a^14 - a^13 + a^12 + 2*a^10 + a^8 - 2*a^7 - 2*a^6 + 2*a^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)
- 
-         TESTS:
- 
-@@ -7067,7 +7068,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
- 
-             sage: K.<a> = NumberField(1/2*x^2 - 1/6)
-             sage: K.units()
--            (-3*a + 2,)
-+            (3*a - 2,)
-         """
-         proof = proof_flag(proof)
- 
-@@ -7146,7 +7147,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
-             sage: U.gens()
-             (u0, u1, u2, u3, u4, u5, u6, u7, u8)
-             sage: U.gens_values()  # result not independently verified
--            [-1, -a^9 - a + 1, -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, -a^14 - a^13 + a^12 + 2*a^10 + a^8 - 2*a^7 - 2*a^6 + 2*a^3 - a^2 + 2*a - 2]
-+            [-1, -a^9 - a + 1, -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]
-         """
-         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 784c239dc1..aa740069dc 100644
---- a/src/sage/rings/number_field/number_field_element.pyx
-+++ b/src/sage/rings/number_field/number_field_element.pyx
-@@ -4446,7 +4446,7 @@ cdef class NumberFieldElement(FieldElement):
-             sage: f = Qi.embeddings(K)[0]
-             sage: a = f(2+3*i) * (2-zeta)^2
-             sage: a.descend_mod_power(Qi,2)
--            [-3*i - 2, -2*i + 3]
-+            [-2*i + 3, 3*i + 2]
- 
-         An absolute example::
- 
-@@ -5124,7 +5124,7 @@ cdef class NumberFieldElement_relative(NumberFieldElement):
-         EXAMPLES::
- 
-             sage: K.<a, b, c> = NumberField([x^2 - 2, x^2 - 3, x^2 - 5])
--            sage: P = K.prime_factors(5)[0]
-+            sage: P = K.prime_factors(5)[1]
-             sage: (2*a + b - c).valuation(P)
-             1
-         """
-diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
-index 5f587556a4..33481fead0 100644
---- a/src/sage/rings/number_field/number_field_ideal.py
-+++ b/src/sage/rings/number_field/number_field_ideal.py
-@@ -3355,7 +3355,7 @@ def quotient_char_p(I, p):
-         []
- 
-         sage: I = K.factor(13)[0][0]; I
--        Fractional ideal (-3*i - 2)
-+        Fractional ideal (-2*i + 3)
-         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 bae36d4b9c..f64bd5b761 100644
---- a/src/sage/rings/number_field/number_field_ideal_rel.py
-+++ b/src/sage/rings/number_field/number_field_ideal_rel.py
-@@ -272,7 +272,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = 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
-@@ -401,7 +401,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = K.extension(5*x^2 + 1)
-             sage: P = L.primes_above(2)[0]
-             sage: P.relative_norm()
--            Fractional ideal (-6*a + 2)
-+            Fractional ideal (6*a + 2)
-         """
-         L = self.number_field()
-         K = L.base_field()
-@@ -518,7 +518,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
-             sage: L.<b> = K.extension(5*x^2 + 1)
-             sage: P = L.primes_above(2)[0]
-             sage: P.ideal_below()
--            Fractional ideal (-6*a + 2)
-+            Fractional ideal (6*a + 2)
-         """
-         L = self.number_field()
-         K = L.base_field()
-diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py
-index d33980c4b1..50e846b205 100644
---- a/src/sage/rings/number_field/number_field_rel.py
-+++ b/src/sage/rings/number_field/number_field_rel.py
-@@ -213,14 +213,14 @@ class NumberField_relative(NumberField_generic):
-             sage: l.<b> = 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 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4), ..., y^4 + 6*y^2 + 1, x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4)], [0, 0]]
-+            [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]]
-             sage: b
-             b
- 
-             sage: l.<b> = 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 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4), ..., y^4 + 6*y^2 + 1, x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4)], [0, 0]]
-+            [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]]
-             sage: b
-             b
- 
-diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py
-index 6eca89ed8d..78ef4c3b33 100644
---- a/src/sage/rings/number_field/order.py
-+++ b/src/sage/rings/number_field/order.py
-@@ -520,7 +520,7 @@ class Order(IntegralDomain, sage.rings.abc.Order):
-             sage: k.<a> = 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 (11, a + 7)
-+            Fractional ideal class (43, a + 13)
-             sage: Ok = k.maximal_order(); Ok
-             Maximal Order in Number Field in a with defining polynomial x^2 + 5077
-             sage: Ok * (11, a + 7)
-diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py
-index c534aaa9f6..6bc67565d2 100644
---- a/src/sage/rings/number_field/selmer_group.py
-+++ b/src/sage/rings/number_field/selmer_group.py
-@@ -491,7 +491,7 @@ 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 (a),
-         (Fractional ideal (2, a + 1))^2,
-         1]
- 
-diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py
-index bb5d8356be..8a7e5fa66f 100644
---- a/src/sage/rings/polynomial/polynomial_quotient_ring.py
-+++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py
-@@ -1791,7 +1791,7 @@ class PolynomialQuotientRing_generic(CommutativeRing):
-             sage: D.selmer_generators([K.ideal(2, -a+1), K.ideal(3, a+1)], 3)
-             [2, a + 1]
-             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))
-diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
-index 704b77ce5f..83ee4549e4 100644
---- a/src/sage/rings/qqbar.py
-+++ b/src/sage/rings/qqbar.py
-@@ -312,8 +312,8 @@ and we get a way to produce the number directly::
-     True
-     sage: sage_input(n)
-     R.<y> = QQ[]
--    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(RR(0.51763809020504148), RR(0.51763809020504159)))
--    -109*v^3 - 89*v^2 + 327*v + 178
-+    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(-RR(1.9318516525781366), -RR(1.9318516525781364)))
-+    -109*v^3 + 89*v^2 + 327*v - 178
- 
- We can also see that some computations (basically, those which are
- easy to perform exactly) are performed directly, instead of storing
-@@ -362,7 +362,7 @@ algorithms in :trac:`10255`::
-     # Verified
-     R1.<x> = QQbar[]
-     R2.<y> = QQ[]
--    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(RR(0.51763809020504148), RR(0.51763809020504159)))
-+    v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(-RR(1.9318516525781366), -RR(1.9318516525781364)))
-     AA.polynomial_root(AA.common_polynomial(x^4 + QQbar(v^3 - 3*v - 1)*x^3 + QQbar(-v^3 + 3*v - 3)*x^2 + QQbar(-3*v^3 + 9*v + 3)*x + QQbar(3*v^3 - 9*v)), RIF(RR(0.99999999999999989), RR(1.0000000000000002)))
-     sage: one
-     1
-@@ -2310,7 +2310,7 @@ def do_polred(poly, threshold=32):
-     cost = 2 * bitsize.nbits() + 5 * poly.degree().nbits()
-     if cost > threshold:
-         return parent.gen(), parent.gen(), poly
--    new_poly, elt_back = poly.__pari__().polredbest(flag=1)
-+    new_poly, elt_back = poly.numerator().__pari__().polredbest(flag=1)
-     elt_fwd = elt_back.modreverse()
-     return parent(elt_fwd.lift()), parent(elt_back.lift()), parent(new_poly)
- 
-@@ -2542,10 +2542,10 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-            Defn: a |--> 1.414213562373095?)
- 
-         sage: number_field_elements_from_algebraics((rt2,rt3))
--        (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, -a^2 + 2], Ring morphism:
-+        (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, a^2 - 2], Ring morphism:
-             From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-             To:   Algebraic Real Field
--            Defn: a |--> 0.5176380902050415?)
-+            Defn: a |--> -1.931851652578137?)
- 
-     ``rt3a`` is a real number in ``QQbar``.  Ordinarily, we'd get a homomorphism
-     to ``AA`` (because all elements are real), but if we specify ``same_field=True``,
-@@ -2570,7 +2570,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^3 + 3*a, Ring morphism:
-             From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-             To:   Algebraic Real Field
--            Defn: a |--> 0.5176380902050415?)
-+            Defn: a |--> -1.931851652578137?)
- 
-     We can specify ``minimal=True`` if we want the smallest number field::
- 
-@@ -2618,7 +2618,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         sage: nfI^2
-         -1
-         sage: sum = nfrt2 + nfrt3 + nfI + nfz3; sum
--        2*a^6 + a^5 - a^4 - a^3 - 2*a^2 - a
-+        a^5 + a^4 - a^3 + 2*a^2 - a - 1
-         sage: hom(sum)
-         2.646264369941973? + 1.866025403784439?*I
-         sage: hom(sum) == rt2 + rt3 + qqI + z3
-@@ -2658,7 +2658,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-         sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True)
-         sage: nf
-         Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1
--          with a = 0.2598678911433438? + 0.0572892247058457?*I
-+          with a = 0.2598679? + 0.0572892?*I
-         sage: list(map(QQbar, nums)) == elems == list(map(hom, nums))
-         True
- 
-@@ -2725,7 +2725,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal
-                          sqrt(2), AA.polynomial_root(x^3-3, RIF(0,3)), 11/9, 1]
-         sage: res = number_field_elements_from_algebraics(my_nums, embedded=True)
-         sage: res[0]
--        Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = -95.5053039433554?
-+        Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = 93.32530798172420?
-     """
-     gen = qq_generator
- 
-@@ -3129,7 +3129,7 @@ class AlgebraicGenerator(SageObject):
-             sage: root = ANRoot(x^2 - x - 1, RIF(1, 2))
-             sage: gen = AlgebraicGenerator(nf, root)
-             sage: gen.pari_field()
--             [y^2 - y - 1, [2, 0], ...]
-+            [[y^2 - y - 1, [2, 0], ...]
-         """
-         if self.is_trivial():
-             raise ValueError("No PARI field attached to trivial generator")
-@@ -3213,7 +3213,7 @@ class AlgebraicGenerator(SageObject):
-             sage: qq_generator.union(gen3) is gen3
-             True
-             sage: gen2.union(gen3)
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-         """
-         if self._trivial:
-             return other
-@@ -3306,13 +3306,13 @@ class AlgebraicGenerator(SageObject):
-             Number Field in a with defining polynomial y^2 - 3 with a in 1.732050807568878?
-             sage: gen2_3 = gen2.union(gen3)
-             sage: gen2_3
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-             sage: qq_generator.super_poly(gen2) is None
-             True
-             sage: gen2.super_poly(gen2_3)
-             -a^3 + 3*a
-             sage: gen3.super_poly(gen2_3)
--            -a^2 + 2
-+            a^2 - 2
- 
-         """
-         if checked is None:
-@@ -3360,13 +3360,13 @@ class AlgebraicGenerator(SageObject):
-             sage: sqrt3 = ANExtensionElement(gen3, nf3.gen())
-             sage: gen2_3 = gen2.union(gen3)
-             sage: gen2_3
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137?
-             sage: gen2_3(sqrt2)
-             -a^3 + 3*a
-             sage: gen2_3(ANRational(1/7))
-             1/7
-             sage: gen2_3(sqrt3)
--            -a^2 + 2
-+            a^2 - 2
-         """
-         if self._trivial:
-             return elt._value
-@@ -4336,10 +4336,10 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: rt3 = AA(sqrt(3))
-             sage: rt3b = rt2 + rt3 - rt2
-             sage: rt3b.as_number_field_element()
--            (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^2 + 2, Ring morphism:
-+            (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, a^2 - 2, Ring morphism:
-                 From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1
-                 To:   Algebraic Real Field
--                Defn: a |--> 0.5176380902050415?)
-+                Defn: a |--> -1.931851652578137?)
-             sage: rt3b.as_number_field_element(minimal=True)
-             (Number Field in a with defining polynomial y^2 - 3, a, Ring morphism:
-                From: Number Field in a with defining polynomial y^2 - 3
-@@ -4401,7 +4401,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: rt2b = rt3 + rt2 - rt3
-             sage: rt2b.exactify()
-             sage: rt2b._exact_value()
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b.simplify()
-             sage: rt2b._exact_value()
-             a where a^2 - 2 = 0 and a in 1.414213562373095?
-@@ -4422,7 +4422,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: QQbar(2)._exact_field()
-             Trivial generator
-             sage: (sqrt(QQbar(2)) + sqrt(QQbar(19)))._exact_field()
--            Number Field in a with defining polynomial y^4 - 20*y^2 + 81 with a in 2.375100220297941?
-+            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?
-         """
-@@ -4442,7 +4442,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
-             sage: QQbar(2)._exact_value()
-             2
-             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 2.375100220297941?
-+            -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?
-         """
-@@ -6857,7 +6857,7 @@ class AlgebraicPolynomialTracker(SageObject):
-             sage: p = sqrt(AA(2)) * x^2 - sqrt(AA(3))
-             sage: cp = AA.common_polynomial(p)
-             sage: cp.generator()
--            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 1.931851652578137?
-+            Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -0.5176380902050415?
-         """
-         self.exactify()
-         return self._gen
-@@ -7706,7 +7706,7 @@ class ANExtensionElement(ANDescr):
- 
-             sage: rt2b.exactify()
-             sage: rt2b._descr
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b._descr.is_simple()
-             False
-         """
-@@ -7791,7 +7791,7 @@ class ANExtensionElement(ANDescr):
-             sage: rt2b = rt3 + rt2 - rt3
-             sage: rt2b.exactify()
-             sage: rt2b._descr
--            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137?
-+            a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415?
-             sage: rt2b._descr.simplify(rt2b)
-             a where a^2 - 2 = 0 and a in 1.414213562373095?
-         """
-@@ -7830,9 +7830,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.neg(a)
--            1/3*a^3 - 2/3*a^2 + 4/3*a - 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-             sage: b.neg("ham spam and eggs")
--            1/3*a^3 - 2/3*a^2 + 4/3*a - 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-         """
-         return ANExtensionElement(self._generator, -self._value)
- 
-@@ -7848,9 +7848,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.invert(a)
--            7/3*a^3 - 2/3*a^2 + 4/3*a - 12 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-             sage: b.invert("ham spam and eggs")
--            7/3*a^3 - 2/3*a^2 + 4/3*a - 12 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I
-+            -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I
-         """
-         return ANExtensionElement(self._generator, ~self._value)
- 
-@@ -7866,9 +7866,9 @@ class ANExtensionElement(ANDescr):
-             sage: type(b)
-             <class 'sage.rings.qqbar.ANExtensionElement'>
-             sage: b.conjugate(a)
--            -1/3*a^3 + 2/3*a^2 - 4/3*a + 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? + 1.573132184970987?*I
-+            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
-             sage: b.conjugate("ham spam and eggs")
--            -1/3*a^3 + 2/3*a^2 - 4/3*a + 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? + 1.573132184970987?*I
-+            1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I
-         """
-         if self._exactly_real:
-             return self
-@@ -8501,7 +8501,7 @@ def an_binop_expr(a, b, op):
-         sage: x = an_binop_expr(a, b, operator.add); x
-         <sage.rings.qqbar.ANBinaryExpr object at ...>
-         sage: x.exactify()
--        -6/7*a^7 + 2/7*a^6 + 71/7*a^5 - 26/7*a^4 - 125/7*a^3 + 72/7*a^2 + 43/7*a - 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in 3.12580...?
-+        6/7*a^7 - 2/7*a^6 - 71/7*a^5 + 26/7*a^4 + 125/7*a^3 - 72/7*a^2 - 43/7*a + 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997?
- 
-         sage: a = QQbar(sqrt(2)) + QQbar(sqrt(3))
-         sage: b = QQbar(sqrt(3)) + QQbar(sqrt(5))
-@@ -8510,7 +8510,7 @@ def an_binop_expr(a, b, op):
-         sage: x = an_binop_expr(a, b, operator.mul); x
-         <sage.rings.qqbar.ANBinaryExpr object at ...>
-         sage: x.exactify()
--        2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in 3.1258...?
-+        2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997?
-     """
-     return ANBinaryExpr(a, b, op)
- 
-diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py
-index 1c4f2dff18..32c2e47e49 100644
---- a/src/sage/schemes/affine/affine_morphism.py
-+++ b/src/sage/schemes/affine/affine_morphism.py
-@@ -1148,9 +1148,9 @@ class SchemeMorphism_polynomial_affine_space_field(SchemeMorphism_polynomial_aff
-             sage: H = End(A)
-             sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)])
-             sage: f.reduce_base_field()
--            Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = 1.931851652578137?
-+            Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = ...?
-               Defn: Defined on coordinates by sending (x) to
--                    (((a^3 - 3*a)*x^2 + (1/3*a^2 - 2/3))/(5*x))
-+                    (((a^3 - 3*a)*x^2 + (-1/3*a^2 + 2/3))/(5*x))
- 
-         ::
- 
-diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py
-index 68b8375dae..48f358ea6a 100644
---- a/src/sage/schemes/elliptic_curves/ell_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_field.py
-@@ -845,7 +845,7 @@ class EllipticCurve_field(ell_generic.EllipticCurve_generic, ProjectivePlaneCurv
-             sage: E = E.base_extend(G).quadratic_twist(c); E
-             Elliptic Curve defined 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.<b> = E.division_field(3, simplify_all=True); K
--            Number Field in b with defining polynomial x^12 - 10*x^10 + 55*x^8 - 60*x^6 + 75*x^4 + 1350*x^2 + 2025
-+            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_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py
-index 926ae310ea..3bae819fb0 100644
---- a/src/sage/schemes/elliptic_curves/ell_generic.py
-+++ b/src/sage/schemes/elliptic_curves/ell_generic.py
-@@ -3324,8 +3324,8 @@ class EllipticCurve_generic(WithEqualityById, plane_curve.ProjectivePlaneCurve):
-             sage: K.<a> = QuadraticField(2)
-             sage: E = EllipticCurve([1,a])
-             sage: E.pari_curve()
--            [Mod(0, y^2 - 2), Mod(0, y^2 - 2), Mod(0, y^2 - 2), Mod(1, y^2 - 2),
--            Mod(y, y^2 - 2), Mod(0, y^2 - 2), Mod(2, y^2 - 2), Mod(4*y, y^2 - 2),
-+            [0, 0, 0, Mod(1, y^2 - 2),
-+            Mod(y, y^2 - 2), 0, Mod(2, y^2 - 2), Mod(4*y, y^2 - 2),
-             Mod(-1, y^2 - 2), Mod(-48, y^2 - 2), Mod(-864*y, y^2 - 2),
-             Mod(-928, y^2 - 2), Mod(3456/29, y^2 - 2), Vecsmall([5]),
-             [[y^2 - 2, [2, 0], 8, 1, [[1, -1.41421356237310;
-diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
-index edbd196090..c44c803aa8 100644
---- a/src/sage/schemes/elliptic_curves/ell_number_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
-@@ -218,7 +218,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: E == loads(dumps(E))
-             True
-             sage: E.simon_two_descent()
--            (2, 2, [(0 : 0 : 1)])
-+            (2, 2, [(0 : 0 : 1), (1/18*a + 7/18 : -5/54*a - 17/54 : 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)])
- 
-@@ -274,7 +274,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: E.simon_two_descent()  # long time (4s on sage.math, 2013)
-             (3,
-              3,
--             [(5/8*zeta43_0^2 + 17/8*zeta43_0 - 9/4 : -27/16*zeta43_0^2 - 103/16*zeta43_0 + 39/8 : 1),
-+             [(1/8*zeta43_0^2 - 3/8*zeta43_0 - 1/4 : -5/16*zeta43_0^2 + 7/16*zeta43_0 + 1/8 : 1),
-               (0 : 0 : 1)])
-         """
-         verbose = int(verbose)
-@@ -865,7 +865,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             Conductor exponent: 1
-             Kodaira Symbol: I1
-             Tamagawa Number: 1,
--            Local data at Fractional ideal (-3*i - 2):
-+            Local data at Fractional ideal (-2*i + 3):
-             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
-             Minimal discriminant valuation: 2
-@@ -2645,12 +2645,12 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             [-92, -23, -23]
- 
-             sage: C.matrix()  # long time
--            [1 2 2 4 2 4]
--            [2 1 2 2 4 4]
--            [2 2 1 4 4 2]
--            [4 2 4 1 3 3]
--            [2 4 4 3 1 3]
--            [4 4 2 3 3 1]
-+            [1 2 2 4 4 2]
-+            [2 1 2 4 2 4]
-+            [2 2 1 2 4 4]
-+            [4 4 2 1 3 3]
-+            [4 2 4 3 1 3]
-+            [2 4 4 3 3 1]
- 
-         The graph of this isogeny class has a shape which does not
-         occur over `\QQ`: a triangular prism.  Note that for curves
-@@ -2677,12 +2677,12 @@ class EllipticCurve_number_field(EllipticCurve_field):
- 
-             sage: G = C.graph()  # long time
-             sage: G.adjacency_matrix()  # long time
--            [0 1 1 0 1 0]
--            [1 0 1 1 0 0]
--            [1 1 0 0 0 1]
--            [0 1 0 0 1 1]
--            [1 0 0 1 0 1]
--            [0 0 1 1 1 0]
-+            [0 1 1 0 0 1]
-+            [1 0 1 0 1 0]
-+            [1 1 0 1 0 0]
-+            [0 0 1 0 1 1]
-+            [0 1 0 1 0 1]
-+            [1 0 0 1 1 0]
- 
-         To display the graph without any edge labels::
- 
-@@ -3316,7 +3316,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
-             sage: points = [E.lift_x(x) for x in xi]
-             sage: newpoints, U = E.lll_reduce(points)  # long time (35s on sage.math, 2011)
-             sage: [P[0] for P in newpoints]            # long time
--            [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 175620639884534615751/25, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7404442636649562303, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297]
-+            [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 11465667352242779838, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7041412654828066743, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297]
- 
-         An example to show the explicit use of the height pairing matrix::
- 
-diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py
-index 3808822812..a75290ea35 100644
---- a/src/sage/schemes/elliptic_curves/ell_rational_field.py
-+++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py
-@@ -1827,7 +1827,7 @@ class EllipticCurve_rational_field(EllipticCurve_number_field):
-             sage: E = EllipticCurve('389a1')
-             sage: E._known_points = []  # clear cached points
-             sage: E.simon_two_descent()
--            (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)])
-+            (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/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 81ad295160..d484a4a18b 100644
---- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
-+++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
-@@ -780,12 +780,12 @@ 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 (a),
-          Fractional ideal (-2*a + 3),
-          Fractional ideal (2*a + 3),
-          Fractional ideal (a + 6),
-diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py
-index 28b97f34af..9f7d1b6020 100644
---- a/src/sage/schemes/elliptic_curves/gp_simon.py
-+++ b/src/sage/schemes/elliptic_curves/gp_simon.py
-@@ -56,7 +56,7 @@ 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)
--        (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)])
-+        (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)])
- 
-     TESTS::
- 
-@@ -117,7 +117,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
-     # The block below mimics the defaults in Simon's scripts, and needs to be changed
-     # when these are updated.
-     if K is QQ:
--        cmd = 'ellrank(%s, %s);' % (list(E.ainvs()), [P.__pari__() for P in known_points])
-+        cmd = 'ellQ_ellrank(%s, %s);' % (list(E.ainvs()), [P.__pari__() for P in known_points])
-         if lim1 is None:
-             lim1 = 5
-         if lim3 is None:
-@@ -144,7 +144,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
-     if verbose > 0:
-         print(s)
-     v = gp.eval('ans')
--    if v=='ans': # then the call to ellrank() or bnfellrank() failed
-+    if v=='ans': # then the call to ellQ_ellrank() or bnfellrank() failed
-         raise RuntimeError("An error occurred while running Simon's 2-descent program")
-     if verbose >= 2:
-         print("v = %s" % v)
-diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-index a936deb74f..dc19254d8c 100644
---- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-+++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
-@@ -1208,14 +1208,14 @@ def isogenies_13_0(E, minimal_models=True):
-         sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)]  # long time (4s)
-         [(0,
-           0,
--          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645,
-+          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
-           -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847,
--          579363345221/13763747804451840*a^11 + 371192377511/860234237778240*a^10 + 8855090365657/1146978983704320*a^9 + 5367261541663/1633873196160*a^8 + 614883554332193/15930263662560*a^7 + 30485197378483/68078049840*a^6 - 131000897588387/2450809794240*a^5 - 203628705777949/306351224280*a^4 - 1587619388190379/204234149520*a^3 + 14435069706551/11346341640*a^2 + 7537273048614/472764235*a + 89198980034806/472764235),
-+          8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705),
-          (0,
-           0,
--          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645,
-+          20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705,
-           -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847,
--          -132601797212627/3440936951112960*a^11 - 6212467020502021/13763747804451840*a^10 - 1515926454902497/286744745926080*a^9 - 15154913741799637/4901619588480*a^8 - 576888119803859263/15930263662560*a^7 - 86626751639648671/204234149520*a^6 + 16436657569218427/306351224280*a^5 + 1540027900265659087/2450809794240*a^4 + 375782662805915809/51058537380*a^3 - 14831920924677883/11346341640*a^2 - 7237947774817724/472764235*a - 84773764066089509/472764235)]
-+          -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)]
-     """
-     if E.j_invariant()!=0:
-         raise ValueError("j-invariant must be 0.")
diff --git a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch b/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
deleted file mode 100644
index 762bb2612632..000000000000
--- a/srcpkgs/sagemath/patches/trac-34537-sagemath-pari-2.15b.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From f0365f30834b6890313790b3845c647d0160fa6a Mon Sep 17 00:00:00 2001
-From: Vincent Delecroix <20100.delecroix@gmail.com*>
-Date: Fri, 30 Sep 2022 16:31:08 +0200
-Subject: fix doctest if fqf_orthogonal
-
----
- src/sage/groups/fqf_orthogonal.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
-index 75de408..7fc4dbe 100644
---- a/src/sage/groups/fqf_orthogonal.py
-+++ b/src/sage/groups/fqf_orthogonal.py
-@@ -245,10 +245,10 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
-             sage: all(x*f==x*fbar for x in q.gens())
-             True
-             sage: L = IntegralLattice("A2").twist(3)
--            sage: q = L.discriminant_group()
-             sage: OL = L.orthogonal_group()
-+            sage: assert OL(OL.0.matrix()) == OL.0
-+            sage: q = L.discriminant_group()
-             sage: Oq = q.orthogonal_group()
--            sage: assert Oq(OL.0) == Oq(OL.0.matrix())
-             sage: assert Oq(Oq.0.matrix()) == Oq.0
-         """
-         from sage.libs.gap.element import GapElement
--- 
-cgit v1.0-1-gd88e
-
diff --git a/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch b/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
deleted file mode 100644
index 6afaf1b7162f..000000000000
--- a/srcpkgs/sagemath/patches/trac-34668-matplotlib_3.6-5501e0de0dca1cff0355326dd42bd8c7e5749568.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-commit 5501e0de0dca1cff0355326dd42bd8c7e5749568
-Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
-Date:   Tue Oct 11 17:25:04 2022 -0300
-
-    Support matplotlib 3.6
-
-diff --git a/src/sage/plot/arc.py b/src/sage/plot/arc.py
-index bb834763afc..f65973bcbd5 100644
---- a/src/sage/plot/arc.py
-+++ b/src/sage/plot/arc.py
-@@ -273,9 +273,9 @@ class Arc(GraphicPrimitive):
-         p = patches.Arc((self.x, self.y),
-                         2. * self.r1,
-                         2. * self.r2,
--                        fmod(self.angle, 2 * pi) * (180. / pi),
--                        self.s1 * (180. / pi),
--                        self.s2 * (180. / pi))
-+                        angle=fmod(self.angle, 2 * pi) * (180. / pi),
-+                        theta1=self.s1 * (180. / pi),
-+                        theta2=self.s2 * (180. / pi))
-         return p
- 
-     def bezier_path(self):
-diff --git a/src/sage/plot/ellipse.py b/src/sage/plot/ellipse.py
-index a77e6fe640a..c35bed574ef 100644
---- a/src/sage/plot/ellipse.py
-+++ b/src/sage/plot/ellipse.py
-@@ -192,7 +192,8 @@ class Ellipse(GraphicPrimitive):
-         options = self.options()
-         p = patches.Ellipse(
-                 (self.x,self.y),
--                self.r1*2.,self.r2*2.,self.angle/pi*180.)
-+                self.r1*2.,self.r2*2.,
-+                angle=self.angle/pi*180.)
-         p.set_linewidth(float(options['thickness']))
-         p.set_fill(options['fill'])
-         a = float(options['alpha'])
-diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py
-index e779e1210e3..8d620b5c625 100644
---- a/src/sage/plot/graphics.py
-+++ b/src/sage/plot/graphics.py
-@@ -2007,7 +2007,7 @@ class Graphics(WithEqualityById, SageObject):
-         We can also do custom formatting if you need it.  See above for full
-         details::
- 
--            sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex")
-+            sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") # not tested (broken with matplotlib 3.6)
-             Graphics object consisting of 1 graphics primitive
- 
-         This is particularly useful when setting custom ticks in multiples
-@@ -2341,7 +2341,7 @@ class Graphics(WithEqualityById, SageObject):
-             sage: subplot = Figure().add_subplot(111)
-             sage: p._objects[0]._render_on_subplot(subplot)
-             sage: p._matplotlib_tick_formatter(subplot, **d)
--            (<AxesSubplot:>,
-+            (<AxesSubplot:...>,
-             <matplotlib.ticker.MaxNLocator object at ...>,
-             <matplotlib.ticker.MaxNLocator object at ...>,
-             <matplotlib.ticker.ScalarFormatter object at ...>,
-diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py
-index b36ee57227c..5301a05c3dc 100644
---- a/src/sage/plot/plot.py
-+++ b/src/sage/plot/plot.py
-@@ -1741,7 +1741,7 @@ def plot(funcs, *args, **kwds):
- 
-     ::
- 
--        sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex")
-+        sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") # not tested (broken with matplotlib 3.6)
-         Graphics object consisting of 1 graphics primitive
- 
-     .. PLOT::
diff --git a/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch b/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
new file mode 100644
index 000000000000..f2f825e4fb10
--- /dev/null
+++ b/srcpkgs/sagemath/patches/trac-34851-support_singular_4.3.1.p3-5e5737a0c.patch
@@ -0,0 +1,205 @@
+diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini
+index 2e33a405d36..313463d2fea 100644
+--- a/build/pkgs/singular/checksums.ini
++++ b/build/pkgs/singular/checksums.ini
+@@ -1,5 +1,5 @@
+ tarball=singular-VERSION.tar.gz
+-sha1=6c2b622d3681e2de3d58d30c654d43d3e32b720c
+-md5=abb1e37c794472e7760655358ab66054
+-cksum=17455733
++sha1=28bb3ee97ef48d04dfa96de182fd93eebe08426c
++md5=fc0a4f5720dadba45a52ee94324ce00c
++cksum=1573851737
+ upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz
+diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt
+index 11300c77e7d..66e2bede53a 100644
+--- a/build/pkgs/singular/package-version.txt
++++ b/build/pkgs/singular/package-version.txt
+@@ -1 +1 @@
+-4.3.1p1
++4.3.1p3
+diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd
+index 8e3ac314b67..747a6b1e2fb 100644
+--- a/src/sage/libs/singular/decl.pxd
++++ b/src/sage/libs/singular/decl.pxd
+@@ -574,7 +574,7 @@ cdef extern from "singular/Singular/libsingular.h":
+ 
+     # gets a component out of a polynomial vector
+ 
+-    poly *pTakeOutComp1(poly **, int)
++    poly *pTakeOutComp(poly **, int)
+ 
+     # deep copy p
+ 
+diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
+index d8ea7b07f3c..3a1271cd59f 100644
+--- a/src/sage/libs/singular/singular.pyx
++++ b/src/sage/libs/singular/singular.pyx
+@@ -1726,20 +1726,21 @@ cdef int overflow_check(unsigned long e, ring *_ring) except -1:
+ 
+     Whether an overflow occurs or not partially depends
+     on the number of variables in the ring. See trac ticket
+-    :trac:`11856`. With Singular 4, it is by default optimized
+-    for at least 4 variables on 64-bit and 2 variables on 32-bit,
+-    which in both cases makes a maximal default exponent of
+-    2^16-1.
++    :trac:`11856`.
+ 
+     EXAMPLES::
+ 
+         sage: P.<x,y> = QQ[]
+-        sage: y^(2^16-1)
+-        y^65535
+-        sage: y^2^16
++        sage: y^(2^30)
++        Traceback (most recent call last):             # 32-bit
++        ...                                            # 32-bit
++        OverflowError: exponent overflow (1073741824)  # 32-bit
++        y^1073741824  # 64-bit
++        sage: y^2^32
+         Traceback (most recent call last):
+         ...
+-        OverflowError: exponent overflow (65536)
++        OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++        OverflowError: exponent overflow (4294967296)  # 64-bit
+     """
+     if unlikely(e > _ring.bitmask):
+         raise OverflowError("exponent overflow (%d)"%(e))
+diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+index 7dc058a22f0..71494eddbc0 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_ideal.py
++++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py
+@@ -60,7 +60,7 @@
+ Note that the result of a computation is not necessarily reduced::
+ 
+     sage: (a+b)^17
+-    256*a*b^16 + 256*b^17
++    a*b^16 + b^17
+     sage: S(17) == 0
+     True
+ 
+diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+index 4dad016b33f..9bf67dd1425 100644
+--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
++++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+@@ -193,7 +193,7 @@ from sage.libs.singular.decl cimport (
+     p_IsUnit, p_IsOne, p_Series, p_Head, idInit, fast_map_common_subexp, id_Delete,
+     p_IsHomogeneous, p_Homogen, p_Totaldegree,pLDeg1_Totaldegree, singclap_pdivide, singclap_factorize,
+     idLift, IDELEMS, On, Off, SW_USE_CHINREM_GCD, SW_USE_EZGCD,
+-    p_LmIsConstant, pTakeOutComp1, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
++    p_LmIsConstant, pTakeOutComp, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
+     pLength, kNF, p_Neg, p_Minus_mm_Mult_qq, p_Plus_mm_Mult_qq,
+     pDiff, singclap_resultant, p_Normalize,
+     prCopyR, prCopyR_NoSort)
+@@ -1587,7 +1587,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
+             9/4
+ 
+             sage: P.monomial_quotient(x,y) # Note the wrong result
+-            x*y^65535*z^65535
++            x*y^65535*z^65535      # 32-bit
++            x*y^1048575*z^1048575  # 64-bit
+ 
+             sage: P.monomial_quotient(x,P(1))
+             x
+@@ -2247,10 +2248,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             9/4*x^2 - 1/4*y^2 - y - 1
+ 
+             sage: P.<x,y> = PolynomialRing(QQ,order='lex')
+-            sage: (x^2^15) * x^2^15
++            sage: (x^2^32) * x^2^32
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (...)
++            OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++            OverflowError: exponent overflow (...)  # 64-bit
+         """
+         # all currently implemented rings are commutative
+         cdef poly *_p
+@@ -2371,10 +2373,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             ValueError: not a 2nd power
+ 
+             sage: P.<x,y> = PolynomialRing(QQ,order='lex')
+-            sage: (x+y^2^15)^10
++            sage: (x+y^2^32)^10
+             Traceback (most recent call last):
+             ....
+-            OverflowError: exponent overflow (...)
++            OverflowError: Python int too large to convert to C unsigned long  # 32-bit
++            OverflowError: exponent overflow (...)  # 64-bit
+ 
+         Test fractional powers (:trac:`22329`)::
+ 
+@@ -3461,7 +3464,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+             x^10000
+             no overflow
+ 
+-            sage: n = 1000
++            sage: n = 100000
+             sage: try:
+             ....:     f = x^n
+             ....:     f.subs(x = x^n)
+@@ -4567,7 +4570,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+         l = []
+         for i from 0 <= i < IDELEMS(res):
+             for j from 1 <= j <= IDELEMS(_I):
+-                l.append( new_MP(parent, pTakeOutComp1(&res.m[i], j)) )
++                l.append( new_MP(parent, pTakeOutComp(&res.m[i], 1)) )
+ 
+         id_Delete(&fI, r)
+         id_Delete(&_I, r)
+@@ -4635,7 +4638,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
+ 
+             sage: f = 3*x
+             sage: f.reduce([2*x,y])
+-            3*x
++            x
+ 
+         The reduction is not canonical when ``I`` is not a Groebner
+         basis::
+diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx
+index 1c9f35e56ba..587511c3888 100644
+--- a/src/sage/rings/polynomial/plural.pyx
++++ b/src/sage/rings/polynomial/plural.pyx
+@@ -1619,10 +1619,10 @@ cdef class NCPolynomial_plural(RingElement):
+             sage: P = A.g_algebra(relations={y*x:-x*y + z},  order='lex')
+             sage: P.inject_variables()
+             Defining x, z, y
+-            sage: (x^2^15) * x^2^15
++            sage: (x^2^31) * x^2^31
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (65536)
++            OverflowError: exponent overflow (2147483648)
+         """
+         # all currently implemented rings are commutative
+         cdef poly *_p
+@@ -1689,10 +1689,10 @@ cdef class NCPolynomial_plural(RingElement):
+             sage: P = A.g_algebra(relations={y*x:-x*y + z},  order='lex')
+             sage: P.inject_variables()
+             Defining x, z, y
+-            sage: (x+y^2^15)^10
++            sage: (x+y^2^31)^10
+             Traceback (most recent call last):
+             ....
+-            OverflowError: exponent overflow (327680)
++            OverflowError: exponent overflow (2147483648)
+         """
+         if type(exp) is not Integer:
+             try:
+diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx
+index b5d83ef71b6..5c45b3fb528 100644
+--- a/src/sage/structure/element.pyx
++++ b/src/sage/structure/element.pyx
+@@ -2705,10 +2705,10 @@ cdef class RingElement(ModuleElement):
+         with Singular 4::
+ 
+             sage: K.<x,y> = ZZ[]
+-            sage: (x^12345)^54321
++            sage: (x^123456)^654321
+             Traceback (most recent call last):
+             ...
+-            OverflowError: exponent overflow (670592745)
++            OverflowError: exponent overflow (...)
+         """
+         return arith_generic_power(self, n)
+ 
diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template
index 74445c3aa8c1..75695f0e5f87 100644
--- a/srcpkgs/sagemath/template
+++ b/srcpkgs/sagemath/template
@@ -1,7 +1,7 @@
 # Template file for 'sagemath'
 pkgname=sagemath
-version=9.7
-revision=4
+version=9.8
+revision=1
 build_wrksrc=pkgs/sagemath-standard
 build_style=python3-module
 _bindir=/usr/lib/sagemath/$version/bin
@@ -14,7 +14,7 @@ makedepends="arb-devel boost-devel brial-devel cliquer-devel ecl eclib-devel
  libpng-devel linbox-devel m4ri-devel m4rie-devel mpfi-devel
  mpfr-devel ntl-devel openblas-devel pari-devel planarity-devel python3-cypari2
  python3-cysignals python3-devel python3-gmpy2 python3-memory_allocator
- python3-numpy rankwidth-devel singular symmetrica-devel zn_poly"
+ python3-numpy rankwidth-devel singular symmetrica-devel"
 depends="FlintQS eclib-devel fflas-ffpack flintlib-devel gcc-fortran gd-devel
  gfan giac gsl-devel gzip libpng-devel linbox-devel m4ri-devel maxima-ecl
  mpfr-devel nauty ntl-devel palp pari-devel pari-elldata-small pari-galdata
@@ -32,7 +32,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
 license="GPL-2.0-or-later"
 homepage="http://sagemath.org/"
 distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
-checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
+checksum=2aff28bd1d18c2d526581f5298acb8336f5b92db5675a7403dec8eaf9a86bc4c
 
 do_configure() {
 	# git tree needs bootstrapping
diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update
new file mode 100644
index 000000000000..68be3c5752d0
--- /dev/null
+++ b/srcpkgs/sagemath/update
@@ -0,0 +1,2 @@
+pkgname="sage"
+site="https://mirrors.mit.edu/sage/src/index.html"

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: update to 9.8
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (25 preceding siblings ...)
  2023-02-14 13:03 ` [PR PATCH] [Updated] sagemath: update to 9.8 tornaria
@ 2023-02-14 13:05 ` tornaria
  2023-02-15 13:19 ` tornaria
  2023-02-15 13:32 ` [PR PATCH] [Merged]: " leahneukirchen
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-14 13:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1429718739

Comment:
The only test failure in the previous run was a very slow test that triggered a timeout on i686. I fixed the slow test in https://github.com/sagemath/sage/pull/35127 and include the fix here so the timeout doesn't trouble us again.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: sagemath: update to 9.8
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (26 preceding siblings ...)
  2023-02-14 13:05 ` tornaria
@ 2023-02-15 13:19 ` tornaria
  2023-02-15 13:32 ` [PR PATCH] [Merged]: " leahneukirchen
  28 siblings, 0 replies; 30+ messages in thread
From: tornaria @ 2023-02-15 13:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/42048#issuecomment-1431359675

Comment:
@leahneukirchen this is IMO ready to merge.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PR PATCH] [Merged]: sagemath: update to 9.8
  2023-02-02 22:54 [PR PATCH] Sagemath tornaria
                   ` (27 preceding siblings ...)
  2023-02-15 13:19 ` tornaria
@ 2023-02-15 13:32 ` leahneukirchen
  28 siblings, 0 replies; 30+ messages in thread
From: leahneukirchen @ 2023-02-15 13:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1554 bytes --]

There's a merged pull request on the void-packages repository

sagemath: update to 9.8
https://github.com/void-linux/void-packages/pull/42048

Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->

This PR includes
 - update brial to 1.2.12   (it has to be built in sync because of boost)
 - update singular to 4.3.1.p3   (it has to be built in sync because an output difference)

Changes in sagemath package:
 - fix edge case of python 3.11 integer conversion on 32 bit
 - support tachyon 0.99.5
 - support singular 4.3.1p3
 - fix tests for giac 1.9.0.35
 -  fix tests for numpy 1.24
 - skip unstable tests in klyachko.py
 - remove zn_poly dependency


#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-02-15 13:32 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 22:54 [PR PATCH] Sagemath tornaria
2023-02-02 23:07 ` sagemath: rebuild for dep updates and fixes tornaria
2023-02-02 23:16 ` [PR PATCH] [Updated] " tornaria
2023-02-03  1:29 ` tornaria
2023-02-03  1:33 ` [PR PATCH] [Updated] " tornaria
2023-02-03 23:42 ` tornaria
2023-02-04  1:04 ` tornaria
2023-02-04  1:38 ` tornaria
2023-02-04 11:47 ` [PR PATCH] [Updated] " tornaria
2023-02-05 14:00 ` tornaria
2023-02-05 14:00 ` tornaria
2023-02-05 14:42 ` [PR PATCH] [Updated] " tornaria
2023-02-05 14:56 ` tornaria
2023-02-06  2:54 ` [PR PATCH] [Updated] " tornaria
2023-02-06 12:43 ` tornaria
2023-02-06 21:23 ` dkwo
2023-02-06 21:24 ` dkwo
2023-02-06 21:39 ` tornaria
2023-02-06 23:37 ` dkwo
2023-02-06 23:42 ` dkwo
2023-02-07 16:47 ` dkwo
2023-02-13 15:58 ` tornaria
2023-02-13 16:08 ` dkwo
2023-02-13 18:31 ` [PR PATCH] [Updated] " tornaria
2023-02-14  0:11 ` tornaria
2023-02-14  0:17 ` tornaria
2023-02-14 13:03 ` [PR PATCH] [Updated] sagemath: update to 9.8 tornaria
2023-02-14 13:05 ` tornaria
2023-02-15 13:19 ` tornaria
2023-02-15 13:32 ` [PR PATCH] [Merged]: " leahneukirchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).