From 4b4bc7718a0974b6657328d3344c99b1f0168224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Mon, 11 Sep 2023 20:11:20 -0300 Subject: [PATCH 1/6] flintlib: update to 3.0.1. --- common/shlibs | 3 +-- srcpkgs/arb | 1 + srcpkgs/arb-devel | 2 +- srcpkgs/arb/template | 24 ------------------- .../patches/fix-test-t-sdiv_qrnnd.patch | 23 ------------------ srcpkgs/flintlib/template | 21 ++++++++++++---- 6 files changed, 20 insertions(+), 54 deletions(-) create mode 120000 srcpkgs/arb delete mode 100644 srcpkgs/arb/template delete mode 100644 srcpkgs/flintlib/patches/fix-test-t-sdiv_qrnnd.patch diff --git a/common/shlibs b/common/shlibs index 1b25a12956eeb..ca04472aec634 100644 --- a/common/shlibs +++ b/common/shlibs @@ -3971,8 +3971,7 @@ libgtkdatabox.so.1 gtkdatabox3-1.0.0_1 libxcvt.so.0 libxcvt-0.1.1_1 libgf2x.so.3 gf2x-1.3.0_1 libntl.so.44 ntl-11.5.1_1 -libflint.so.17 flintlib-2.9.0_1 -libarb.so.2 arb-2.20.0_1 +libflint.so.18 flintlib-3.0.0_1 libec.so.10 eclib-20220621_1 libsymmetrica.so.2 symmetrica-3.0.1_1 libLfunction.so.1 lcalc-2.0.4_1 diff --git a/srcpkgs/arb b/srcpkgs/arb new file mode 120000 index 0000000000000..7c2633183069f --- /dev/null +++ b/srcpkgs/arb @@ -0,0 +1 @@ +flintlib \ No newline at end of file diff --git a/srcpkgs/arb-devel b/srcpkgs/arb-devel index 456b9f00a86cd..7c2633183069f 120000 --- a/srcpkgs/arb-devel +++ b/srcpkgs/arb-devel @@ -1 +1 @@ -arb \ No newline at end of file +flintlib \ No newline at end of file diff --git a/srcpkgs/arb/template b/srcpkgs/arb/template deleted file mode 100644 index 84a62c7ffdba3..0000000000000 --- a/srcpkgs/arb/template +++ /dev/null @@ -1,24 +0,0 @@ -# Template file for 'arb' -pkgname=arb -version=2.23.0 -revision=1 -build_style=configure -configure_args="--prefix=/usr --with-gmp=/usr --with-mpfr=/usr --with-flint=/usr" -makedepends="flintlib-devel" -short_desc="C library for arbitrary-precision interval arithmetic" -maintainer="Gonzalo TornarĂ­a " -license="LGPL-2.1-or-later" -homepage="https://arblib.org" -changelog="https://raw.githubusercontent.com/fredrik-johansson/arb/master/doc/source/history.rst" -distfiles="https://github.com/fredrik-johansson/arb/archive/${version}.tar.gz" -checksum=977d41bde46f5442511d5165c705cec32c03e852c84d7d1836135d412ce702bb - -arb-devel_package() { - depends="${sourcepkg}>=${version}_${revision} ${makedepends}" - short_desc+=" - development files" - pkg_install() { - vmove usr/include - vmove "usr/lib/*.a" - vmove "usr/lib/*.so" - } -} diff --git a/srcpkgs/flintlib/patches/fix-test-t-sdiv_qrnnd.patch b/srcpkgs/flintlib/patches/fix-test-t-sdiv_qrnnd.patch deleted file mode 100644 index cfa109792892c..0000000000000 --- a/srcpkgs/flintlib/patches/fix-test-t-sdiv_qrnnd.patch +++ /dev/null @@ -1,23 +0,0 @@ -From fb8ddbcc06afa2a8f25637032fbb8211f6c6c122 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Albin=20Ahlb=C3=A4ck?= -Date: Fri, 20 May 2022 14:16:38 +0200 -Subject: [PATCH] Fix bug in test code for GCC 12 - ---- - test/t-sdiv_qrnnd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/t-sdiv_qrnnd.c b/test/t-sdiv_qrnnd.c -index 2e9822e848..2676903826 100644 ---- a/test/t-sdiv_qrnnd.c -+++ b/test/t-sdiv_qrnnd.c -@@ -33,7 +33,7 @@ int main(void) - { - d = n_randtest_not_zero(state); - nh = n_randtest(state); -- } while ((FLINT_ABS(nh) >= FLINT_ABS(d)/2) || (nh == WORD_MIN)); -+ } while ((nh == WORD_MIN) || (FLINT_ABS(nh) >= FLINT_ABS(d)/2)); - - nl = n_randtest(state); - - diff --git a/srcpkgs/flintlib/template b/srcpkgs/flintlib/template index f7442c8052aaa..254d18c42f5b3 100644 --- a/srcpkgs/flintlib/template +++ b/srcpkgs/flintlib/template @@ -1,10 +1,10 @@ # Template file for 'flintlib' pkgname=flintlib -version=2.9.0 +version=3.0.1 revision=1 -build_style=configure +build_style=gnu-configure configure_args="--prefix=/usr $(vopt_with ntl) - $(vopt_if openblas --with-blas=${XBPS_CROSS_BASE}/usr/include/openblas)" + $(vopt_if openblas --with-blas-include=${XBPS_CROSS_BASE}/usr/include/openblas)" makedepends="mpfr-devel $(vopt_if ntl ntl-devel) $(vopt_if openblas openblas-devel)" short_desc="Fast Library for Number Theory" @@ -13,7 +13,7 @@ license="LGPL-2.1-or-later" homepage="https://flintlib.org" changelog="https://raw.githubusercontent.com/wbhart/flint2/trunk/NEWS" distfiles="https://flintlib.org/flint-${version}.tar.gz" -checksum=2fc090d51033c93208e6c10d406397a53c983ae5343b958eb25f72a57a4ce76a +checksum=7b311a00503a863881eb8177dbeb84322f29399f3d7d72f3b1a4c9ba1d5794b4 build_options="ntl openblas" desc_option_ntl="enable NTL support" @@ -33,7 +33,20 @@ flintlib-devel_package() { short_desc+=" - development files" pkg_install() { vmove usr/include + vmove usr/lib/pkgconfig vmove "usr/lib/*.a" vmove "usr/lib/*.so" } } + +arb_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - transitional dummy package" + build_style=meta +} + +arb-devel_package() { + depends="${sourcepkg}-devel>=${version}_${revision}" + short_desc+=" - transitional dummy package" + build_style=meta +} From f22e5c7930f0c652d238112f86624f27aee47d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Wed, 13 Sep 2023 19:08:05 -0300 Subject: [PATCH 2/6] eclib: rebuild for flintlib-3.0.1 --- srcpkgs/eclib/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/eclib/template b/srcpkgs/eclib/template index 1d4ad58f21b7b..12165ca788dd5 100644 --- a/srcpkgs/eclib/template +++ b/srcpkgs/eclib/template @@ -1,7 +1,7 @@ # Template file for 'eclib' pkgname=eclib version=20230424 -revision=3 +revision=4 build_style=gnu-configure configure_args="--with-flint --with-boost" makedepends="pari-devel ntl-devel flintlib-devel boost-devel" From 8dd09094107f3ddb71b2e102eba132017aefcc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Wed, 13 Sep 2023 19:13:15 -0300 Subject: [PATCH 3/6] singular: update to 4.3.2p10. --- srcpkgs/singular/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/singular/template b/srcpkgs/singular/template index 036e19d470354..beb0e6d30118e 100644 --- a/srcpkgs/singular/template +++ b/srcpkgs/singular/template @@ -1,6 +1,6 @@ # Template file for 'singular' pkgname=singular -version=4.3.2p7 +version=4.3.2p10 revision=1 _majver=${version%p*} build_style=gnu-configure @@ -20,7 +20,7 @@ maintainer="dkwo " 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=aad23c30066b7fbc011138a98d60532565d76a847eec6bf2938410d93b272ca3 +checksum=28c2c9fcfee954e00dfa56eb1a7d418d5b1de67c4398d25a0f2b8f73e71552a8 if [ -z "$CROSS_BUILD" ]; then makedepends+=" ntl-devel" From e7a1d725324c3bbb57006038708ecece95ec3776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Wed, 19 Jul 2023 21:04:33 -0300 Subject: [PATCH 4/6] python3-pplpy: use cython 3. --- srcpkgs/python3-pplpy/template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/srcpkgs/python3-pplpy/template b/srcpkgs/python3-pplpy/template index 4a9c987b2a859..d3b9aebdf2237 100644 --- a/srcpkgs/python3-pplpy/template +++ b/srcpkgs/python3-pplpy/template @@ -1,9 +1,9 @@ # Template file for 'python3-pplpy' pkgname=python3-pplpy version=0.8.9 -revision=1 +revision=2 build_style=python3-pep517 -hostmakedepends="python3-setuptools python3-wheel python3-Cython0.29 +hostmakedepends="python3-setuptools python3-wheel python3-Cython python3-cysignals python3-gmpy2" makedepends="python3-devel gmp-devel gmpxx-devel ppl-devel mpfr-devel libmpc-devel pari-devel" From 9bb81d7bcf3e6c87454d16e919cad5845e213a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Thu, 19 Oct 2023 08:52:15 -0300 Subject: [PATCH 5/6] python3-networkx: update to 3.2.1. --- srcpkgs/python3-networkx/template | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/srcpkgs/python3-networkx/template b/srcpkgs/python3-networkx/template index 186bf64f7bff9..29283d9e5a032 100644 --- a/srcpkgs/python3-networkx/template +++ b/srcpkgs/python3-networkx/template @@ -1,11 +1,11 @@ # Template file for 'python3-networkx' pkgname=python3-networkx -version=3.1 -revision=2 -build_style=python3-module +version=3.2.1 +revision=1 +build_style=python3-pep517 # failing in i686 make_check_args="--deselect networkx/algorithms/approximation/tests/test_traveling_salesman.py::test_asadpour_tsp" -hostmakedepends="python3-setuptools" +hostmakedepends="python3-setuptools python3-wheel" depends="python3" checkdepends="python3-numpy python3-scipy python3-matplotlib python3-pandas python3-lxml python3-sympy python3-pytest-xdist" @@ -15,7 +15,7 @@ license="BSD-3-Clause" homepage="https://networkx.org" changelog="https://github.com/networkx/networkx/raw/main/doc/release/release_${version}.rst" distfiles="${PYPI_SITE}/n/networkx/networkx-${version}.tar.gz" -checksum=de346335408f84de0eada6ff9fafafff9bcda11f0a0dfaa931133debb146ab61 +checksum=9f1bb5cf3409bf324e0a722c20bdb4c20ee39bf1c30ce8ae499c8502b0b5e0c6 post_install() { vlicense LICENSE.txt From 05e209f1d6abbd01ae1635c4daa8d64a59f23135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= Date: Wed, 13 Sep 2023 19:50:44 -0300 Subject: [PATCH 6/6] sagemath: update to 10.2. --- .../sagemath/patches/35848-flintlib_3.0.patch | 1867 +++++++++++++++++ .../patches/35934-singular_4.3.2p7.patch | 221 -- .../sagemath/patches/36006-gmp_6.3.0.patch | 38 - .../patches/36046-fix_memory_leak.patch | 740 ------- .../sagemath/patches/36235-ecl_23.9.9.patch | 39 - .../patches/36279-matplotlib_3.8.0.patch | 24 - srcpkgs/sagemath/patches/36403-00pre.patch | 29 - .../sagemath/patches/36407-python_3.12.patch | 1744 --------------- .../patches/36769-fix_jmol_detect.patch | 92 + srcpkgs/sagemath/patches/get_patches | 24 +- srcpkgs/sagemath/template | 14 +- srcpkgs/sagemath/update | 6 +- 12 files changed, 1974 insertions(+), 2864 deletions(-) create mode 100644 srcpkgs/sagemath/patches/35848-flintlib_3.0.patch delete mode 100644 srcpkgs/sagemath/patches/35934-singular_4.3.2p7.patch delete mode 100644 srcpkgs/sagemath/patches/36006-gmp_6.3.0.patch delete mode 100644 srcpkgs/sagemath/patches/36046-fix_memory_leak.patch delete mode 100644 srcpkgs/sagemath/patches/36235-ecl_23.9.9.patch delete mode 100644 srcpkgs/sagemath/patches/36279-matplotlib_3.8.0.patch delete mode 100644 srcpkgs/sagemath/patches/36403-00pre.patch delete mode 100644 srcpkgs/sagemath/patches/36407-python_3.12.patch create mode 100644 srcpkgs/sagemath/patches/36769-fix_jmol_detect.patch diff --git a/srcpkgs/sagemath/patches/35848-flintlib_3.0.patch b/srcpkgs/sagemath/patches/35848-flintlib_3.0.patch new file mode 100644 index 0000000000000..2cad28134f6e6 --- /dev/null +++ b/srcpkgs/sagemath/patches/35848-flintlib_3.0.patch @@ -0,0 +1,1867 @@ +diff --git a/build/pkgs/antic/SPKG.rst b/build/pkgs/antic/SPKG.rst +deleted file mode 100644 +index d6c32377957..00000000000 +--- a/build/pkgs/antic/SPKG.rst ++++ /dev/null +@@ -1,18 +0,0 @@ +-antic: Algebraic Number Theory In C +-=================================== +- +-Description +------------ +- +-Algebraic Number Theory In C +- +-License +-------- +- +-LGPL 2.1 +- +-Upstream Contact +----------------- +- +-https://github.com/wbhart/antic +- +diff --git a/build/pkgs/antic/checksums.ini b/build/pkgs/antic/checksums.ini +deleted file mode 100644 +index fc8711ecd13..00000000000 +--- a/build/pkgs/antic/checksums.ini ++++ /dev/null +@@ -1,5 +0,0 @@ +-tarball=antic-VERSION.tar.gz +-sha1=940d8ea2c3512b9d49ee3101cf043f777764bd8f +-md5=4e896420dd6344b53b307871efb2cbb4 +-cksum=1938565125 +-upstream_url=https://github.com/wbhart/antic/archive/refs/tags/vVERSION.tar.gz +diff --git a/build/pkgs/antic/dependencies b/build/pkgs/antic/dependencies +deleted file mode 100644 +index c95d2836ce5..00000000000 +--- a/build/pkgs/antic/dependencies ++++ /dev/null +@@ -1,4 +0,0 @@ +-$(MP_LIBRARY) mpfr flint +- +----------- +-All lines of this file are ignored except the first. +diff --git a/build/pkgs/antic/distros/arch.txt b/build/pkgs/antic/distros/arch.txt +deleted file mode 100644 +index 83c7cab14e4..00000000000 +--- a/build/pkgs/antic/distros/arch.txt ++++ /dev/null +@@ -1 +0,0 @@ +-antic +diff --git a/build/pkgs/antic/distros/conda.txt b/build/pkgs/antic/distros/conda.txt +deleted file mode 100644 +index 83c7cab14e4..00000000000 +--- a/build/pkgs/antic/distros/conda.txt ++++ /dev/null +@@ -1 +0,0 @@ +-antic +diff --git a/build/pkgs/antic/distros/debian.txt b/build/pkgs/antic/distros/debian.txt +deleted file mode 100644 +index 8fdcd3e5721..00000000000 +--- a/build/pkgs/antic/distros/debian.txt ++++ /dev/null +@@ -1 +0,0 @@ +-libantic-dev +diff --git a/build/pkgs/antic/distros/fedora.txt b/build/pkgs/antic/distros/fedora.txt +deleted file mode 100644 +index 1b16da9f64b..00000000000 +--- a/build/pkgs/antic/distros/fedora.txt ++++ /dev/null +@@ -1 +0,0 @@ +-antic-devel +diff --git a/build/pkgs/antic/distros/freebsd.txt b/build/pkgs/antic/distros/freebsd.txt +deleted file mode 100644 +index 116ff3a26f3..00000000000 +--- a/build/pkgs/antic/distros/freebsd.txt ++++ /dev/null +@@ -1 +0,0 @@ +-math/antic +diff --git a/build/pkgs/antic/distros/opensuse.txt b/build/pkgs/antic/distros/opensuse.txt +deleted file mode 100644 +index 1b16da9f64b..00000000000 +--- a/build/pkgs/antic/distros/opensuse.txt ++++ /dev/null +@@ -1 +0,0 @@ +-antic-devel +diff --git a/build/pkgs/antic/distros/repology.txt b/build/pkgs/antic/distros/repology.txt +deleted file mode 100644 +index 83c7cab14e4..00000000000 +--- a/build/pkgs/antic/distros/repology.txt ++++ /dev/null +@@ -1 +0,0 @@ +-antic +diff --git a/build/pkgs/antic/package-version.txt b/build/pkgs/antic/package-version.txt +deleted file mode 100644 +index 3a4036fb450..00000000000 +--- a/build/pkgs/antic/package-version.txt ++++ /dev/null +@@ -1 +0,0 @@ +-0.2.5 +diff --git a/build/pkgs/antic/spkg-install.in b/build/pkgs/antic/spkg-install.in +deleted file mode 100644 +index c57fa884a20..00000000000 +--- a/build/pkgs/antic/spkg-install.in ++++ /dev/null +@@ -1,19 +0,0 @@ +-cd src +- +-# Copied from build/pkgs/flint/spkg-install.in: +-# Trac #29607: We must always supply --with-gmp, --with-mpfr, +-# --with-ntl because otherwise FLINT's configure script uses +-# /usr/local, which is always wrong. +-# This is why we do not use $SAGE_CONFIGURE_GMP etc. here. +-# The value $SAGE_LOCAL is always a safe choice even if the library +-# is coming from the system and is found using what is in +-# LIBRARY_PATH or LDFLAGS etc. +-./configure \ +- --disable-static \ +- --prefix="$SAGE_LOCAL" \ +- --with-gmp="$SAGE_LOCAL" \ +- --with-mpfr="$SAGE_LOCAL" \ +- --with-flint="$SAGE_LOCAL" || sdh_die "Error: Failed to configure antic." +- +-sdh_make verbose +-sdh_make_install +diff --git a/build/pkgs/antic/type b/build/pkgs/antic/type +deleted file mode 100644 +index 134d9bc32d5..00000000000 +--- a/build/pkgs/antic/type ++++ /dev/null +@@ -1 +0,0 @@ +-optional +diff --git a/build/pkgs/arb/SPKG.rst b/build/pkgs/arb/SPKG.rst +deleted file mode 100644 +index cff49ddb95b..00000000000 +--- a/build/pkgs/arb/SPKG.rst ++++ /dev/null +@@ -1,27 +0,0 @@ +-arb: Arbitrary-precision floating-point ball arithmetic +-======================================================= +- +-Description +------------ +- +-Arb is a C library for arbitrary-precision floating-point ball +-arithmetic, developed by Fredrik Johansson +-(fredrik.johansson@gmail.com). It supports efficient high-precision +-computation with polynomials, power series, matrices and special +-functions over the real and complex numbers, with automatic, rigorous +-error control. +- +-License +-------- +- +-GNU General Public License v2+ +- +- +-Upstream Contact +----------------- +- +- - Fredrik Johansson: fredrik.johansson@gmail.com +- +- - https://arblib.org/ +- +- - http://github.com/fredrik-johansson/arb/ +diff --git a/build/pkgs/arb/checksums.ini b/build/pkgs/arb/checksums.ini +deleted file mode 100644 +index 80ef43dad5d..00000000000 +--- a/build/pkgs/arb/checksums.ini ++++ /dev/null +@@ -1,5 +0,0 @@ +-tarball=arb-VERSION.tar.gz +-sha1=a1efe035dd3af3613dd685971a156f652b86ff63 +-md5=9b369e29f93cdf2d4f90b57a92526cce +-cksum=64252121 +-upstream_url=https://github.com/fredrik-johansson/arb/archive/VERSION.tar.gz +diff --git a/build/pkgs/arb/dependencies b/build/pkgs/arb/dependencies +deleted file mode 100644 +index c95d2836ce5..00000000000 +--- a/build/pkgs/arb/dependencies ++++ /dev/null +@@ -1,4 +0,0 @@ +-$(MP_LIBRARY) mpfr flint +- +----------- +-All lines of this file are ignored except the first. +diff --git a/build/pkgs/arb/distros/arch.txt b/build/pkgs/arb/distros/arch.txt +deleted file mode 100644 +index 86c41dbaa5f..00000000000 +--- a/build/pkgs/arb/distros/arch.txt ++++ /dev/null +@@ -1 +0,0 @@ +-arb +diff --git a/build/pkgs/arb/distros/conda.txt b/build/pkgs/arb/distros/conda.txt +deleted file mode 100644 +index 86c41dbaa5f..00000000000 +--- a/build/pkgs/arb/distros/conda.txt ++++ /dev/null +@@ -1 +0,0 @@ +-arb +diff --git a/build/pkgs/arb/distros/debian.txt b/build/pkgs/arb/distros/debian.txt +deleted file mode 100644 +index 9fe71110712..00000000000 +--- a/build/pkgs/arb/distros/debian.txt ++++ /dev/null +@@ -1 +0,0 @@ +-libflint-arb-dev +diff --git a/build/pkgs/arb/distros/fedora.txt b/build/pkgs/arb/distros/fedora.txt +deleted file mode 100644 +index 76794404627..00000000000 +--- a/build/pkgs/arb/distros/fedora.txt ++++ /dev/null +@@ -1 +0,0 @@ +-arb arb-devel +diff --git a/build/pkgs/arb/distros/freebsd.txt b/build/pkgs/arb/distros/freebsd.txt +deleted file mode 100644 +index 2ef8c7cec0f..00000000000 +--- a/build/pkgs/arb/distros/freebsd.txt ++++ /dev/null +@@ -1 +0,0 @@ +-math/arb +diff --git a/build/pkgs/arb/distros/gentoo.txt b/build/pkgs/arb/distros/gentoo.txt +deleted file mode 100644 +index 58e3d4f8008..00000000000 +--- a/build/pkgs/arb/distros/gentoo.txt ++++ /dev/null +@@ -1 +0,0 @@ +-sci-mathematics/arb +diff --git a/build/pkgs/arb/distros/homebrew.txt b/build/pkgs/arb/distros/homebrew.txt +deleted file mode 100644 +index 86c41dbaa5f..00000000000 +--- a/build/pkgs/arb/distros/homebrew.txt ++++ /dev/null +@@ -1 +0,0 @@ +-arb +diff --git a/build/pkgs/arb/distros/nix.txt b/build/pkgs/arb/distros/nix.txt +deleted file mode 100644 +index 86c41dbaa5f..00000000000 +--- a/build/pkgs/arb/distros/nix.txt ++++ /dev/null +@@ -1 +0,0 @@ +-arb +diff --git a/build/pkgs/arb/distros/opensuse.txt b/build/pkgs/arb/distros/opensuse.txt +deleted file mode 100644 +index 3319855150c..00000000000 +--- a/build/pkgs/arb/distros/opensuse.txt ++++ /dev/null +@@ -1 +0,0 @@ +-arb-devel +diff --git a/build/pkgs/arb/distros/repology.txt b/build/pkgs/arb/distros/repology.txt +deleted file mode 100644 +index 179c9d507e1..00000000000 +--- a/build/pkgs/arb/distros/repology.txt ++++ /dev/null +@@ -1 +0,0 @@ +-arb-fp +diff --git a/build/pkgs/arb/distros/void.txt b/build/pkgs/arb/distros/void.txt +deleted file mode 100644 +index 3319855150c..00000000000 +--- a/build/pkgs/arb/distros/void.txt ++++ /dev/null +@@ -1 +0,0 @@ +-arb-devel +diff --git a/build/pkgs/arb/package-version.txt b/build/pkgs/arb/package-version.txt +deleted file mode 100644 +index e9763f6bfed..00000000000 +--- a/build/pkgs/arb/package-version.txt ++++ /dev/null +@@ -1 +0,0 @@ +-2.23.0 +diff --git a/build/pkgs/arb/spkg-check.in b/build/pkgs/arb/spkg-check.in +deleted file mode 100644 +index 27cd9419538..00000000000 +--- a/build/pkgs/arb/spkg-check.in ++++ /dev/null +@@ -1,2 +0,0 @@ +-cd src +-$MAKE check +diff --git a/build/pkgs/arb/spkg-configure.m4 b/build/pkgs/arb/spkg-configure.m4 +deleted file mode 100644 +index ef2dd0aac4a..00000000000 +--- a/build/pkgs/arb/spkg-configure.m4 ++++ /dev/null +@@ -1,23 +0,0 @@ +-SAGE_SPKG_CONFIGURE([arb], [ +- AC_REQUIRE([SAGE_SPKG_CONFIGURE_FLINT]) +- SAGE_ARB_LIBRARY="arb" +- AC_MSG_CHECKING([installing flint? ]) +- if test x$sage_spkg_install_flint = xyes; then +- AC_MSG_RESULT([yes; install arb as well]) +- sage_spkg_install_arb=yes +- else +- AC_CHECK_HEADER(arb.h, [ +- dnl below function added in version 2.16 of arb +- AC_CHECK_LIB([arb], [acb_mat_eig_simple], [], +- [dnl in Debian the name of dylib is different. +- AC_CHECK_LIB([flint-arb], [acb_mat_eig_simple], +- [SAGE_ARB_LIBRARY="flint-arb"], [sage_spkg_install_arb=yes])]) +- ], [sage_spkg_install_arb=yes]) +- fi +-], [], [], [ +- if test x$sage_spkg_install_arb = xyes; then +- AC_SUBST(SAGE_ARB_LIBRARY,["arb"]) +- else +- AC_SUBST(SAGE_ARB_LIBRARY,[$SAGE_ARB_LIBRARY]) +- fi +-]) +diff --git a/build/pkgs/arb/spkg-install.in b/build/pkgs/arb/spkg-install.in +deleted file mode 100644 +index 9322f04c912..00000000000 +--- a/build/pkgs/arb/spkg-install.in ++++ /dev/null +@@ -1,17 +0,0 @@ +-cd src +- +-# Trac #29607: We must always supply --with-gmp, --with-mpfr, +-# --with-flint because otherwise ARB's configure script uses +-# /usr/local, which is always wrong. +-# This is why we do not use $SAGE_CONFIGURE_GMP etc. here. +-# The value $SAGE_LOCAL is always a safe choice even if the library +-# is coming from the system and is found using what is in +-# LIBRARY_PATH or LDFLAGS etc. +-./configure --disable-static --prefix="$SAGE_LOCAL" \ +- --with-gmp="$SAGE_LOCAL" \ +- --with-mpfr="$SAGE_LOCAL" \ +- --with-flint="$SAGE_LOCAL" || \ +- sdh_die "Error configuring arb." +- +-sdh_make verbose +-sdh_make_install +diff --git a/build/pkgs/arb/type b/build/pkgs/arb/type +deleted file mode 100644 +index a6a7b9cd726..00000000000 +--- a/build/pkgs/arb/type ++++ /dev/null +@@ -1 +0,0 @@ +-standard +diff --git a/build/pkgs/e_antic/dependencies b/build/pkgs/e_antic/dependencies +index fea1ffbda45..8e977a55c13 100644 +--- a/build/pkgs/e_antic/dependencies ++++ b/build/pkgs/e_antic/dependencies +@@ -1,4 +1,4 @@ +-$(MP_LIBRARY) flint arb antic boost_cropped ++$(MP_LIBRARY) flint boost_cropped + + ---------- + All lines of this file are ignored except the first. +diff --git a/build/pkgs/flint/SPKG.rst b/build/pkgs/flint/SPKG.rst +index f91de70d1ff..d9dcea0903b 100644 +--- a/build/pkgs/flint/SPKG.rst ++++ b/build/pkgs/flint/SPKG.rst +@@ -4,8 +4,8 @@ flint: Fast Library for Number Theory + Description + ----------- + +-FLINT is a C library for doing number theory, maintained by William +-Hart. ++FLINT is a C library for doing number theory, maintained by ++Fredrik Johansson. + + Website: http://www.flintlib.org + +@@ -20,4 +20,4 @@ Upstream Contact + + - flint-devel Gougle Group + (http://groups.google.co.uk/group/flint-devel) +-- William Hart ++- Fredrik Johansson +diff --git a/build/pkgs/flint/checksums.ini b/build/pkgs/flint/checksums.ini +index 3d449d98064..ab836606657 100644 +--- a/build/pkgs/flint/checksums.ini ++++ b/build/pkgs/flint/checksums.ini +@@ -1,5 +1,5 @@ + tarball=flint-VERSION.tar.gz +-sha1=63d90f8242c8f8ab4011fbcfb44b86c154f43abd +-md5=c2d3cec326438f159a530c66eb07fafe +-cksum=4244948341 +-upstream_url=http://flintlib.org/flint-VERSION.tar.gz ++sha1=65be9297c06edd7e24f20874b7bd6130cee56723 ++md5=5189f67b0ec12e4a54d6782851642b81 ++cksum=172350473 ++upstream_url=https://github.com/flintlib/flint/releases/download/vVERSION/flint-VERSION.tar.gz +diff --git a/build/pkgs/flint/dependencies b/build/pkgs/flint/dependencies +index 385df4faa7d..1108dc4fb21 100644 +--- a/build/pkgs/flint/dependencies ++++ b/build/pkgs/flint/dependencies +@@ -1,4 +1,4 @@ +-$(MP_LIBRARY) mpfr ntl ++$(MP_LIBRARY) mpfr + + ---------- + All lines of this file are ignored except the first. +diff --git a/build/pkgs/flint/package-version.txt b/build/pkgs/flint/package-version.txt +index c8e38b61405..cb2b00e4f7a 100644 +--- a/build/pkgs/flint/package-version.txt ++++ b/build/pkgs/flint/package-version.txt +@@ -1 +1 @@ +-2.9.0 ++3.0.1 +diff --git a/build/pkgs/flint/patches/0001-Makefile.in-fix-handling-of-DESTDIR.patch b/build/pkgs/flint/patches/0001-Makefile.in-fix-handling-of-DESTDIR.patch +new file mode 100644 +index 00000000000..48a32f5d894 +--- /dev/null ++++ b/build/pkgs/flint/patches/0001-Makefile.in-fix-handling-of-DESTDIR.patch +@@ -0,0 +1,106 @@ ++From 54277f054f13254898c9a57c2c7eb869877e1252 Mon Sep 17 00:00:00 2001 ++From: Marc Mezzarobba ++Date: Mon, 13 Nov 2023 10:23:54 +0100 ++Subject: [PATCH] Makefile.in: fix handling of $DESTDIR ++ ++--- ++ Makefile.in | 54 ++++++++++++++++++++++++++--------------------------- ++ 1 file changed, 27 insertions(+), 27 deletions(-) ++ ++diff --git a/Makefile.in b/Makefile.in ++index 08db6837c..2827b9da1 100644 ++--- a/Makefile.in +++++ b/Makefile.in ++@@ -34,9 +34,9 @@ FLINT_SOLIB:=@FLINT_SOLIB@ ++ prefix:=@prefix@ ++ exec_prefix:=@exec_prefix@ ++ ++-INCLUDEDIR:=$(DESTDIR)@includedir@ ++-LIBDIR:=$(DESTDIR)@libdir@ ++-BINDIR:=$(DESTDIR)@bindir@ +++INCLUDEDIR:=@includedir@ +++LIBDIR:=@libdir@ +++BINDIR:=@bindir@ ++ PKGCONFIGDIR:=$(LIBDIR)/pkgconfig ++ ++ HOST_OS:=@host_os@ ++@@ -202,10 +202,10 @@ BUILD_DIRS += \ ++ endif ++ ++ INSTALL_DIRS := \ ++- $(LIBDIR) $(INCLUDEDIR)/flint \ ++- $(PKGCONFIGDIR) +++ $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCLUDEDIR)/flint \ +++ $(DESTDIR)$(PKGCONFIGDIR) ++ ifneq ($(FLINT_DLLLIB),0) ++-INSTALL_DIRS += $(BINDIR) +++INSTALL_DIRS += $(DESTDIR)$(BINDIR) ++ endif ++ ++ ################################################################################ ++@@ -722,41 +722,41 @@ distclean: clean ++ ################################################################################ ++ ++ install: library | $(INSTALL_DIRS) ++- $(CP) flint.pc $(PKGCONFIGDIR)/flint.pc +++ $(CP) flint.pc $(DESTDIR)$(PKGCONFIGDIR)/flint.pc ++ ifneq ($(SHARED), 0) ++ ifneq ($(FLINT_DLLLIB),0) ++- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB) $(BINDIR) ++- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_MAJOR) $(BINDIR) ++- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_FULL) $(BINDIR) ++- $(CP) $(FLINT_DIR)/$(FLINT_IMPLIB) $(LIBDIR) +++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB) $(DESTDIR)$(BINDIR) +++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_MAJOR) $(DESTDIR)$(BINDIR) +++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_FULL) $(DESTDIR)$(BINDIR) +++ $(CP) $(FLINT_DIR)/$(FLINT_IMPLIB) $(DESTDIR)$(LIBDIR) ++ else ++- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB) $(LIBDIR) ++- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_MAJOR) $(LIBDIR) ++- $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_FULL) $(LIBDIR) +++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB) $(DESTDIR)$(LIBDIR) +++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_MAJOR) $(DESTDIR)$(LIBDIR) +++ $(CP_A) $(FLINT_DIR)/$(FLINT_LIB_FULL) $(DESTDIR)$(LIBDIR) ++ endif ++ ifneq ($(FLINT_DYLIB),0) ++- install_name_tool -id $(LIBDIR)/$(FLINT_LIB_FULL) $(LIBDIR)/$(FLINT_LIB) +++ install_name_tool -id $(LIBDIR)/$(FLINT_LIB_FULL) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB) ++ endif ++ endif ++ ifneq ($(STATIC), 0) ++- $(CP) $(FLINT_DIR)/$(FLINT_LIB_STATIC) $(LIBDIR) +++ $(CP) $(FLINT_DIR)/$(FLINT_LIB_STATIC) $(DESTDIR)$(LIBDIR) ++ endif ++- $(CP) $(HEADERS) $(INCLUDEDIR)/flint +++ $(CP) $(HEADERS) $(DESTDIR)$(INCLUDEDIR)/flint ++ ++ uninstall: ++- $(RM_F) $(PKGCONFIGDIR)/flint.pc +++ $(RM_F) $(DESTDIR)$(PKGCONFIGDIR)/flint.pc ++ ifneq ($(FLINT_DLLLIB),0) ++- $(RM_F) $(BINDIR)/$(FLINT_LIB) ++- $(RM_F) $(BINDIR)/$(FLINT_LIB_MAJOR) ++- $(RM_F) $(BINDIR)/$(FLINT_LIB_FULL) ++- $(RM_F) $(LIBDIR)/$(FLINT_IMPLIB) +++ $(RM_F) $(DESTDIR)$(BINDIR)/$(FLINT_LIB) +++ $(RM_F) $(DESTDIR)$(BINDIR)/$(FLINT_LIB_MAJOR) +++ $(RM_F) $(DESTDIR)$(BINDIR)/$(FLINT_LIB_FULL) +++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_IMPLIB) ++ else ++- $(RM_F) $(LIBDIR)/$(FLINT_LIB) ++- $(RM_F) $(LIBDIR)/$(FLINT_LIB_MAJOR) ++- $(RM_F) $(LIBDIR)/$(FLINT_LIB_FULL) +++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB) +++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB_MAJOR) +++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB_FULL) ++ endif ++- $(RM_F) $(LIBDIR)/$(FLINT_LIB_STATIC) ++- $(RM_RF) $(INCLUDEDIR)/flint +++ $(RM_F) $(DESTDIR)$(LIBDIR)/$(FLINT_LIB_STATIC) +++ $(RM_RF) $(DESTDIR)$(INCLUDEDIR)/flint ++ ++ ################################################################################ ++ # maintainer stuff ++-- ++2.42.0 ++ +diff --git a/build/pkgs/flint/spkg-build.in b/build/pkgs/flint/spkg-build.in +new file mode 100644 +index 00000000000..ffb822c8a97 +--- /dev/null ++++ b/build/pkgs/flint/spkg-build.in +@@ -0,0 +1,3 @@ ++cd src ++sdh_configure ++sdh_make +diff --git a/build/pkgs/flint/spkg-configure.m4 b/build/pkgs/flint/spkg-configure.m4 +index a58108c9d6e..9576e4cc1e9 100644 +--- a/build/pkgs/flint/spkg-configure.m4 ++++ b/build/pkgs/flint/spkg-configure.m4 +@@ -1,25 +1,8 @@ + SAGE_SPKG_CONFIGURE([flint], [ +- SAGE_SPKG_DEPCHECK([mpfr ntl], [ ++ SAGE_SPKG_DEPCHECK([mpfr], [ + AC_CHECK_HEADER(flint/flint.h, [ +- dnl flint_parallel_binary_splitting appears in Flint 2.9.0, needed by arb 2.23 +- AC_SEARCH_LIBS([flint_parallel_binary_splitting], [flint], [ +- dnl check that NTL is linked in +- AC_SEARCH_LIBS([fmpz_poly_get_ZZX], [flint], [ +- +- AC_MSG_CHECKING([that GC is not enabled in Flint... ]) +- AC_RUN_IFELSE([ +- AC_LANG_PROGRAM([[#include ]], [ +- [#ifdef HAVE_GC] +- [return HAVE_GC;] +- [#else] +- [return 0;] +- [#endif]])], +- [AC_MSG_RESULT([GC not enabled. Good.])], +- [AC_MSG_RESULT([GC enabled. Incompatible with Sage.]) +- sage_spkg_install_flint=yes], +- [AC_MSG_RESULT(["cross compiling. assuming GC is not enabled"])]) +- ], [sage_spkg_install_flint=yes]) +- ], [sage_spkg_install_flint=yes]) ++ dnl gr_get_fexpr appears in Flint 3.0 ++ AC_SEARCH_LIBS([gr_get_fexpr], [flint], [], [sage_spkg_install_flint=yes]) + ], [sage_spkg_install_flint=yes]) + ]) + ], [], [], [ +diff --git a/build/pkgs/flint/spkg-install.in b/build/pkgs/flint/spkg-install.in +index eacd7b6e491..3ea8c053669 100644 +--- a/build/pkgs/flint/spkg-install.in ++++ b/build/pkgs/flint/spkg-install.in +@@ -1,36 +1,2 @@ +-############################################################################### +-# +-# FLINT Sage install script +-# +-############################################################################### +-if [ "$SAGE_DEBUG" = "yes" ]; then +- echo "Building a debug version of FLINT." +- FLINT_TUNE=" $FLINT_TUNE"; export FLINT_TUNE +- FLINT_CONFIGURE="--enable-assert $FLINT_CONFIGURE" +-fi +- + cd src +- +-echo "Configuring FLINT." +-# Trac #29607: We must always supply --with-gmp, --with-mpfr, +-# --with-ntl because otherwise FLINT's configure script uses +-# /usr/local, which is always wrong. +-# This is why we do not use $SAGE_CONFIGURE_GMP etc. here. +-# The value $SAGE_LOCAL is always a safe choice even if the library +-# is coming from the system and is found using what is in +-# LIBRARY_PATH or LDFLAGS etc. +-./configure \ +- --disable-static \ +- --prefix="$SAGE_LOCAL" \ +- --with-gmp="$SAGE_LOCAL" \ +- --with-mpfr="$SAGE_LOCAL" \ +- --with-ntl="$SAGE_LOCAL" \ +- $FLINT_CONFIGURE || sdh_die "Error: Failed to configure FLINT." +- +-sdh_make verbose +- +-echo "Deleting old FLINT files." +-rm -f $SAGE_LOCAL/lib/libflint* +-rm -rf $SAGE_LOCAL/include/flint +- + sdh_make_install +diff --git a/build/pkgs/gmp/spkg-configure.m4 b/build/pkgs/gmp/spkg-configure.m4 +index 61d7c5f3b2f..4000200db2c 100644 +--- a/build/pkgs/gmp/spkg-configure.m4 ++++ b/build/pkgs/gmp/spkg-configure.m4 +@@ -2,8 +2,10 @@ SAGE_SPKG_CONFIGURE([gmp], [ + sage_spkg_install_gmp=no + AC_CHECK_HEADER(gmp.h, [], [sage_spkg_install_gmp=yes]) + AC_CHECK_HEADER(gmpxx.h, [], [sage_spkg_install_gmp=yes]) +- dnl mpq_cmp_z appeared in GMP 6.1.0 and is used by pynac +- AC_SEARCH_LIBS([__gmpq_cmp_z], [gmp], [], ++ dnl mpn_gcd_11 appeared in GMP 6.2.1 ++ dnl It is undocumented but is used by Flint when built with default ++ dnl flags. ++ AC_SEARCH_LIBS([__gmpn_gcd_11], [gmp], [], + [sage_spkg_install_gmp=yes]) + ], [], [], [ + if test x$sage_spkg_install_gmp = xyes; then +diff --git a/build/pkgs/msolve/patches/0001-Make-msolve-build-with-flint3.patch b/build/pkgs/msolve/patches/0001-Make-msolve-build-with-flint3.patch +new file mode 100644 +index 00000000000..27a642a13b0 +--- /dev/null ++++ b/build/pkgs/msolve/patches/0001-Make-msolve-build-with-flint3.patch +@@ -0,0 +1,53 @@ ++From fe730579476de0b2d4181a38efa7f63dff9c81d7 Mon Sep 17 00:00:00 2001 ++From: Marc Mezzarobba ++Date: Tue, 12 Sep 2023 08:23:08 +0200 ++Subject: [PATCH] Make msolve build with flint3 ++ ++--- ++ src/fglm/berlekamp_massey.c | 3 +++ ++ src/fglm/data_fglm.c | 7 +++++-- ++ 2 files changed, 8 insertions(+), 2 deletions(-) ++ ++diff --git a/src/fglm/berlekamp_massey.c b/src/fglm/berlekamp_massey.c ++index b0f2052..998af1c 100644 ++--- a/src/fglm/berlekamp_massey.c +++++ b/src/fglm/berlekamp_massey.c ++@@ -30,6 +30,9 @@ ++ */ ++ ++ #include +++#if __FLINT_VERSION >= 3 +++# include +++#endif ++ //#include "nmod_poly.h" ++ //#include "mpn_extras.h" ++ ++diff --git a/src/fglm/data_fglm.c b/src/fglm/data_fglm.c ++index 0726760..0e1da6f 100644 ++--- a/src/fglm/data_fglm.c +++++ b/src/fglm/data_fglm.c ++@@ -24,6 +24,7 @@ ++ #include ++ #include ++ #include +++#include ++ ++ ++ typedef uint32_t szmat_t; ++@@ -299,9 +300,11 @@ static inline void nmod_poly_set_prime(nmod_poly_t poly, ++ mp_limb_t ninv = n_preinvert_limb(prime); ++ poly->mod.n = prime; ++ poly->mod.ninv = ninv; +++#if __FLINT_VERSION < 3 ++ count_leading_zeros(poly->mod.norm, prime); ++- /* poly->mod.norm = flint_clz(prime); */ ++- +++#else +++ poly->mod.norm = flint_clz(prime); +++#endif ++ } ++ ++ static inline void fglm_param_set_prime(param_t *param, mp_limb_t prime){ ++-- ++2.40.1 ++ +diff --git a/build/pkgs/sagelib/dependencies b/build/pkgs/sagelib/dependencies +index 5dc2efe1d31..fa6e98df7db 100644 +--- a/build/pkgs/sagelib/dependencies ++++ b/build/pkgs/sagelib/dependencies +@@ -1,4 +1,4 @@ +-FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup $(PYTHON) pythran ++FORCE $(SCRIPTS) boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml importlib_metadata importlib_resources jupyter_core lcalc lrcalc_python libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy primesieve primecount primecountpy pycygwin $(PYTHON) requests rw sage_conf singular symmetrica typing_extensions $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup $(PYTHON) pythran + + ---------- + All lines of this file are ignored except the first. +diff --git a/build/pkgs/symengine/dependencies b/build/pkgs/symengine/dependencies +index 1fc34963eda..7795d486018 100644 +--- a/build/pkgs/symengine/dependencies ++++ b/build/pkgs/symengine/dependencies +@@ -1,4 +1,4 @@ +-$(MP_LIBRARY) arb ecm flint mpc mpfr | cmake ++$(MP_LIBRARY) ecm flint mpc mpfr | cmake + + ---------- + All lines of this file are ignored except the first. +diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in +index 87b27ca05cb..895d6572d1e 100644 +--- a/pkgs/sage-conf/_sage_conf/_conf.py.in ++++ b/pkgs/sage-conf/_sage_conf/_conf.py.in +@@ -19,8 +19,6 @@ MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL) + # Delete this line if your ECL can load Kenzo without further prodding. + KENZO_FAS = "@SAGE_KENZO_FAS@".replace('${prefix}', SAGE_LOCAL) + +-ARB_LIBRARY = "@SAGE_ARB_LIBRARY@" +- + NTL_INCDIR = "@NTL_INCDIR@" + NTL_LIBDIR = "@NTL_LIBDIR@" + +diff --git a/src/sage/env.py b/src/sage/env.py +index 4515e90e912..9ab6b1e1864 100644 +--- a/src/sage/env.py ++++ b/src/sage/env.py +@@ -223,7 +223,6 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st + FOURTITWO_PPI = var("FOURTITWO_PPI") + FOURTITWO_CIRCUITS = var("FOURTITWO_CIRCUITS") + FOURTITWO_GROEBNER = var("FOURTITWO_GROEBNER") +-ARB_LIBRARY = var("ARB_LIBRARY", "arb") + CBLAS_PC_MODULES = var("CBLAS_PC_MODULES", "cblas:openblas:blas") + ECL_CONFIG = var("ECL_CONFIG", "ecl-config") + NTL_INCDIR = var("NTL_INCDIR") +@@ -356,8 +355,7 @@ def cython_aliases(required_modules=None, + sage: cython_aliases() + {...} + sage: sorted(cython_aliases().keys()) +- ['ARB_LIBRARY', +- 'CBLAS_CFLAGS', ++ ['CBLAS_CFLAGS', + ..., + 'ZLIB_LIBRARIES'] + sage: cython_aliases(required_modules=('module-that-is-assumed-to-not-exist')) +@@ -475,8 +473,6 @@ def uname_specific(name, value, alternative): + if "LINBOX_CFLAGS" in aliases: + aliases["LINBOX_CFLAGS"].append("-std=gnu++11") + +- aliases["ARB_LIBRARY"] = ARB_LIBRARY +- + # TODO: Remove Cygwin hack by installing a suitable cblas.pc + if os.path.exists('/usr/lib/libblas.dll.a'): + aliases["CBLAS_LIBS"] = ['gslcblas'] +diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py +index bc34d35dd1c..4097d3512b9 100644 +--- a/src/sage/features/sagemath.py ++++ b/src/sage/features/sagemath.py +@@ -777,7 +777,7 @@ class sage__rings__number_field(JoinFeature): + A :class:`~sage.features.Feature` describing the presence of :mod:`sage.rings.number_field`. + + Number fields are implemented in Sage using a complicated mixture of various libraries, +- including :ref:`arb `, :ref:`FLINT `, :ref:`GAP `, ++ including :ref:`FLINT `, :ref:`GAP `, + :ref:`MPFI `, :ref:`NTL `, and :ref:`PARI `. + + EXAMPLES: +diff --git a/src/sage/libs/arb/acb.pxd b/src/sage/libs/arb/acb.pxd +index 5148dc43991..851488d803a 100644 +--- a/src/sage/libs/arb/acb.pxd ++++ b/src/sage/libs/arb/acb.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = acb.h + + from sage.libs.arb.types cimport * +@@ -152,10 +152,6 @@ cdef extern from "arb_wrap.h": + void acb_sech(acb_t s, const acb_t z, long prec) + void acb_csch(acb_t c, const acb_t z, long prec) + +- void acb_rising_ui_bs(acb_t z, const acb_t x, unsigned long n, long prec) +- void acb_rising_ui_rs(acb_t z, const acb_t x, unsigned long n, unsigned long step, long prec) +- void acb_rising_ui_rec(acb_t z, const acb_t x, unsigned long n, long prec) +- void acb_rising_ui(acb_t z, const acb_t x, unsigned long n, long prec) + void acb_rising(acb_t z, const acb_t x, const acb_t n, long prec) + + void acb_gamma(acb_t y, const acb_t x, long prec) +diff --git a/src/sage/libs/arb/acb_calc.pxd b/src/sage/libs/arb/acb_calc.pxd +index a5dbf360b5e..67bd2ed57dc 100644 +--- a/src/sage/libs/arb/acb_calc.pxd ++++ b/src/sage/libs/arb/acb_calc.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = acb_calc.h + + from sage.libs.arb.types cimport * +diff --git a/src/sage/libs/arb/acb_elliptic.pxd b/src/sage/libs/arb/acb_elliptic.pxd +index 176f68df00e..e3480e9f73b 100644 +--- a/src/sage/libs/arb/acb_elliptic.pxd ++++ b/src/sage/libs/arb/acb_elliptic.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = acb_elliptic.h + + from sage.libs.arb.types cimport * +diff --git a/src/sage/libs/arb/acb_hypgeom.pxd b/src/sage/libs/arb/acb_hypgeom.pxd +index 418e766f10d..c43e5c0623b 100644 +--- a/src/sage/libs/arb/acb_hypgeom.pxd ++++ b/src/sage/libs/arb/acb_hypgeom.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = acb_hypgeom.h + + from sage.libs.arb.types cimport * +diff --git a/src/sage/libs/arb/acb_modular.pxd b/src/sage/libs/arb/acb_modular.pxd +index c708e9bf97d..cdc413c92da 100644 +--- a/src/sage/libs/arb/acb_modular.pxd ++++ b/src/sage/libs/arb/acb_modular.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = acb_modular.h + + from sage.libs.arb.types cimport * +diff --git a/src/sage/libs/arb/acb_poly.pxd b/src/sage/libs/arb/acb_poly.pxd +index 69f4320055b..ae02757ffd9 100644 +--- a/src/sage/libs/arb/acb_poly.pxd ++++ b/src/sage/libs/arb/acb_poly.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = acb_poly.h + + from sage.libs.arb.types cimport * +@@ -79,24 +79,10 @@ cdef extern from "arb_wrap.h": + void _acb_poly_divrem(acb_ptr Q, acb_ptr R, acb_srcptr A, long lenA, acb_srcptr B, long lenB, long prec) + bint acb_poly_divrem(acb_poly_t Q, acb_poly_t R, const acb_poly_t A, const acb_poly_t B, long prec) + void _acb_poly_div_root(acb_ptr Q, acb_t R, acb_srcptr A, long len, const acb_t c, long prec) +- void _acb_poly_taylor_shift_horner(acb_ptr g, const acb_t c, long n, long prec) +- void acb_poly_taylor_shift_horner(acb_poly_t g, const acb_poly_t f, const acb_t c, long prec) +- void _acb_poly_taylor_shift_divconquer(acb_ptr g, const acb_t c, long n, long prec) +- void acb_poly_taylor_shift_divconquer(acb_poly_t g, const acb_poly_t f, const acb_t c, long prec) +- void _acb_poly_taylor_shift_convolution(acb_ptr g, const acb_t c, long n, long prec) +- void acb_poly_taylor_shift_convolution(acb_poly_t g, const acb_poly_t f, const acb_t c, long prec) + void _acb_poly_taylor_shift(acb_ptr g, const acb_t c, long n, long prec) + void acb_poly_taylor_shift(acb_poly_t g, const acb_poly_t f, const acb_t c, long prec) +- void _acb_poly_compose_horner(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) +- void acb_poly_compose_horner(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) +- void _acb_poly_compose_divconquer(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) +- void acb_poly_compose_divconquer(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) + void _acb_poly_compose(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long prec) + void acb_poly_compose(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long prec) +- void _acb_poly_compose_series_horner(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) +- void acb_poly_compose_series_horner(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) +- void _acb_poly_compose_series_brent_kung(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) +- void acb_poly_compose_series_brent_kung(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_compose_series(acb_ptr res, acb_srcptr poly1, long len1, acb_srcptr poly2, long len2, long n, long prec) + void acb_poly_compose_series(acb_poly_t res, const acb_poly_t poly1, const acb_poly_t poly2, long n, long prec) + void _acb_poly_revert_series_lagrange(acb_ptr h, acb_srcptr f, long flen, long n, long prec) +@@ -161,10 +147,6 @@ cdef extern from "arb_wrap.h": + void acb_poly_exp_series_basecase(acb_poly_t f, const acb_poly_t h, long n, long prec) + void _acb_poly_exp_series(acb_ptr f, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_exp_series(acb_poly_t f, const acb_poly_t h, long n, long prec) +- void _acb_poly_sin_cos_series_basecase(acb_ptr s, acb_ptr c, acb_srcptr h, long hlen, long n, long prec, int times_pi) +- void acb_poly_sin_cos_series_basecase(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec, int times_pi) +- void _acb_poly_sin_cos_series_tangent(acb_ptr s, acb_ptr c, acb_srcptr h, long hlen, long n, long prec, int times_pi) +- void acb_poly_sin_cos_series_tangent(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec, int times_pi) + void _acb_poly_sin_cos_series(acb_ptr s, acb_ptr c, acb_srcptr h, long hlen, long n, long prec) + void acb_poly_sin_cos_series(acb_poly_t s, acb_poly_t c, const acb_poly_t h, long n, long prec) + void _acb_poly_sin_series(acb_ptr s, acb_srcptr h, long hlen, long n, long prec) +diff --git a/src/sage/libs/arb/arb.pxd b/src/sage/libs/arb/arb.pxd +index c82b94de30f..acd232ab816 100644 +--- a/src/sage/libs/arb/arb.pxd ++++ b/src/sage/libs/arb/arb.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = arb.h + + from sage.libs.arb.types cimport * +@@ -224,15 +224,8 @@ cdef extern from "arb_wrap.h": + + void arb_lambertw(arb_t res, const arb_t x, int flags, long prec) + +- void arb_rising_ui_bs(arb_t z, const arb_t x, unsigned long n, long prec) +- void arb_rising_ui_rs(arb_t z, const arb_t x, unsigned long n, unsigned long step, long prec) +- void arb_rising_ui_rec(arb_t z, const arb_t x, unsigned long n, long prec) +- void arb_rising_ui(arb_t z, const arb_t x, unsigned long n, long prec) + void arb_rising(arb_t z, const arb_t x, const arb_t n, long prec) + void arb_rising_fmpq_ui(arb_t z, const fmpq_t x, unsigned long n, long prec) +- void arb_rising2_ui_bs(arb_t u, arb_t v, const arb_t x, unsigned long n, long prec) +- void arb_rising2_ui_rs(arb_t u, arb_t v, const arb_t x, unsigned long n, unsigned long step, long prec) +- void arb_rising2_ui(arb_t u, arb_t v, const arb_t x, unsigned long n, long prec) + void arb_fac_ui(arb_t z, unsigned long n, long prec) + void arb_bin_ui(arb_t z, const arb_t n, unsigned long k, long prec) + void arb_bin_uiui(arb_t z, unsigned long n, unsigned long k, long prec) +diff --git a/src/sage/libs/arb/arb_fmpz_poly.pxd b/src/sage/libs/arb/arb_fmpz_poly.pxd +index 079f76e9d9e..55daa705238 100644 +--- a/src/sage/libs/arb/arb_fmpz_poly.pxd ++++ b/src/sage/libs/arb/arb_fmpz_poly.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = arb_fmpz_poly.h + + from sage.libs.arb.types cimport * +@@ -22,5 +22,4 @@ cdef extern from "arb_wrap.h": + unsigned long arb_fmpz_poly_deflation(const fmpz_poly_t poly) + void arb_fmpz_poly_deflate(fmpz_poly_t res, const fmpz_poly_t poly, unsigned long deflation) + void arb_fmpz_poly_complex_roots(acb_ptr roots, const fmpz_poly_t poly, int flags, long prec) +- void arb_fmpz_poly_cos_minpoly(fmpz_poly_t res, unsigned long n) + void arb_fmpz_poly_gauss_period_minpoly(fmpz_poly_t res, unsigned long q, unsigned long n) +diff --git a/src/sage/libs/arb/arb_hypgeom.pxd b/src/sage/libs/arb/arb_hypgeom.pxd +index fb1c40ddaa8..139b987d669 100644 +--- a/src/sage/libs/arb/arb_hypgeom.pxd ++++ b/src/sage/libs/arb/arb_hypgeom.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = arb_hypgeom.h + + from sage.libs.flint.types cimport fmpz_t +diff --git a/src/sage/libs/arb/arb_wrap.h b/src/sage/libs/arb/arb_wrap.h +index 49997075ee5..488bb376d5e 100644 +--- a/src/sage/libs/arb/arb_wrap.h ++++ b/src/sage/libs/arb/arb_wrap.h +@@ -5,25 +5,27 @@ + * by arb, most of which rely on flint's ulong and slong defines. + */ + ++#include ++ + #undef ulong + #undef slong + + #define ulong mp_limb_t + #define slong mp_limb_signed_t + +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include + + #undef ulong + #undef slong +diff --git a/src/sage/libs/arb/arf.pxd b/src/sage/libs/arb/arf.pxd +index b8b83fefcdc..84778fe9f09 100644 +--- a/src/sage/libs/arb/arf.pxd ++++ b/src/sage/libs/arb/arf.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = arf.h + + from sage.libs.arb.types cimport * +@@ -30,7 +30,6 @@ cdef extern from "arb_wrap.h": + void arf_set_ui(arf_t y, unsigned long x) + void arf_set_si(arf_t y, long x) + void arf_set_mpfr(arf_t y, const mpfr_t x) +- # void arf_set_fmpr(arf_t y, const fmpr_t x) + void arf_set_d(arf_t y, double x) + void arf_swap(arf_t y, arf_t x) + void arf_init_set_ui(arf_t y, unsigned long x) +@@ -46,7 +45,6 @@ cdef extern from "arb_wrap.h": + int arf_set_round_fmpz_2exp(arf_t y, const fmpz_t x, const fmpz_t e, long prec, arf_rnd_t rnd) + void arf_get_fmpz_2exp(fmpz_t m, fmpz_t e, const arf_t x) + double arf_get_d(const arf_t x, arf_rnd_t rnd) +- # void arf_get_fmpr(fmpr_t y, const arf_t x) + int arf_get_mpfr(mpfr_t y, const arf_t x, mpfr_rnd_t rnd) + void arf_get_fmpz(fmpz_t z, const arf_t x, arf_rnd_t rnd) + long arf_get_si(const arf_t x, arf_rnd_t rnd) +diff --git a/src/sage/libs/arb/bernoulli.pxd b/src/sage/libs/arb/bernoulli.pxd +index f859ebfb8d7..95a84dd5179 100644 +--- a/src/sage/libs/arb/bernoulli.pxd ++++ b/src/sage/libs/arb/bernoulli.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = bernoulli.h + + from sage.libs.flint.types cimport fmpq_t, ulong +diff --git a/src/sage/libs/arb/mag.pxd b/src/sage/libs/arb/mag.pxd +index d5d8693ea8f..69dfb990ae0 100644 +--- a/src/sage/libs/arb/mag.pxd ++++ b/src/sage/libs/arb/mag.pxd +@@ -1,4 +1,4 @@ +-# distutils: libraries = gmp flint ARB_LIBRARY ++# distutils: libraries = gmp flint + # distutils: depends = mag.h + + from sage.libs.arb.types cimport * +@@ -27,13 +27,11 @@ cdef extern from "arb_wrap.h": + # void mag_randtest(mag_t x, flint_rand_t state, long expbits) + # void mag_randtest_special(mag_t x, flint_rand_t state, long expbits) + void mag_set_d(mag_t y, double x) +- # void mag_set_fmpr(mag_t y, const fmpr_t x) + void mag_set_ui(mag_t y, unsigned long x) + void mag_set_fmpz(mag_t y, const fmpz_t x) + void mag_set_d_2exp_fmpz(mag_t z, double x, const fmpz_t y) + void mag_set_fmpz_2exp_fmpz(mag_t z, const fmpz_t x, const fmpz_t y) + void mag_set_ui_2exp_si(mag_t z, unsigned long x, long y) +- # void mag_get_fmpr(fmpr_t y, const mag_t x) + void mag_get_fmpq(fmpq_t y, const mag_t x) + void mag_set_ui_lower(mag_t z, unsigned long x) + void mag_set_fmpz_lower(mag_t z, const fmpz_t x) +diff --git a/src/sage/libs/flint/flint_wrap.h b/src/sage/libs/flint/flint_wrap.h +index 266535c3835..4db72b97660 100644 +--- a/src/sage/libs/flint/flint_wrap.h ++++ b/src/sage/libs/flint/flint_wrap.h +@@ -15,6 +15,7 @@ + */ + + #include ++#include + + /* Save previous definition of ulong if any, as pari also uses it */ + /* Should work on GCC, clang, MSVC */ +@@ -33,6 +34,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -47,6 +49,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/src/sage/libs/flint/fmpq.pxd b/src/sage/libs/flint/fmpq.pxd +index 5e64c82102f..0616c0a7408 100644 +--- a/src/sage/libs/flint/fmpq.pxd ++++ b/src/sage/libs/flint/fmpq.pxd +@@ -12,6 +12,8 @@ cdef extern from "flint_wrap.h": + fmpz * fmpq_denref(fmpq_t) + void fmpq_init(fmpq_t) + void fmpq_clear(fmpq_t) ++ void fmpq_init_set_readonly(fmpq_t, const mpq_t) ++ void fmpq_clear_readonly(fmpq_t) + void fmpq_one(fmpq_t) + void fmpq_zero(fmpq_t) + bint fmpq_is_zero(fmpq_t) +diff --git a/src/sage/libs/flint/fmpq_poly.pxd b/src/sage/libs/flint/fmpq_poly.pxd +index 6050c487835..afa16e5bbdd 100644 +--- a/src/sage/libs/flint/fmpq_poly.pxd ++++ b/src/sage/libs/flint/fmpq_poly.pxd +@@ -30,6 +30,9 @@ cdef extern from "flint_wrap.h": + void fmpq_poly_canonicalise(fmpq_poly_t) + int fmpq_poly_is_canonical(const fmpq_poly_t) + ++ void _fmpq_poly_set_length(fmpq_poly_t, slong) ++ void _fmpq_poly_normalise(fmpq_poly_t) ++ + # Polynomial parameters + slong fmpq_poly_degree(const fmpq_poly_t) + ulong fmpq_poly_length(const fmpq_poly_t) +@@ -46,10 +49,7 @@ cdef extern from "flint_wrap.h": + void fmpq_poly_set_ui(fmpq_poly_t, ulong) + void fmpq_poly_set_fmpz(fmpq_poly_t, const fmpz_t) + void fmpq_poly_set_fmpq(fmpq_poly_t, const fmpq_t) +- void fmpq_poly_set_mpz(fmpq_poly_t, const mpz_t) +- void fmpq_poly_set_mpq(fmpq_poly_t, const mpq_t) + void fmpq_poly_set_fmpz_poly(fmpq_poly_t, const fmpz_poly_t) +- void fmpq_poly_set_array_mpq(fmpq_poly_t, const mpq_t *, slong) + + void fmpq_poly_set_str(fmpq_poly_t, const char *) + char *fmpq_poly_get_str(const fmpq_poly_t) +@@ -67,7 +67,6 @@ cdef extern from "flint_wrap.h": + void fmpq_poly_reverse(fmpq_poly_t, const fmpq_poly_t, slong) + + void fmpq_poly_get_coeff_fmpq(fmpq_t, const fmpq_poly_t, slong) +- void fmpq_poly_get_coeff_mpq(mpq_t, const fmpq_poly_t, slong) + void fmpq_poly_get_coeff_si(slong, const fmpq_poly_t, slong) + void fmpq_poly_get_coeff_ui(ulong, const fmpq_poly_t, slong) + +@@ -75,8 +74,6 @@ cdef extern from "flint_wrap.h": + void fmpq_poly_set_coeff_ui(fmpq_poly_t, slong, ulong) + void fmpq_poly_set_coeff_fmpz(fmpq_poly_t, slong, const fmpz_t) + void fmpq_poly_set_coeff_fmpq(fmpq_poly_t, slong, const fmpq_t) +- void fmpq_poly_set_coeff_mpz(fmpq_poly_t, slong, const mpz_t) +- void fmpq_poly_set_coeff_mpq(fmpq_poly_t, slong, const mpq_t) + + # Comparison + int fmpq_poly_equal(const fmpq_poly_t, const fmpq_poly_t) +@@ -100,8 +97,6 @@ cdef extern from "flint_wrap.h": + fmpq_poly_t, const fmpq_poly_t, const fmpz_t) + void fmpq_poly_scalar_mul_fmpq( + fmpq_poly_t, const fmpq_poly_t, const fmpq_t) +- void fmpq_poly_scalar_mul_mpz(fmpq_poly_t, const fmpq_poly_t, const mpz_t) +- void fmpq_poly_scalar_mul_mpq(fmpq_poly_t, const fmpq_poly_t, const mpq_t) + + void fmpq_poly_scalar_div_si(fmpq_poly_t, const fmpq_poly_t, slong) + void fmpq_poly_scalar_div_ui(fmpq_poly_t, const fmpq_poly_t, ulong) +@@ -109,8 +104,6 @@ cdef extern from "flint_wrap.h": + fmpq_poly_t, const fmpq_poly_t, const fmpz_t) + void fmpq_poly_scalar_div_fmpq( + fmpq_poly_t, const fmpq_poly_t, const fmpq_t) +- void fmpq_poly_scalar_div_mpz(fmpq_poly_t, const fmpq_poly_t, const mpz_t) +- void fmpq_poly_scalar_div_mpq(fmpq_poly_t, const fmpq_poly_t, const mpq_t) + + # Multiplication + void fmpq_poly_mul(fmpq_poly_t, const fmpq_poly_t, const fmpq_poly_t) +@@ -155,8 +148,6 @@ cdef extern from "flint_wrap.h": + # Evaluation + void fmpq_poly_evaluate_fmpz(fmpq_t, const fmpq_poly_t, const fmpz_t) + void fmpq_poly_evaluate_fmpq(fmpq_t, const fmpq_poly_t, const fmpq_t) +- void fmpq_poly_evaluate_mpz(mpq_t, const fmpq_poly_t, const mpz_t) +- void fmpq_poly_evaluate_mpq(mpq_t, const fmpq_poly_t, const mpq_t) + + # Composition + void fmpq_poly_compose(fmpq_poly_t, const fmpq_poly_t, const fmpq_poly_t) +@@ -189,3 +180,11 @@ cdef extern from "flint_wrap.h": + # since the fmpq_poly header seems to be lacking this inline function + cdef inline sage_fmpq_poly_max_limbs(const fmpq_poly_t poly) noexcept: + return _fmpz_vec_max_limbs(fmpq_poly_numref(poly), fmpq_poly_length(poly)) ++ ++# functions removed from flint but still needed in sage ++cdef void fmpq_poly_scalar_mul_mpz(fmpq_poly_t, const fmpq_poly_t, const mpz_t) ++cdef void fmpq_poly_scalar_mul_mpq(fmpq_poly_t, const fmpq_poly_t, const mpq_t) ++cdef void fmpq_poly_set_coeff_mpq(fmpq_poly_t, slong, const mpq_t) ++cdef void fmpq_poly_get_coeff_mpq(mpq_t, const fmpq_poly_t, slong) ++cdef void fmpq_poly_set_mpz(fmpq_poly_t, const mpz_t) ++cdef void fmpq_poly_set_mpq(fmpq_poly_t, const mpq_t) +diff --git a/src/sage/libs/flint/fmpq_poly.pyx b/src/sage/libs/flint/fmpq_poly.pyx +new file mode 100644 +index 00000000000..3b8a0cf0c51 +--- /dev/null ++++ b/src/sage/libs/flint/fmpq_poly.pyx +@@ -0,0 +1,45 @@ ++# Functions removed from flint but still needed in Sage. Code adapted from ++# earlier versions of flint. ++ ++from sage.libs.gmp.mpq cimport * ++from sage.libs.flint.fmpz cimport * ++from sage.libs.flint.fmpq cimport * ++ ++cdef void fmpq_poly_scalar_mul_mpz(fmpq_poly_t rop, const fmpq_poly_t op, const mpz_t c): ++ cdef fmpz_t f ++ fmpz_init_set_readonly(f, c) ++ fmpq_poly_scalar_mul_fmpz(rop, op, f) ++ fmpz_clear_readonly(f) ++ ++cdef void fmpq_poly_scalar_mul_mpq(fmpq_poly_t rop, const fmpq_poly_t op, const mpq_t c): ++ cdef fmpq_t f ++ fmpq_init_set_readonly(f, c) ++ fmpq_poly_scalar_mul_fmpq(rop, op, f) ++ fmpq_clear_readonly(f) ++ ++cdef void fmpq_poly_set_coeff_mpq(fmpq_poly_t poly, slong n, const mpq_t x): ++ cdef fmpq_t t ++ fmpq_init_set_readonly(t, x) ++ fmpq_poly_set_coeff_fmpq(poly, n, t) ++ fmpq_clear_readonly(t) ++ ++cdef void fmpq_poly_get_coeff_mpq(mpq_t x, const fmpq_poly_t poly, slong n): ++ cdef fmpq_t t ++ fmpq_init(t) ++ fmpq_poly_get_coeff_fmpq(t, poly, n) ++ fmpq_get_mpq(x, t) ++ fmpq_clear(t) ++ ++cdef void fmpq_poly_set_mpq(fmpq_poly_t poly, const mpq_t x): ++ fmpq_poly_fit_length(poly, 1) ++ fmpz_set_mpz(fmpq_poly_numref(poly), mpq_numref(x)) ++ fmpz_set_mpz(fmpq_poly_denref(poly), mpq_denref(x)) ++ _fmpq_poly_set_length(poly, 1) ++ _fmpq_poly_normalise(poly) ++ ++cdef void fmpq_poly_set_mpz(fmpq_poly_t poly, const mpz_t x): ++ fmpq_poly_fit_length(poly, 1) ++ fmpz_set_mpz(fmpq_poly_numref(poly), x) ++ fmpz_one(fmpq_poly_denref(poly)) ++ _fmpq_poly_set_length(poly, 1) ++ _fmpq_poly_normalise(poly) +diff --git a/src/sage/libs/flint/fmpz.pxd b/src/sage/libs/flint/fmpz.pxd +index 01058d0f130..b97fbe1eae0 100644 +--- a/src/sage/libs/flint/fmpz.pxd ++++ b/src/sage/libs/flint/fmpz.pxd +@@ -16,6 +16,9 @@ cdef extern from "flint_wrap.h": + void fmpz_init_set(fmpz_t, fmpz_t) + void fmpz_init_set_ui(fmpz_t, ulong) + ++ void fmpz_init_set_readonly(fmpz_t, const mpz_t) ++ void fmpz_clear_readonly(fmpz_t) ++ + # Conversion + void fmpz_set(fmpz_t f, fmpz_t g) + void fmpz_set_ui(fmpz_t, ulong) +diff --git a/src/sage/libs/flint/fmpz_mod_poly.pxd b/src/sage/libs/flint/fmpz_mod_poly.pxd +index 24b653eb3b7..2727246da98 100644 +--- a/src/sage/libs/flint/fmpz_mod_poly.pxd ++++ b/src/sage/libs/flint/fmpz_mod_poly.pxd +@@ -67,13 +67,6 @@ cdef extern from "flint_wrap.h": + void fmpz_mod_poly_get_coeff_fmpz(fmpz_t x, const fmpz_mod_poly_t poly, + slong n, const fmpz_mod_ctx_t ctx) + +- void fmpz_mod_poly_set_coeff_mpz(fmpz_mod_poly_t poly, +- slong n, const mpz_t x, const fmpz_mod_ctx_t ctx) +- +- void fmpz_mod_poly_get_coeff_mpz(mpz_t x, +- const fmpz_mod_poly_t poly, slong n, const fmpz_mod_ctx_t ctx) +- +- + void _fmpz_mod_poly_shift_left(fmpz * res, const fmpz * poly, + slong len, slong n) + +@@ -194,14 +187,6 @@ cdef extern from "flint_wrap.h": + const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, + const fmpz_mod_ctx_t ctx) + +- void fmpz_mod_poly_div_basecase(fmpz_mod_poly_t Q, +- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_ctx_t ctx) +- +- void fmpz_mod_poly_div_newton_n_preinv(fmpz_mod_poly_t Q, +- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_poly_t Binv, const fmpz_mod_ctx_t ctx) +- + void fmpz_mod_poly_divrem_newton_n_preinv(fmpz_mod_poly_t Q, + fmpz_mod_poly_t R, const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, + const fmpz_mod_poly_t Binv, const fmpz_mod_ctx_t ctx) +@@ -213,10 +198,6 @@ cdef extern from "flint_wrap.h": + const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, + const fmpz_mod_ctx_t ctx) + +- void fmpz_mod_poly_divrem_divconquer(fmpz_mod_poly_t Q, +- fmpz_mod_poly_t R, const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_ctx_t ctx) +- + void fmpz_mod_poly_divrem(fmpz_mod_poly_t Q, fmpz_mod_poly_t R, + const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx) + +@@ -254,40 +235,13 @@ cdef extern from "flint_wrap.h": + void fmpz_mod_poly_make_monic_f(fmpz_t f, fmpz_mod_poly_t res, + const fmpz_mod_poly_t poly, const fmpz_mod_ctx_t ctx) + +- void fmpz_mod_poly_gcd_euclidean(fmpz_mod_poly_t G, +- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_ctx_t ctx) +- +- void fmpz_mod_poly_gcd_euclidean_f(fmpz_t f, fmpz_mod_poly_t G, +- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_ctx_t ctx) +- + void fmpz_mod_poly_gcd_f(fmpz_t f, fmpz_mod_poly_t G, const fmpz_mod_poly_t A, + const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx) + +- void fmpz_mod_poly_gcd_hgcd(fmpz_mod_poly_t G, +- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_ctx_t ctx) +- +- + void fmpz_mod_poly_gcd(fmpz_mod_poly_t G, const fmpz_mod_poly_t A, + const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx) + + +- void fmpz_mod_poly_xgcd_euclidean(fmpz_mod_poly_t G, +- fmpz_mod_poly_t S, fmpz_mod_poly_t T, +- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_ctx_t ctx) +- +- void fmpz_mod_poly_xgcd_euclidean_f(fmpz_t f, fmpz_mod_poly_t G, +- fmpz_mod_poly_t S, fmpz_mod_poly_t T, +- const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_ctx_t ctx) +- +- void fmpz_mod_poly_xgcd_hgcd(fmpz_mod_poly_t G, fmpz_mod_poly_t S, +- fmpz_mod_poly_t T, const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, +- const fmpz_mod_ctx_t ctx) +- + void fmpz_mod_poly_xgcd(fmpz_mod_poly_t G, fmpz_mod_poly_t S, fmpz_mod_poly_t T, + const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, + const fmpz_mod_ctx_t ctx) +@@ -361,14 +315,6 @@ cdef extern from "flint_wrap.h": + const fmpz_mod_poly_t poly, const fmpz * xs, slong n, + const fmpz_mod_ctx_t ctx) + +- void fmpz_mod_poly_compose_horner(fmpz_mod_poly_t res, +- const fmpz_mod_poly_t poly1, const fmpz_mod_poly_t poly2, +- const fmpz_mod_ctx_t ctx) +- +- void fmpz_mod_poly_compose_divconquer(fmpz_mod_poly_t res, +- const fmpz_mod_poly_t poly1, const fmpz_mod_poly_t poly2, +- const fmpz_mod_ctx_t ctx) +- + void fmpz_mod_poly_compose(fmpz_mod_poly_t res, const fmpz_mod_poly_t poly1, + const fmpz_mod_poly_t poly2, const fmpz_mod_ctx_t ctx) + +diff --git a/src/sage/libs/flint/fmpz_poly.pxd b/src/sage/libs/flint/fmpz_poly.pxd +index 18b36672d30..c8bc6d3ca0a 100644 +--- a/src/sage/libs/flint/fmpz_poly.pxd ++++ b/src/sage/libs/flint/fmpz_poly.pxd +@@ -28,7 +28,6 @@ cdef extern from "flint_wrap.h": + void fmpz_poly_set_ui(fmpz_poly_t, ulong) + void fmpz_poly_set_si(fmpz_poly_t, slong) + void fmpz_poly_set_fmpz(fmpz_poly_t, const fmpz_t) +- void fmpz_poly_set_mpz(fmpz_poly_t, const mpz_t) + int fmpz_poly_set_str(fmpz_poly_t, const char *) + + char *fmpz_poly_get_str(const fmpz_poly_t) +@@ -70,7 +69,6 @@ cdef extern from "flint_wrap.h": + # Scalar multiplication and division + void fmpz_poly_scalar_mul_fmpz( + fmpz_poly_t, const fmpz_poly_t, const fmpz_t) +- void fmpz_poly_scalar_mul_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t) + void fmpz_poly_scalar_mul_si(fmpz_poly_t, const fmpz_poly_t, slong) + void fmpz_poly_scalar_mul_ui(fmpz_poly_t, const fmpz_poly_t, ulong) + void fmpz_poly_scalar_mul_2exp(fmpz_poly_t, const fmpz_poly_t, ulong) +@@ -310,12 +308,14 @@ cdef extern from "flint_wrap.h": + fmpz_poly_t, + const fmpz_poly_t, const fmpz_t, const nmod_poly_t, int) + +- # Some functions for backwards compatibility +- void fmpz_poly_scalar_mul_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t) +- void fmpz_poly_scalar_divexact_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t) +- void fmpz_poly_scalar_fdiv_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t) +- void fmpz_poly_set_coeff_mpz(fmpz_poly_t, slong, const mpz_t) +- void fmpz_poly_get_coeff_mpz(mpz_t, const fmpz_poly_t, slong) ++ ++# functions removed from flint but still needed in sage ++cdef void fmpz_poly_scalar_mul_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t) ++cdef void fmpz_poly_scalar_divexact_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t) ++cdef void fmpz_poly_scalar_fdiv_mpz(fmpz_poly_t, const fmpz_poly_t, const mpz_t) ++cdef void fmpz_poly_set_coeff_mpz(fmpz_poly_t, slong, const mpz_t) ++cdef void fmpz_poly_get_coeff_mpz(mpz_t, const fmpz_poly_t, slong) ++cdef void fmpz_poly_set_mpz(fmpz_poly_t, const mpz_t) + + + # Wrapper Cython class +diff --git a/src/sage/libs/flint/fmpz_poly.pyx b/src/sage/libs/flint/fmpz_poly.pyx +index 74915b37612..cfcbea9090c 100644 +--- a/src/sage/libs/flint/fmpz_poly.pyx ++++ b/src/sage/libs/flint/fmpz_poly.pyx +@@ -25,10 +25,10 @@ from cysignals.memory cimport sig_free + + from sage.arith.long cimport pyobject_to_long + from sage.cpython.string cimport char_to_str, str_to_bytes ++from sage.libs.flint.fmpz cimport * + from sage.structure.sage_object cimport SageObject + from sage.rings.integer cimport Integer + +- + cdef class Fmpz_poly(SageObject): + + def __cinit__(self): +@@ -455,3 +455,44 @@ cdef class Fmpz_poly(SageObject): + """ + from sage.rings.integer_ring import ZZ + return ZZ[var](self.list()) ++ ++ ++# Functions removed from flint but still needed in Sage. Code adapted from ++# earlier versions of flint. ++ ++cdef void fmpz_poly_scalar_mul_mpz(fmpz_poly_t rop, const fmpz_poly_t op, const mpz_t c): ++ cdef fmpz_t f ++ fmpz_init_set_readonly(f, c) ++ fmpz_poly_scalar_mul_fmpz(rop, op, f) ++ fmpz_clear_readonly(f) ++ ++cdef void fmpz_poly_scalar_divexact_mpz(fmpz_poly_t rop, const fmpz_poly_t op, const mpz_t c): ++ cdef fmpz_t f ++ fmpz_init_set_readonly(f, c) ++ fmpz_poly_scalar_divexact_fmpz(rop, op, f) ++ fmpz_clear_readonly(f) ++ ++cdef void fmpz_poly_scalar_fdiv_mpz(fmpz_poly_t rop, const fmpz_poly_t op, const mpz_t c): ++ cdef fmpz_t f ++ fmpz_init_set_readonly(f, c) ++ fmpz_poly_scalar_fdiv_fmpz(rop, op, f) ++ fmpz_clear_readonly(f) ++ ++cdef void fmpz_poly_set_coeff_mpz(fmpz_poly_t poly, slong n, const mpz_t x): ++ cdef fmpz_t t ++ fmpz_init_set_readonly(t, x) ++ fmpz_poly_set_coeff_fmpz(poly, n, t) ++ fmpz_clear_readonly(t) ++ ++cdef void fmpz_poly_get_coeff_mpz(mpz_t x, const fmpz_poly_t poly, slong n): ++ cdef fmpz_t t ++ fmpz_init(t) ++ fmpz_poly_get_coeff_fmpz(t, poly, n) ++ fmpz_get_mpz(x, t) ++ fmpz_clear(t) ++ ++cdef void fmpz_poly_set_mpz(fmpz_poly_t poly, const mpz_t x): ++ fmpz_poly_fit_length(poly, 1) ++ fmpz_set_mpz(poly.coeffs, x) ++ _fmpz_poly_set_length(poly, 1) ++ _fmpz_poly_normalise(poly) +diff --git a/src/sage/libs/flint/fmpz_poly_q.pxd b/src/sage/libs/flint/fmpz_poly_q.pxd +index 846542dc0d8..63c13355bf6 100644 +--- a/src/sage/libs/flint/fmpz_poly_q.pxd ++++ b/src/sage/libs/flint/fmpz_poly_q.pxd +@@ -49,11 +49,7 @@ cdef extern from "flint_wrap.h": + + #* Scalar multiplication and division ****************************************/ + void fmpz_poly_q_scalar_mul_si(fmpz_poly_q_t rop, const fmpz_poly_q_t op, long x) +- void fmpz_poly_q_scalar_mul_mpz(fmpz_poly_q_t rop, const fmpz_poly_q_t op, const mpz_t x) +- void fmpz_poly_q_scalar_mul_mpq(fmpz_poly_q_t rop, const fmpz_poly_q_t op, const mpq_t x) + void fmpz_poly_q_scalar_div_si(fmpz_poly_q_t rop, const fmpz_poly_q_t op, long x) +- void fmpz_poly_q_scalar_div_mpz(fmpz_poly_q_t rop, const fmpz_poly_q_t op, const mpz_t x) +- void fmpz_poly_q_scalar_div_mpq(fmpz_poly_q_t rop, const fmpz_poly_q_t op, const mpq_t x) + + #* Multiplication and division ***********************************************/ + void fmpz_poly_q_mul(fmpz_poly_q_t rop, +@@ -67,9 +63,6 @@ cdef extern from "flint_wrap.h": + #* Derivative ****************************************************************/ + void fmpz_poly_q_derivative(fmpz_poly_q_t rop, const fmpz_poly_q_t op) + +- #* Evaluation ****************************************************************/ +- int fmpz_poly_q_evaluate(mpq_t rop, const fmpz_poly_q_t f, const mpq_t a) +- + #* Input and output **********************************************************/ + int fmpz_poly_q_set_str(fmpz_poly_q_t rop, const char *s) + char * fmpz_poly_q_get_str(const fmpz_poly_q_t op) +diff --git a/src/sage/libs/linbox/linbox_flint_interface.pyx b/src/sage/libs/linbox/linbox_flint_interface.pyx +index 1979ac0f0a4..37a340c457f 100644 +--- a/src/sage/libs/linbox/linbox_flint_interface.pyx ++++ b/src/sage/libs/linbox/linbox_flint_interface.pyx +@@ -33,6 +33,7 @@ and C. Pernet. The functions available are: + # https://www.gnu.org/licenses/ + # **************************************************************************** + ++from sage.libs.gmp.types cimport mpz_t + from sage.libs.flint.types cimport fmpz_t + from sage.libs.flint.fmpz cimport fmpz_get_mpz, fmpz_set_mpz + from sage.libs.flint.fmpz_mat cimport fmpz_mat_entry, fmpz_mat_nrows, fmpz_mat_ncols +@@ -80,11 +81,13 @@ cdef void fmpz_poly_set_linbox(fmpz_poly_t p, PolynomialRing_integer.Element& q) + (the .pxd file) in order to keep the header C-compatible + """ + cdef size_t i ++ cdef mpz_t tmp + + fmpz_poly_fit_length(p, q.size()) + + for i in range(q.size()): +- fmpz_poly_set_coeff_mpz(p, i, q[i].get_mpz_const()) ++ tmp = q[i].get_mpz_const() ++ fmpz_poly_set_coeff_mpz(p, i, tmp) + + _fmpz_poly_set_length(p, q.size()) + +diff --git a/src/sage/matrix/matrix_complex_ball_dense.pyx b/src/sage/matrix/matrix_complex_ball_dense.pyx +index e5414abdd9e..2f0131f4064 100644 +--- a/src/sage/matrix/matrix_complex_ball_dense.pyx ++++ b/src/sage/matrix/matrix_complex_ball_dense.pyx +@@ -1,4 +1,4 @@ +-# distutils: libraries = ARB_LIBRARY ++# distutils: libraries = flint + r""" + Arbitrary precision complex ball matrices using Arb + +diff --git a/src/sage/matrix/matrix_integer_sparse.pyx b/src/sage/matrix/matrix_integer_sparse.pyx +index 27f5cdfac0f..6c5c20dbc6b 100644 +--- a/src/sage/matrix/matrix_integer_sparse.pyx ++++ b/src/sage/matrix/matrix_integer_sparse.pyx +@@ -847,6 +847,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): + sage: matrix(ZZ, 1, 1, sparse=True)._charpoly_linbox() + x + """ ++ cdef mpz_t tmp + if self._nrows != self._ncols: + raise ArithmeticError('only valid for square matrix') + +@@ -869,7 +870,8 @@ cdef class Matrix_integer_sparse(Matrix_sparse): + cdef size_t i + fmpz_poly_fit_length(g._poly, p.size()) + for i in range(p.size()): +- fmpz_poly_set_coeff_mpz(g._poly, i, p[0][i].get_mpz_const()) ++ tmp = p[0][i].get_mpz_const() ++ fmpz_poly_set_coeff_mpz(g._poly, i, tmp) + _fmpz_poly_set_length(g._poly, p.size()) + + del M +@@ -966,9 +968,11 @@ cdef class Matrix_integer_sparse(Matrix_sparse): + sig_off() + + cdef size_t i ++ cdef mpz_t tmp + fmpz_poly_fit_length(g._poly, p.size()) + for i in range(p.size()): +- fmpz_poly_set_coeff_mpz(g._poly, i, p[0][i].get_mpz_const()) ++ tmp = p[0][i].get_mpz_const() ++ fmpz_poly_set_coeff_mpz(g._poly, i, tmp) + _fmpz_poly_set_length(g._poly, p.size()) + + del M +diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx +index 1e3085c9215..0786de7fc81 100644 +--- a/src/sage/rings/complex_arb.pyx ++++ b/src/sage/rings/complex_arb.pyx +@@ -1360,12 +1360,13 @@ cdef class ComplexBall(RingElement): + sage: CBF100(-3r) + -3.000000000000000000000000000000 + +- sage: ComplexBall(CBF100, 10^100) +- 1.000000000000000000000000000000e+100 + sage: ComplexBall(CBF100, CIF(1, 2)) + 1.000000000000000000000000000000 + 2.000000000000000000000000000000*I + sage: ComplexBall(CBF100, RBF(1/3), RBF(1)) + [0.3333333333333333 +/- ...e-17] + 1.000000000000000000000000000000*I ++ sage: ComplexBall(CBF100, 10^100) ++ [1.000000000000000000000000000000e+100 +/- ...] ++ + sage: NF. = QuadraticField(-1, embedding=CC(0, -1)) + sage: CBF(a) + -1.000000000000000*I +@@ -3009,7 +3010,7 @@ cdef class ComplexBall(RingElement): + sage: CBF(1).rising_factorial(2**64) + [+/- ...e+347382171326740403407] + sage: ComplexBallField(128)(1).rising_factorial(2**64) +- [2.343691126796861348e+347382171305201285713 +/- ...e+347382171305201285694] ++ [2.34369112679686134...e+347382171305201285713 +/- ...] + sage: CBF(1/2).rising_factorial(CBF(2,3)) # abs tol 1e-15 + [-0.123060451458124 +/- 3.06e-16] + [0.0406412631676552 +/- 7.57e-17]*I + +diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx +index 04eaefc9fed..d99f0d3b98c 100644 +--- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx ++++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx +@@ -222,7 +222,7 @@ cdef class Polynomial_rational_flint(Polynomial): + cdef unsigned long n + cdef Rational c + cdef list L1 +- cdef mpq_t * L2 ++ cdef fmpq_t q + + Polynomial.__init__(self, parent, is_gen=is_gen) + +@@ -253,14 +253,11 @@ cdef class Polynomial_rational_flint(Polynomial): + L1 = [e if isinstance(e, Rational) else Rational(e) for e in x] + n = len(x) + sig_on() +- L2 = check_allocarray(n, sizeof(mpq_t)) ++ fmpq_poly_fit_length(self._poly, n) + for deg from 0 <= deg < n: +- mpq_init(L2[deg]) +- mpq_set(L2[deg], ( L1[deg]).value) +- fmpq_poly_set_array_mpq(self._poly, L2, n) +- for deg from 0 <= deg < n: +- mpq_clear(L2[deg]) +- sig_free(L2) ++ fmpq_init_set_readonly(q, ( L1[deg]).value) ++ fmpq_poly_set_coeff_fmpq(self._poly, deg, q) ++ fmpq_clear_readonly(q) + sig_off() + + # deg = 0 +@@ -435,6 +432,7 @@ cdef class Polynomial_rational_flint(Polynomial): + utmost care. + """ + cdef bint do_sig = _do_sig(self._poly) ++ cdef fmpz_t tmpfz + + if isinstance(value, int): + if do_sig: sig_str("FLINT exception") +@@ -442,7 +440,9 @@ cdef class Polynomial_rational_flint(Polynomial): + if do_sig: sig_off() + elif isinstance(value, Integer): + if do_sig: sig_str("FLINT exception") +- fmpq_poly_set_coeff_mpz(self._poly, n, ( value).value) ++ fmpz_init_set_readonly(tmpfz, ( value).value) ++ fmpq_poly_set_coeff_fmpz(self._poly, n, tmpfz) ++ fmpz_clear_readonly(tmpfz) + if do_sig: sig_off() + elif isinstance(value, Rational): + if do_sig: sig_str("FLINT exception") +@@ -492,7 +492,7 @@ cdef class Polynomial_rational_flint(Polynomial): + cdef Polynomial_rational_flint f + cdef Rational r + cdef fmpz_t tmpfz +- cdef fmpq_t tmpfq ++ cdef fmpq_t tmpfq, tmpfq1 + cdef RealBall arb_a, arb_z + cdef ComplexBall acb_a, acb_z + +@@ -508,13 +508,23 @@ cdef class Polynomial_rational_flint(Polynomial): + elif isinstance(a, Rational): + r = Rational.__new__(Rational) + sig_str("FLINT exception") +- fmpq_poly_evaluate_mpq(r.value, self._poly, ( a).value) ++ fmpq_init_set_readonly(tmpfq, ( a).value) ++ fmpq_init(tmpfq1) ++ fmpq_poly_evaluate_fmpq(tmpfq1, self._poly, tmpfq) ++ fmpq_get_mpq(r.value, tmpfq1) ++ fmpq_clear(tmpfq1) ++ fmpq_clear_readonly(tmpfq) + sig_off() + return r + elif isinstance(a, Integer): + r = Rational.__new__(Rational) + sig_str("FLINT exception") +- fmpq_poly_evaluate_mpz(r.value, self._poly, ( a).value) ++ fmpz_init_set_readonly(tmpfz, ( a).value) ++ fmpq_init(tmpfq) ++ fmpq_poly_evaluate_fmpz(tmpfq, self._poly, tmpfz) ++ fmpq_get_mpq(r.value, tmpfq) ++ fmpq_clear(tmpfq) ++ fmpz_clear_readonly(tmpfz) + sig_off() + return r + elif isinstance(a, int): +@@ -1321,6 +1331,7 @@ cdef class Polynomial_rational_flint(Polynomial): + """ + cdef Polynomial_rational_flint res + cdef bint do_sig ++ cdef fmpq_t tmpfq + + if right == 0: + raise ZeroDivisionError("division by zero polynomial") +@@ -1331,8 +1342,9 @@ cdef class Polynomial_rational_flint(Polynomial): + do_sig = _do_sig(self._poly) + + if do_sig: sig_str("FLINT exception") +- fmpq_poly_scalar_div_mpq(res._poly, self._poly, +- ( QQ(right)).value) ++ fmpq_init_set_readonly(tmpfq, ( QQ(right)).value) ++ fmpq_poly_scalar_div_fmpq(res._poly, self._poly, tmpfq) ++ fmpq_clear_readonly(tmpfq) + if do_sig: sig_off() + return res + +diff --git a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx +index 6e7f7498329..3a66198d568 100644 +--- a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx ++++ b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx +@@ -658,6 +658,11 @@ cdef class Polynomial_zmod_flint(Polynomial_template): + ... + NotImplementedError: square free factorization of polynomials over rings with composite characteristic is not implemented + ++ :trac:`20003`:: ++ ++ sage: P. = GF(7)[] ++ sage: (6*x+3).squarefree_decomposition() ++ (6) * (x + 4) + """ + if not self.base_ring().is_field(): + raise NotImplementedError("square free factorization of polynomials over rings with composite characteristic is not implemented") +diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx +index 17961ac36b2..8509b19cc66 100644 +--- a/src/sage/rings/real_arb.pyx ++++ b/src/sage/rings/real_arb.pyx +@@ -898,7 +898,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): + sage: RBF.gamma(5) + 24.00000000000000 + sage: RBF.gamma(10**20) +- [+/- ...e+1956570552410610660600] ++ [1.932849514310098...+1956570551809674817225 +/- ...] + sage: RBF.gamma(1/3) + [2.678938534707747 +/- ...e-16] + sage: RBF.gamma(-5) +@@ -1102,7 +1102,7 @@ class RealBallField(UniqueRepresentation, sage.rings.abc.RealBallField): + 15.00000000000000, + 48.00000000000000] + sage: RBF.double_factorial(2**20) +- [1.4483729903e+2928836 +/- ...e+2928825] ++ [1.448372990...e+2928836 +/- ...] + sage: RBF.double_factorial(2**1000) + Traceback (most recent call last): + ... +diff --git a/src/sage/schemes/plane_conics/con_rational_function_field.py b/src/sage/schemes/plane_conics/con_rational_function_field.py +index 05d24e78a85..581102b5c5b 100644 +--- a/src/sage/schemes/plane_conics/con_rational_function_field.py ++++ b/src/sage/schemes/plane_conics/con_rational_function_field.py +@@ -198,38 +198,6 @@ def has_rational_point(self, point=False, algorithm='default', + Fraction Field of Univariate Polynomial Ring in u over Rational + Field with modulus v^2 - u^3 - 1 + +- ``has_rational_point`` fails for some conics over function fields +- over finite fields, due to :trac:`20003`:: +- +- sage: K. = PolynomialRing(GF(7)) +- sage: C = Conic([5*t^2 + 4, t^2 + 3*t + 3, 6*t^2 + 3*t + 2, +- ....: 5*t^2 + 5, 4*t + 3, 4*t^2 + t + 5]) +- sage: C.has_rational_point() # needs sage.libs.singular +- Traceback (most recent call last): +- ... +- TypeError: self (=Scheme morphism: +- From: Projective Conic Curve over Fraction Field of Univariate +- Polynomial Ring in t over Finite Field of size 7 defined by +- (-2*t^2 - 3)*x^2 + (-t^3 + 3*t^2 - 2*t - 2)/(t + 3)*y^2 + (-t^6 + 3*t^5 + t^3 - t^2 - t + 2)/(t^4 + t^3 - 3*t^2 + 3*t + 1)*z^2 +- To: Projective Conic Curve over Fraction Field of Univariate +- Polynomial Ring in t over Finite Field of size 7 defined by +- (-2*t^2 - 3)*x^2 + (t^2 + 3*t + 3)*x*y + (-2*t^2 - 2)*y^2 + (-t^2 + 3*t + 2)*x*z + (-3*t + 3)*y*z + (-3*t^2 + t - 2)*z^2 +- Defn: Defined on coordinates by sending (x : y : z) to +- (x + (2*t - 2)/(t + 3)*y + (3*t^4 + 2*t^3 - 2*t^2 - 2*t + 3)/(t^4 + t^3 - 3*t^2 + 3*t + 1)*z +- : y + (-t^3 - t^2 + 3*t - 1)/(t^3 - 3*t^2 + 2*t + 2)*z : z)) +- domain must equal right (=Scheme morphism: +- From: Projective Conic Curve over Fraction Field of Univariate +- Polynomial Ring in t over Finite Field of size 7 defined by +- (-2*t^3 - t^2 + 3*t + 3)*x^2 + (t - 3)*y^2 + (-t^7 + 2*t^5 + t^4 + 2*t^3 + 3*t^2 - t - 1)*z^2 +- To: Projective Conic Curve over Fraction Field of Univariate +- Polynomial Ring in t over Finite Field of size 7 defined by +- -2/(t^3 - 3*t^2 + 2*t + 2)*x^2 + 1/(t^3 + 3*t^2 - 2*t + 1)*y^2 + (-t^6 + 3*t^5 + t^3 - t^2 - t + 2)/(t^9 - 2*t^8 + t^7 - t^6 + 3*t^5 - 3*t^3 + t^2 - 2*t + 3)*z^2 +- Defn: Defined on coordinates by sending (x : y : z) to +- ((t^3 - 3*t^2 + 2*t + 2)*x : (t^2 - 2)*y : (t^5 - 3*t^4 + t^2 + 3*t + 3)*z)) +- codomain +- +- +- + TESTS:: + + sage: K. = FractionField(PolynomialRing(QQ, 't')) +@@ -250,6 +218,16 @@ def has_rational_point(self, point=False, algorithm='default', + sage: C.has_rational_point(point=True) # long time (4 seconds) # needs sage.libs.singular + (True, + ((-2/117*t^8 + 304/1053*t^7 + 40/117*t^6 - 1/27*t^5 - 110/351*t^4 - 2/195*t^3 + 11/351*t^2 + 1/117)/(t^4 + 2/39*t^3 + 4/117*t^2 + 2/39*t + 14/39) : -5/3*t^4 + 19*t^3 : 1)) ++ ++ ``has_rational_point`` used to fail for some conics over function fields ++ over finite fields, due to :trac:`20003`:: ++ ++ sage: K. = PolynomialRing(GF(7)) ++ sage: C = Conic([5*t^2 + 4, t^2 + 3*t + 3, 6*t^2 + 3*t + 2, ++ ....: 5*t^2 + 5, 4*t + 3, 4*t^2 + t + 5]) ++ sage: C.has_rational_point() ++ True ++ + """ + from .constructor import Conic + +diff --git a/src/sage/symbolic/ginac/inifcns_orthopoly.cpp b/src/sage/symbolic/ginac/inifcns_orthopoly.cpp +index a591cb4cd7c..a90f2050c59 100644 +--- a/src/sage/symbolic/ginac/inifcns_orthopoly.cpp ++++ b/src/sage/symbolic/ginac/inifcns_orthopoly.cpp +@@ -20,6 +20,7 @@ + #include "utils.h" + + #include "gmp.h" ++#include "flint/fmpz_poly.h" + #include "flint/fmpq_poly.h" + #include "flint/fmpq.h" + +@@ -63,7 +64,7 @@ static ex chebyt_eval(const ex& n_, const ex& x) + for (int i = 0; i= 4.2.1], [ -- 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) -- ], [ -- AC_MSG_RESULT(no) -- sage_spkg_install_singular=yes -- ] -- )], [ -+ AC_MSG_CHECKING([whether Singular is built with FLINT]) -+ AC_COMPILE_IFELSE([ -+ AC_LANG_PROGRAM([ -+ #include -+ #if !defined(HAVE_FLINT) -+ # error "Need Singular compiled with FLINT" -+ ], []) -+ ], [ -+ AC_MSG_RESULT([yes]) -+ 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) -+ ], [ -+ AC_MSG_RESULT(no) -+ sage_spkg_install_singular=yes -+ ]) -+ ], [ -+ AC_MSG_RESULT([no]) -+ sage_spkg_install_singular=yes -+ ]) -+ ], [ - dnl pkg-config version check failed - sage_spkg_install_singular=yes - ]) -diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py -index b15cc1c602c..4b5c76e2bfa 100644 ---- a/src/sage/interfaces/singular.py -+++ b/src/sage/interfaces/singular.py -@@ -604,8 +604,7 @@ def eval(self, x, allow_semicolon=True, strip=True, **kwds): - sage: i = singular.ideal(['x^2','y^2','z^2']) - sage: s = i.std() - sage: singular.eval('hilb(%s)'%(s.name())) -- '// 1 t^0\n// -3 t^2\n// 3 t^4\n// -1 t^6\n\n// 1 t^0\n// -- 3 t^1\n// 3 t^2\n// 1 t^3\n// dimension (affine) = 0\n// -+ '...// dimension (affine) = 0\n// - degree (affine) = 8' - - :: -@@ -613,15 +612,7 @@ def eval(self, x, allow_semicolon=True, strip=True, **kwds): - sage: from sage.misc.verbose import set_verbose - sage: set_verbose(1) - sage: o = singular.eval('hilb(%s)'%(s.name())) -- // 1 t^0 -- // -3 t^2 -- // 3 t^4 -- // -1 t^6 -- // 1 t^0 -- // 3 t^1 -- // 3 t^2 -- // 1 t^3 -- // dimension (affine) = 0 -+ ...// dimension (affine) = 0 - // degree (affine) = 8 - - This is mainly useful if this method is called implicitly. Because -@@ -631,15 +622,7 @@ def eval(self, x, allow_semicolon=True, strip=True, **kwds): - :: - - sage: o = s.hilb() -- // 1 t^0 -- // -3 t^2 -- // 3 t^4 -- // -1 t^6 -- // 1 t^0 -- // 3 t^1 -- // 3 t^2 -- // 1 t^3 -- // dimension (affine) = 0 -+ ...// dimension (affine) = 0 - // degree (affine) = 8 - // ** right side is not a datum, assignment ignored - ... -diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx -index f40346d1fd0..c597c63aafe 100644 ---- a/src/sage/libs/singular/function.pyx -+++ b/src/sage/libs/singular/function.pyx -@@ -1241,32 +1241,22 @@ cdef class SingularFunction(SageObject): - sage: I = Ideal([x^3*y^2 + 3*x^2*y^2*z + y^3*z^2 + z^5]) - sage: I = Ideal(I.groebner_basis()) - sage: hilb = sage.libs.singular.function_factory.ff.hilb -- sage: hilb(I) # Singular will print // ** _ is no standard basis -- // ** _ is no standard basis -- // 1 t^0 -- // -1 t^5 -- -- // 1 t^0 -- // 1 t^1 -- // 1 t^2 -- // 1 t^3 -- // 1 t^4 -- // dimension (proj.) = 1 -- // degree (proj.) = 5 -+ sage: from sage.misc.sage_ostools import redirection -+ sage: out = tmp_filename() -+ sage: with redirection(sys.stdout, open(out, 'w')): -+ ....: hilb(I) # Singular will print // ** _ is no standard basis -+ sage: with open(out) as f: -+ ....: 'is no standard basis' in f.read() -+ True - - So we tell Singular that ``I`` is indeed a Groebner basis:: - -- sage: hilb(I,attributes={I:{'isSB':1}}) # no complaint from Singular -- // 1 t^0 -- // -1 t^5 -- -- // 1 t^0 -- // 1 t^1 -- // 1 t^2 -- // 1 t^3 -- // 1 t^4 -- // dimension (proj.) = 1 -- // degree (proj.) = 5 -+ sage: out = tmp_filename() -+ sage: with redirection(sys.stdout, open(out, 'w')): -+ ....: hilb(I,attributes={I:{'isSB':1}}) # no complaint from Singular -+ sage: with open(out) as f: -+ ....: 'is no standard basis' in f.read() -+ False - - - TESTS: -diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py -index 22ada6de947..80352700872 100644 ---- a/src/sage/rings/polynomial/multi_polynomial_ideal.py -+++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py -@@ -3132,13 +3132,16 @@ def hilbert_numerator(self, grading=None, algorithm='sage'): - sage: I.hilbert_numerator() # needs sage.rings.number_field - -t^5 + 1 - -- This example returns a wrong answer due to an integer overflow in Singular:: -+ This example returns a wrong answer in singular < 4.3.2p4 due to an integer overflow:: - - sage: n=4; m=11; P = PolynomialRing(QQ, n*m, "x"); x = P.gens(); M = Matrix(n, x) - sage: I = P.ideal(M.minors(2)) - sage: J = P * [m.lm() for m in I.groebner_basis()] -- sage: J.hilbert_numerator(algorithm='singular') -- ...120*t^33 - 3465*t^32 + 48180*t^31 - ... -+ sage: J.hilbert_numerator(algorithm='singular') # known bug -+ Traceback (most recent call last): -+ .... -+ RuntimeError: error in Singular function call 'hilb': -+ overflow at t^22 - - Our two algorithms should always agree; not tested until - :trac:`33178` is fixed:: -diff --git a/src/sage/sandpiles/sandpile.py b/src/sage/sandpiles/sandpile.py -index 02d2021b2fb..c8e15e06f05 100644 ---- a/src/sage/sandpiles/sandpile.py -+++ b/src/sage/sandpiles/sandpile.py -@@ -2493,9 +2493,15 @@ def _set_ideal(self): - sage: '_ideal' in S.__dict__ - True - """ -+ from sage.libs.singular.function_factory import ff -+ try: -+ sat = ff.elim__lib.sat_with_exp -+ except NameError: -+ sat = ff.elim__lib.sat - R = self.ring() -- I = self._unsaturated_ideal._singular_() -- self._ideal = R.ideal(I.sat(prod(R.gens())._singular_())[1]) -+ I = self._unsaturated_ideal -+ I_sat_gens = sat(I, prod(R.gens()))[0] -+ self._ideal = R.ideal(I_sat_gens) - - def unsaturated_ideal(self): - r""" -diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py -index e6caf19ba74..afd6484d779 100644 ---- a/src/sage/schemes/projective/projective_subscheme.py -+++ b/src/sage/schemes/projective/projective_subscheme.py -@@ -1001,7 +1001,10 @@ def dual(self): - for i in range(n + 1): - J = J + S.ideal(z[-1] * f_S.derivative(z[i]) - z[i + n + 1]) - -- sat = ff.elim__lib.sat -+ try: -+ sat = ff.elim__lib.sat_with_exp -+ except NameError: -+ sat = ff.elim__lib.sat - - max_ideal = S.ideal(z[n + 1: 2 * n + 2]) - J_sat_gens = sat(J, max_ideal)[0] diff --git a/srcpkgs/sagemath/patches/36006-gmp_6.3.0.patch b/srcpkgs/sagemath/patches/36006-gmp_6.3.0.patch deleted file mode 100644 index 6a35ec3836550..0000000000000 --- a/srcpkgs/sagemath/patches/36006-gmp_6.3.0.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/src/sage/ext/memory.pyx b/src/sage/ext/memory.pyx -index 1de6dedab82..b95130b19dd 100644 ---- a/src/sage/ext/memory.pyx -+++ b/src/sage/ext/memory.pyx -@@ -3,14 +3,14 @@ Low-level memory allocation functions - - TESTS: - --Check that a ``MemoryError`` is raised if we try to allocate a -+Check that an error is raised if we try to allocate a - ridiculously large integer, see :trac:`15363`:: - -- sage: 2^(2^63-3) -- Traceback (most recent call last): -- ... -- OverflowError: exponent must be at most 2147483647 # 32-bit -- RuntimeError: Aborted # 64-bit -+ sage: try: -+ ....: 2^(2^63-3) -+ ....: except (OverflowError, RuntimeError, FloatingPointError): -+ ....: print ('Overflow error') -+ ...Overflow error - - AUTHORS: - -diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx -index d5e87626d31..37ed9364845 100644 ---- a/src/sage/rings/integer.pyx -+++ b/src/sage/rings/integer.pyx -@@ -6654,7 +6654,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): - sage: try: - ....: print('Possible error output from gmp', flush=True) - ....: 1 << (2^60) -- ....: except (MemoryError, OverflowError, RuntimeError): -+ ....: except (MemoryError, OverflowError, RuntimeError, FloatingPointError): - ....: pass - ....: else: - ....: print("Failed to raise exception") diff --git a/srcpkgs/sagemath/patches/36046-fix_memory_leak.patch b/srcpkgs/sagemath/patches/36046-fix_memory_leak.patch deleted file mode 100644 index 3d2a4bd9cd96f..0000000000000 --- a/srcpkgs/sagemath/patches/36046-fix_memory_leak.patch +++ /dev/null @@ -1,740 +0,0 @@ -diff --git a/src/sage/ext_data/valgrind/valgrind-python.supp b/src/sage/ext_data/valgrind/valgrind-python.supp -new file mode 100644 -index 00000000000..16aa2858484 ---- /dev/null -+++ b/src/sage/ext_data/valgrind/valgrind-python.supp -@@ -0,0 +1,480 @@ -+# From the CPython repository with the suppressions for _PyObject_Free -+# and _PyObject_Realloc enabled. See the upstream suppression file for -+# details: -+# -+# https://github.com/python/cpython/blob/main/Misc/valgrind-python.supp -+ -+# all tool names: Addrcheck,Memcheck,cachegrind,helgrind,massif -+{ -+ ADDRESS_IN_RANGE/Invalid read of size 4 -+ Memcheck:Addr4 -+ fun:address_in_range -+} -+ -+{ -+ ADDRESS_IN_RANGE/Invalid read of size 4 -+ Memcheck:Value4 -+ fun:address_in_range -+} -+ -+{ -+ ADDRESS_IN_RANGE/Invalid read of size 8 (x86_64 aka amd64) -+ Memcheck:Value8 -+ fun:address_in_range -+} -+ -+{ -+ ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value -+ Memcheck:Cond -+ fun:address_in_range -+} -+ -+# -+# Leaks (including possible leaks) -+# Hmmm, I wonder if this masks some real leaks. I think it does. -+# Will need to fix that. -+# -+ -+{ -+ Suppress leaking the GIL after a fork. -+ Memcheck:Leak -+ fun:malloc -+ fun:PyThread_allocate_lock -+ fun:PyEval_ReInitThreads -+} -+ -+{ -+ Suppress leaking the autoTLSkey. This looks like it shouldn't leak though. -+ Memcheck:Leak -+ fun:malloc -+ fun:PyThread_create_key -+ fun:_PyGILState_Init -+ fun:Py_InitializeEx -+ fun:Py_Main -+} -+ -+{ -+ Hmmm, is this a real leak or like the GIL? -+ Memcheck:Leak -+ fun:malloc -+ fun:PyThread_ReInitTLS -+} -+ -+{ -+ Handle PyMalloc confusing valgrind (possibly leaked) -+ Memcheck:Leak -+ fun:realloc -+ fun:_PyObject_GC_Resize -+ fun:COMMENT_THIS_LINE_TO_DISABLE_LEAK_WARNING -+} -+ -+{ -+ Handle PyMalloc confusing valgrind (possibly leaked) -+ Memcheck:Leak -+ fun:malloc -+ fun:_PyObject_GC_New -+ fun:COMMENT_THIS_LINE_TO_DISABLE_LEAK_WARNING -+} -+ -+{ -+ Handle PyMalloc confusing valgrind (possibly leaked) -+ Memcheck:Leak -+ fun:malloc -+ fun:_PyObject_GC_NewVar -+ fun:COMMENT_THIS_LINE_TO_DISABLE_LEAK_WARNING -+} -+ -+# -+# Non-python specific leaks -+# -+ -+{ -+ Handle pthread issue (possibly leaked) -+ Memcheck:Leak -+ fun:calloc -+ fun:allocate_dtv -+ fun:_dl_allocate_tls_storage -+ fun:_dl_allocate_tls -+} -+ -+{ -+ Handle pthread issue (possibly leaked) -+ Memcheck:Leak -+ fun:memalign -+ fun:_dl_allocate_tls_storage -+ fun:_dl_allocate_tls -+} -+ -+{ -+ ADDRESS_IN_RANGE/Invalid read of size 4 -+ Memcheck:Addr4 -+ fun:_PyObject_Free -+} -+ -+{ -+ ADDRESS_IN_RANGE/Invalid read of size 4 -+ Memcheck:Value4 -+ fun:_PyObject_Free -+} -+ -+{ -+ ADDRESS_IN_RANGE/Use of uninitialised value of size 8 -+ Memcheck:Addr8 -+ fun:_PyObject_Free -+} -+ -+{ -+ ADDRESS_IN_RANGE/Use of uninitialised value of size 8 -+ Memcheck:Value8 -+ fun:_PyObject_Free -+} -+ -+{ -+ ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value -+ Memcheck:Cond -+ fun:_PyObject_Free -+} -+ -+{ -+ ADDRESS_IN_RANGE/Invalid read of size 4 -+ Memcheck:Addr4 -+ fun:_PyObject_Realloc -+} -+ -+{ -+ ADDRESS_IN_RANGE/Invalid read of size 4 -+ Memcheck:Value4 -+ fun:_PyObject_Realloc -+} -+ -+{ -+ ADDRESS_IN_RANGE/Use of uninitialised value of size 8 -+ Memcheck:Addr8 -+ fun:_PyObject_Realloc -+} -+ -+{ -+ ADDRESS_IN_RANGE/Use of uninitialised value of size 8 -+ Memcheck:Value8 -+ fun:_PyObject_Realloc -+} -+ -+{ -+ ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value -+ Memcheck:Cond -+ fun:_PyObject_Realloc -+} -+ -+### -+### All the suppressions below are for errors that occur within libraries -+### that Python uses. The problems to not appear to be related to Python's -+### use of the libraries. -+### -+ -+{ -+ Generic ubuntu ld problems -+ Memcheck:Addr8 -+ obj:/lib/ld-2.4.so -+ obj:/lib/ld-2.4.so -+ obj:/lib/ld-2.4.so -+ obj:/lib/ld-2.4.so -+} -+ -+{ -+ Generic gentoo ld problems -+ Memcheck:Cond -+ obj:/lib/ld-2.3.4.so -+ obj:/lib/ld-2.3.4.so -+ obj:/lib/ld-2.3.4.so -+ obj:/lib/ld-2.3.4.so -+} -+ -+{ -+ DBM problems, see test_dbm -+ Memcheck:Param -+ write(buf) -+ fun:write -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ fun:dbm_close -+} -+ -+{ -+ DBM problems, see test_dbm -+ Memcheck:Value8 -+ fun:memmove -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ fun:dbm_store -+ fun:dbm_ass_sub -+} -+ -+{ -+ DBM problems, see test_dbm -+ Memcheck:Cond -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ fun:dbm_store -+ fun:dbm_ass_sub -+} -+ -+{ -+ DBM problems, see test_dbm -+ Memcheck:Cond -+ fun:memmove -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ obj:/usr/lib/libdb1.so.2 -+ fun:dbm_store -+ fun:dbm_ass_sub -+} -+ -+{ -+ GDBM problems, see test_gdbm -+ Memcheck:Param -+ write(buf) -+ fun:write -+ fun:gdbm_open -+ -+} -+ -+{ -+ Uninitialised byte(s) false alarm, see bpo-35561 -+ Memcheck:Param -+ epoll_ctl(event) -+ fun:epoll_ctl -+ fun:pyepoll_internal_ctl -+} -+ -+{ -+ ZLIB problems, see test_gzip -+ Memcheck:Cond -+ obj:/lib/libz.so.1.2.3 -+ obj:/lib/libz.so.1.2.3 -+ fun:deflate -+} -+ -+{ -+ Avoid problems w/readline doing a putenv and leaking on exit -+ Memcheck:Leak -+ fun:malloc -+ fun:xmalloc -+ fun:sh_set_lines_and_columns -+ fun:_rl_get_screen_size -+ fun:_rl_init_terminal_io -+ obj:/lib/libreadline.so.4.3 -+ fun:rl_initialize -+} -+ -+# Valgrind emits "Conditional jump or move depends on uninitialised value(s)" -+# false alarms on GCC builtin strcmp() function. The GCC code is correct. -+# -+# Valgrind bug: https://bugs.kde.org/show_bug.cgi?id=264936 -+{ -+ bpo-38118: Valgrind emits false alarm on GCC builtin strcmp() -+ Memcheck:Cond -+ fun:PyUnicode_Decode -+} -+ -+ -+### -+### These occur from somewhere within the SSL, when running -+### test_socket_sll. They are too general to leave on by default. -+### -+###{ -+### somewhere in SSL stuff -+### Memcheck:Cond -+### fun:memset -+###} -+###{ -+### somewhere in SSL stuff -+### Memcheck:Value4 -+### fun:memset -+###} -+### -+###{ -+### somewhere in SSL stuff -+### Memcheck:Cond -+### fun:MD5_Update -+###} -+### -+###{ -+### somewhere in SSL stuff -+### Memcheck:Value4 -+### fun:MD5_Update -+###} -+ -+# Fedora's package "openssl-1.0.1-0.1.beta2.fc17.x86_64" on x86_64 -+# See http://bugs.python.org/issue14171 -+{ -+ openssl 1.0.1 prng 1 -+ Memcheck:Cond -+ fun:bcmp -+ fun:fips_get_entropy -+ fun:FIPS_drbg_instantiate -+ fun:RAND_init_fips -+ fun:OPENSSL_init_library -+ fun:SSL_library_init -+ fun:init_hashlib -+} -+ -+{ -+ openssl 1.0.1 prng 2 -+ Memcheck:Cond -+ fun:fips_get_entropy -+ fun:FIPS_drbg_instantiate -+ fun:RAND_init_fips -+ fun:OPENSSL_init_library -+ fun:SSL_library_init -+ fun:init_hashlib -+} -+ -+{ -+ openssl 1.0.1 prng 3 -+ Memcheck:Value8 -+ fun:_x86_64_AES_encrypt_compact -+ fun:AES_encrypt -+} -+ -+# -+# All of these problems come from using test_socket_ssl -+# -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ fun:BN_bin2bn -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ fun:BN_num_bits_word -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Value4 -+ fun:BN_num_bits_word -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ fun:BN_mod_exp_mont_word -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ fun:BN_mod_exp_mont -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Param -+ write(buf) -+ fun:write -+ obj:/usr/lib/libcrypto.so.0.9.7 -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ fun:RSA_verify -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Value4 -+ fun:RSA_verify -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Value4 -+ fun:DES_set_key_unchecked -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Value4 -+ fun:DES_encrypt2 -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ obj:/usr/lib/libssl.so.0.9.7 -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Value4 -+ obj:/usr/lib/libssl.so.0.9.7 -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ fun:BUF_MEM_grow_clean -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ fun:memcpy -+ fun:ssl3_read_bytes -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Cond -+ fun:SHA1_Update -+} -+ -+{ -+ from test_socket_ssl -+ Memcheck:Value4 -+ fun:SHA1_Update -+} -+ -+{ -+ test_buffer_non_debug -+ Memcheck:Addr4 -+ fun:PyUnicodeUCS2_FSConverter -+} -+ -+{ -+ test_buffer_non_debug -+ Memcheck:Addr4 -+ fun:PyUnicode_FSConverter -+} -+ -+{ -+ wcscmp_false_positive -+ Memcheck:Addr8 -+ fun:wcscmp -+ fun:_PyOS_GetOpt -+ fun:Py_Main -+ fun:main -+} -+ -+# Additional suppressions for the unified decimal tests: -+{ -+ test_decimal -+ Memcheck:Addr4 -+ fun:PyUnicodeUCS2_FSConverter -+} -+ -+{ -+ test_decimal2 -+ Memcheck:Addr4 -+ fun:PyUnicode_FSConverter -+} -+ -diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp -index b40ed64edb5..8c55861c147 100644 ---- a/src/sage/symbolic/ginac/numeric.cpp -+++ b/src/sage/symbolic/ginac/numeric.cpp -@@ -1576,6 +1576,62 @@ const numeric numeric::div(const numeric &other) const { - } - } - -+ -+// Compute `a^b` as an integer, where a is an integer. Assign to ``res``` if it is integral, or return ``false``. -+// The nonnegative real root is taken for even denominators. To be used inside numeric::integer_rational_power, -+// to handle the special case of integral ``a``. -+bool integer_rational_power_of_mpz( -+ numeric& res, -+ const numeric& a, -+ const numeric& b -+) { -+ if (a.t != MPZ) -+ throw std::runtime_error("integer_rational_power_of_mpz: bad input"); -+ mpz_t z; -+ mpz_init(z); -+ mpz_set_ui(z, 0); -+ int sgn = mpz_sgn(a.v._bigint); -+ if (mpz_cmp_ui(a.v._bigint, 1) == 0 -+ or mpz_cmp_ui(mpq_numref(b.v._bigrat), 0) == 0) -+ mpz_set_ui(z, 1); -+ else if (sgn == 0) { -+ res = *_num0_p; -+ mpz_clear(z); -+ return true; -+ } -+ else if (sgn < 0 and mpz_cmp_ui(mpq_denref(b.v._bigrat), 1)) { -+ mpz_clear(z); -+ return false; -+ } else { -+ if (not mpz_fits_ulong_p(mpq_numref(b.v._bigrat)) -+ or not mpz_fits_ulong_p(mpq_denref(b.v._bigrat))) { -+ // too big to take roots/powers -+ mpz_clear(z); -+ return false; -+ } -+ if (mpz_cmp_ui(mpq_denref(b.v._bigrat), 2) == 0) { -+ if (mpz_perfect_square_p(a.v._bigint)) { -+ mpz_sqrt(z, a.v._bigint); -+ } else { -+ mpz_clear(z); -+ return false; -+ } -+ } -+ else { -+ bool exact = mpz_root(z, a.v._bigint, -+ mpz_get_ui(mpq_denref(b.v._bigrat))); -+ if (not exact) { -+ mpz_clear(z); -+ return false; -+ } -+ } -+ mpz_pow_ui(z, z, mpz_get_ui(mpq_numref(b.v._bigrat))); -+ } -+ res = numeric(z); // transfers ownership, no mpz_clear -+ return true; -+} -+ -+ - // Compute `a^b` as an integer, if it is integral, or return ``false``. - // The nonnegative real root is taken for even denominators. - bool numeric::integer_rational_power(numeric& res, -@@ -1598,13 +1654,12 @@ bool numeric::integer_rational_power(numeric& res, - if (a.v._long < 0 - and mpz_cmp_ui(mpq_denref(b.v._bigrat), 1)) - return false; -- long z; - if (not mpz_fits_ulong_p(mpq_numref(b.v._bigrat)) - or not mpz_fits_ulong_p(mpq_denref(b.v._bigrat))) - // too big to take roots/powers - return false; - if (b.is_equal(*_num1_2_p)) { -- z = std::lround(std::sqrt(a.v._long)); -+ long z = std::lround(std::sqrt(a.v._long)); - if (a.v._long == z*z) { - res = numeric(z); - return true; -@@ -1613,44 +1668,11 @@ bool numeric::integer_rational_power(numeric& res, - } - return integer_rational_power(res, a.to_bigint(), b); - } -- if (a.t != MPZ) -- throw std::runtime_error("integer_rational_power: bad input"); -- int sgn = mpz_sgn(a.v._bigint); -- mpz_t z; -- mpz_init(z); -- mpz_set_ui(z, 0); -- if (mpz_cmp_ui(a.v._bigint, 1) == 0 -- or mpz_cmp_ui(mpq_numref(b.v._bigrat), 0) == 0) -- mpz_set_ui(z, 1); -- else if (sgn == 0) { -- res = *_num0_p; -- return true; -- } -- else if (sgn < 0 and mpz_cmp_ui(mpq_denref(b.v._bigrat), 1)) -- return false; -- else { -- if (not mpz_fits_ulong_p(mpq_numref(b.v._bigrat)) -- or not mpz_fits_ulong_p(mpq_denref(b.v._bigrat))) -- // too big to take roots/powers -- return false; -- if (mpz_cmp_ui(mpq_denref(b.v._bigrat), 2) == 0) { -- if (mpz_perfect_square_p(a.v._bigint)) -- mpz_sqrt(z, a.v._bigint); -- else -- return false; -- } -- else { -- bool exact = mpz_root(z, a.v._bigint, -- mpz_get_ui(mpq_denref(b.v._bigrat))); -- if (not exact) -- return false; -- } -- mpz_pow_ui(z, z, mpz_get_ui(mpq_numref(b.v._bigrat))); -- } -- res = numeric(z); -- return true; -+ // otherwise: a is integer -+ return integer_rational_power_of_mpz(res, a, b); - } - -+ - // for a^b return c,d such that a^b = c*d^b - // only for MPZ/MPQ base and MPQ exponent - void rational_power_parts(const numeric& a_orig, const numeric& b_orig, -diff --git a/src/sage/tests/memcheck/__init__.py b/src/sage/tests/memcheck/__init__.py -new file mode 100644 -index 00000000000..e69de29bb2d -diff --git a/src/sage/tests/memcheck/run_tests.py b/src/sage/tests/memcheck/run_tests.py -new file mode 100644 -index 00000000000..6ff4503a81b ---- /dev/null -+++ b/src/sage/tests/memcheck/run_tests.py -@@ -0,0 +1,24 @@ -+import types -+ -+ -+def run_tests() -> None: -+ """ -+ Run all memcheck tests -+ """ -+ from sage.tests.memcheck import symbolic_expression -+ run_tests_in_module(symbolic_expression) -+ -+ -+def run_tests_in_module(mod: types.ModuleType) -> None: -+ """ -+ Run all memcheck tests in the given module -+ """ -+ for entry in dir(mod): -+ if not entry.startswith('test_'): -+ continue -+ test_func = getattr(mod, entry) -+ test_func() -+ -+ -+if __name__ == '__main__': -+ run_tests() -diff --git a/src/sage/tests/memcheck/run_tests_in_valgrind.py b/src/sage/tests/memcheck/run_tests_in_valgrind.py -new file mode 100644 -index 00000000000..df5ad0e92b2 ---- /dev/null -+++ b/src/sage/tests/memcheck/run_tests_in_valgrind.py -@@ -0,0 +1,35 @@ -+""" -+Launch valgrind and run the memory leak tests -+ -+ -+From the commandline, run -+ -+ sage -python -m sage.tests.memcheck.run_tests_in_valgrind -+ -+to launch valgrind and execute the memory leak tests. Requires valgrind -+to be installed. Alternatively, run as a unit test: -+ -+ sage: from sage.tests.memcheck.run_tests_in_valgrind import run_tests_in_valgrind -+ sage: run_tests_in_valgrind() # optional - valgrind -+""" -+ -+import subprocess -+ -+ -+def run_tests_in_valgrind() -> None: -+ """ -+ Run the sage.tests.memcheck.run_tests module inside valgrind -+ """ -+ subprocess.check_call([ -+ 'valgrind', -+ '--suppressions=src/sage/ext_data/valgrind/valgrind-python.supp', -+ '--show-possibly-lost=no', -+ '--show-reachable=no', -+ './venv/bin/python', -+ '-m', -+ 'sage.tests.memcheck.run_tests' -+ ]) -+ -+ -+if __name__ == '__main__': -+ run_tests_in_valgrind() -diff --git a/src/sage/tests/memcheck/symbolic_expression.py b/src/sage/tests/memcheck/symbolic_expression.py -new file mode 100644 -index 00000000000..52182fbe62d ---- /dev/null -+++ b/src/sage/tests/memcheck/symbolic_expression.py -@@ -0,0 +1,11 @@ -+from sage.tests.memcheck.verify_no_leak import verify_no_leak -+ -+ -+def test_sqrt_sqrt_2() -> None: -+ from sage.misc.functional import sqrt -+ T2 = sqrt(2) -+ -+ def sqrt_T2() -> None: -+ sqrt(T2) -+ -+ verify_no_leak(sqrt_T2) -diff --git a/src/sage/tests/memcheck/verify_no_leak.py b/src/sage/tests/memcheck/verify_no_leak.py -new file mode 100644 -index 00000000000..89ca90cf89c ---- /dev/null -+++ b/src/sage/tests/memcheck/verify_no_leak.py -@@ -0,0 +1,27 @@ -+from typing import Tuple, Sequence, List, Callable, Any -+import valgrind -+ -+ -+def verify_no_leak(callback: Callable[[], Any], -+ repeat: int = 10000, -+ fuzzy: int = 10, -+ ) -> None: -+ """ -+ Verify that the callback does not generate new definitely lost blocks -+ -+ Raises an assertion if the callback leaks memory -+ """ -+ callback() # warm_up -+ initial_blocks = (0, 0, 0, 0) -+ valgrind.memcheck_do_leak_check() -+ initial_blocks = valgrind.memcheck_count_leak_blocks() -+ for _ in range(repeat): -+ callback() -+ valgrind.memcheck_do_leak_check() -+ leak_blocks = valgrind.memcheck_count_leak_blocks() -+ leak = leak_blocks[0] - initial_blocks[0] -+ if leak < repeat - fuzzy: -+ return # callback did not leak at least once per call -+ blocks = round(leak / repeat, 2) -+ message = f'{callback} leaked {blocks} block on average ({repeat} iterations)' -+ raise AssertionError(message) diff --git a/srcpkgs/sagemath/patches/36235-ecl_23.9.9.patch b/srcpkgs/sagemath/patches/36235-ecl_23.9.9.patch deleted file mode 100644 index 684b62affaf5a..0000000000000 --- a/srcpkgs/sagemath/patches/36235-ecl_23.9.9.patch +++ /dev/null @@ -1,39 +0,0 @@ -diff --git a/src/sage/libs/ecl.pyx b/src/sage/libs/ecl.pyx -index 8f46570313d..a8e73e57b52 100644 ---- a/src/sage/libs/ecl.pyx -+++ b/src/sage/libs/ecl.pyx -@@ -563,15 +563,15 @@ cdef class EclObject: - Floats in Python are IEEE double, which LISP has as well. However, - the printing of floating point types in LISP depends on settings:: - -- sage: a = EclObject(float(10^40)) -+ sage: a = EclObject(float(1.234e40)) - sage: ecl_eval("(setf *read-default-float-format* 'single-float)") - - sage: a -- -+ - sage: ecl_eval("(setf *read-default-float-format* 'double-float)") - - sage: a -- -+ - - Tuples are translated to dotted lists:: - -diff --git a/src/sage/libs/eclsig.h b/src/sage/libs/eclsig.h -index e249ccf6874..005b2d99d0b 100644 ---- a/src/sage/libs/eclsig.h -+++ b/src/sage/libs/eclsig.h -@@ -45,7 +45,11 @@ static inline void ecl_sig_off(void) - sig_off(); - } - -+#if ECL_VERSION_NUMBER < 230909 - #define ecl_mpz_from_bignum(obj) ((obj)->big.big_num) -+#else -+#define ecl_mpz_from_bignum(obj) ecl_bignum(obj) -+#endif - - cl_object ecl_bignum_from_mpz(mpz_t num) - { diff --git a/srcpkgs/sagemath/patches/36279-matplotlib_3.8.0.patch b/srcpkgs/sagemath/patches/36279-matplotlib_3.8.0.patch deleted file mode 100644 index e858f2fd4a445..0000000000000 --- a/srcpkgs/sagemath/patches/36279-matplotlib_3.8.0.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py -index 59f10f6b13f..adcccff059b 100644 ---- a/src/sage/plot/graphics.py -+++ b/src/sage/plot/graphics.py -@@ -36,6 +36,7 @@ - # **************************************************************************** - - import os -+from numbers import Integral - from collections.abc import Iterable - from math import isnan - import sage.misc.verbose -@@ -2874,6 +2875,11 @@ def matplotlib(self, filename=None, - weight=lopts.pop('font_weight', 'medium'), - variant=lopts.pop('font_variant', 'normal')) - color = lopts.pop('back_color', 'white') -+ if 'loc' in lopts: -+ loc = lopts['loc'] -+ if isinstance(loc, Integral): -+ # matplotlib 3.8 doesn't support sage integers -+ lopts['loc'] = int(loc) - leg = subplot.legend(prop=prop, **lopts) - if leg is None: - from warnings import warn diff --git a/srcpkgs/sagemath/patches/36403-00pre.patch b/srcpkgs/sagemath/patches/36403-00pre.patch deleted file mode 100644 index 060404d5430de..0000000000000 --- a/srcpkgs/sagemath/patches/36403-00pre.patch +++ /dev/null @@ -1,29 +0,0 @@ -Minor patch so that #36403 applies cleanly over sagemath 10.1 - -diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx -index 2053bca80c3..86aca6e00d8 100644 ---- a/src/sage/matrix/matrix2.pyx -+++ b/src/sage/matrix/matrix2.pyx -@@ -15123,7 +15302,8 @@ cdef class Matrix(Matrix1): - sage: N.conjugate_transpose() - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int' object has no attribute 'conjugate' -+ AttributeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int' object -+ has no attribute 'conjugate' - """ - # limited testing on a 1000 x 1000 matrix over CC: - # transpose is fast, conjugate is slow -diff --git a/src/sage/cpython/getattr.pyx b/src/sage/cpython/getattr.pyx -index 525ea5aa934..52afed49d64 100644 ---- a/src/sage/cpython/getattr.pyx -+++ b/src/sage/cpython/getattr.pyx -@@ -55,7 +55,7 @@ cdef class AttributeErrorMessage: - ... - AttributeError: 'sage.rings.integer.Integer' object has no attribute 'bla' - sage: x = polygen(ZZ, 'x') -- sage: QQ[x].gen().bla # optional - sage.libs.flint -+ sage: QQ[x].gen().bla # needs sage.libs.flint - Traceback (most recent call last): - ... - AttributeError: 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint' object has no attribute 'bla' diff --git a/srcpkgs/sagemath/patches/36407-python_3.12.patch b/srcpkgs/sagemath/patches/36407-python_3.12.patch deleted file mode 100644 index c75c275c30764..0000000000000 --- a/srcpkgs/sagemath/patches/36407-python_3.12.patch +++ /dev/null @@ -1,1744 +0,0 @@ -diff --git a/build/sage_bootstrap/package.py b/build/sage_bootstrap/package.py -index 15b342223c4..eb82f96e05f 100644 ---- a/build/sage_bootstrap/package.py -+++ b/build/sage_bootstrap/package.py -@@ -303,7 +303,7 @@ def _init_checksum(self): - # Name of the directory containing the checksums.ini file - self.__tarball_package_name = os.path.realpath(checksums_ini).split(os.sep)[-2] - -- VERSION_PATCHLEVEL = re.compile('(?P.*)\.p(?P[0-9]+)') -+ VERSION_PATCHLEVEL = re.compile(r'(?P.*)\.p(?P[0-9]+)') - - def _init_version(self): - try: -diff --git a/src/doc/en/thematic_tutorials/coercion_and_categories.rst b/src/doc/en/thematic_tutorials/coercion_and_categories.rst -index bb23331c151..7f5712caea7 100644 ---- a/src/doc/en/thematic_tutorials/coercion_and_categories.rst -+++ b/src/doc/en/thematic_tutorials/coercion_and_categories.rst -@@ -1223,7 +1223,7 @@ However, only "elementary" construction functors have a rank:: - sage: (Fract*Poly).rank - Traceback (most recent call last): - ... -- AttributeError: 'CompositeConstructionFunctor' object has no attribute 'rank' -+ AttributeError: 'CompositeConstructionFunctor' object has no attribute 'rank'... - - .. end of output - -diff --git a/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst b/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst -index 553a946c4d8..3cd71a9bad4 100644 ---- a/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst -+++ b/src/doc/en/thematic_tutorials/tutorial-objects-and-classes.rst -@@ -318,7 +318,7 @@ http://docs.python.org/library/ for a complete list. :: - sage: e.__dict__ - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute '__dict__' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute '__dict__'... - - sage: id4 = SymmetricGroup(4).one() - sage: type(id4) -@@ -326,7 +326,7 @@ http://docs.python.org/library/ for a complete list. :: - sage: id4.__dict__ - Traceback (most recent call last): - ... -- AttributeError: 'sage.groups.perm_gps.permgroup_element.SymmetricGroupElement' object has no attribute '__dict__' -+ AttributeError: 'sage.groups.perm_gps.permgroup_element.SymmetricGroupElement' object has no attribute '__dict__'... - - .. note:: - -diff --git a/src/sage/algebras/cluster_algebra.py b/src/sage/algebras/cluster_algebra.py -index b72d2a12976..14669dfed5c 100644 ---- a/src/sage/algebras/cluster_algebra.py -+++ b/src/sage/algebras/cluster_algebra.py -@@ -167,7 +167,7 @@ - sage: (t*s).g_vector() - Traceback (most recent call last): - ... -- AttributeError: 'ClusterAlgebra_with_category.element_class' object has no attribute 'g_vector' -+ AttributeError: 'ClusterAlgebra_with_category.element_class' object has no attribute 'g_vector'... - sage: A = ClusterAlgebra(['A', 2], principal_coefficients=True) - sage: A.explore_to_depth(infinity) - sage: s = A.cluster_variable((0, -1)); s -diff --git a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py -index e4a91723558..343ee8a66f9 100644 ---- a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py -+++ b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py -@@ -109,7 +109,7 @@ class WeylLieConformalAlgebra(LieConformalAlgebraWithStructureCoefficients): - sage: alpha0.degree() - Traceback (most recent call last): - ... -- AttributeError: 'WeylLieConformalAlgebra_with_category.element_class' object has no attribute 'degree' -+ AttributeError: 'WeylLieConformalAlgebra_with_category.element_class' object has no attribute 'degree'... - - TESTS:: - -diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py -index 978a3557a9d..7c4d444f81c 100644 ---- a/src/sage/algebras/steenrod/steenrod_algebra.py -+++ b/src/sage/algebras/steenrod/steenrod_algebra.py -@@ -1080,7 +1080,7 @@ def homogeneous_component(self, n): - sage: a.antipode() # not defined - Traceback (most recent call last): - ... -- AttributeError: 'CombinatorialFreeModule_with_category.element_class' object has no attribute 'antipode' -+ AttributeError: 'CombinatorialFreeModule_with_category.element_class' object has no attribute 'antipode'... - sage: A(a).antipode() # convert to elt of A, then compute antipode - Sq(2,1) + Sq(5) - -diff --git a/src/sage/all__sagemath_repl.py b/src/sage/all__sagemath_repl.py -index 8d0b43679ca..c31b206bcb8 100644 ---- a/src/sage/all__sagemath_repl.py -+++ b/src/sage/all__sagemath_repl.py -@@ -79,6 +79,23 @@ - message=r"Use setlocale\(\), getencoding\(\) and getlocale\(\) instead", - module='docutils.io') - -+# triggered by dateutil 2.8.2 and sphinx 7.0.1 on Python 3.12 -+# see: https://github.com/dateutil/dateutil/pull/1285 -+# see: https://github.com/sphinx-doc/sphinx/pull/11468 -+warnings.filterwarnings('ignore', category=DeprecationWarning, -+ message=r"datetime.datetime.utcfromtimestamp\(\) is deprecated", -+ module='dateutil.tz.tz|sphinx.(builders.gettext|util.i18n)') -+ -+# triggered on Python 3.12 -+warnings.filterwarnings('ignore', category=DeprecationWarning, -+ message=r"This process.* is multi-threaded, " -+ r"use of .*\(\) may lead to deadlocks in the child.") -+ -+# pickling of itertools is deprecated in Python 3.12 -+warnings.filterwarnings('ignore', category=DeprecationWarning, -+ message=r"Pickle, copy, and deepcopy support will be " -+ r"removed from itertools in Python 3.14.") -+ - - from .all__sagemath_objects import * - from .all__sagemath_environment import * -diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd -index 0031a0ae337..3ea70cef571 100644 ---- a/src/sage/arith/long.pxd -+++ b/src/sage/arith/long.pxd -@@ -19,6 +19,8 @@ from libc.limits cimport LONG_MIN, LONG_MAX - from cpython.object cimport Py_SIZE - from cpython.number cimport PyNumber_Index, PyIndex_Check - from cpython.longintrepr cimport py_long, PyLong_SHIFT, digit -+from sage.cpython.pycore_long cimport ( -+ ob_digit, _PyLong_IsNegative, _PyLong_DigitCount) - - from sage.libs.gmp.mpz cimport mpz_fits_slong_p, mpz_get_si - from sage.rings.integer_fake cimport is_Integer, Integer_AS_MPZ -@@ -299,8 +301,11 @@ cdef inline bint integer_check_long_py(x, long* value, int* err): - return 0 - - # x is a Python "int" (aka PyLongObject or py_long in cython) -- cdef const digit* D = (x).ob_digit -- cdef Py_ssize_t size = Py_SIZE(x) -+ cdef const digit* D = ob_digit(x) -+ cdef Py_ssize_t size = _PyLong_DigitCount(x) -+ -+ if _PyLong_IsNegative(x): -+ size = -size - - # We assume PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT. - # This is true in all the default configurations: -diff --git a/src/sage/categories/category.py b/src/sage/categories/category.py -index 57ef7f4184b..29bce8ee415 100644 ---- a/src/sage/categories/category.py -+++ b/src/sage/categories/category.py -@@ -2129,7 +2129,7 @@ def _with_axioms(self, axioms): - sage: Semigroups().Inverse() - Traceback (most recent call last): - ... -- AttributeError: 'Semigroups_with_category' object has no attribute 'Inverse' -+ AttributeError: 'Semigroups_with_category' object has no attribute 'Inverse'... - sage: Semigroups()._with_axioms(["Inverse"]) - Category of semigroups - -diff --git a/src/sage/categories/category_with_axiom.py b/src/sage/categories/category_with_axiom.py -index 5227792e725..4775d4e5bf1 100644 ---- a/src/sage/categories/category_with_axiom.py -+++ b/src/sage/categories/category_with_axiom.py -@@ -554,7 +554,7 @@ class from the base category class:: - sage: Magmas.Unital.Associative - Traceback (most recent call last): - ... -- AttributeError: type object 'Magmas.Unital' has no attribute 'Associative' -+ AttributeError: type object 'Magmas.Unital' has no attribute 'Associative'... - - The purpose of this section is to explain the design of the code - layout and the rationale for this mismatch. -@@ -769,7 +769,7 @@ def _(): return LazyImport('sage.categories.rngs', 'Rngs', at_startup=True) - sage: Semirings().NoZeroDivisors() - Traceback (most recent call last): - ... -- AttributeError: 'Semirings_with_category' object has no attribute 'NoZeroDivisors' -+ AttributeError: 'Semirings_with_category' object has no attribute 'NoZeroDivisors'... - - Concretely, this is to be implemented by defining the new axiom in the - (``SubcategoryMethods`` nested class of the) appropriate category with -diff --git a/src/sage/categories/enumerated_sets.py b/src/sage/categories/enumerated_sets.py -index a8bea53f907..b0ea05d0563 100644 ---- a/src/sage/categories/enumerated_sets.py -+++ b/src/sage/categories/enumerated_sets.py -@@ -610,7 +610,7 @@ def _list_from_iterator(self): - sage: (QQ^2).list() # indirect test # needs sage.modules - Traceback (most recent call last): - ... -- AttributeError: 'FreeModule_ambient_field_with_category' object has no attribute 'list' -+ AttributeError: 'FreeModule_ambient_field_with_category' object has no attribute 'list'... - - Here we test that for an object that does not know whether it - is finite or not. Calling ``x.list()`` simply tries to create -@@ -622,11 +622,11 @@ def _list_from_iterator(self): - sage: Q.is_finite() - Traceback (most recent call last): - ... -- AttributeError: 'QuotientRing_generic_with_category' object has no attribute 'is_finite' -+ AttributeError: 'QuotientRing_generic_with_category' object has no attribute 'is_finite'... - sage: Q.list() # indirect test - Traceback (most recent call last): - ... -- AttributeError: 'QuotientRing_generic_with_category' object has no attribute 'list' -+ AttributeError: 'QuotientRing_generic_with_category' object has no attribute 'list'... - - Here is another example. We artificially create a version of - the ring of integers that does not know whether it is finite -diff --git a/src/sage/categories/examples/sets_cat.py b/src/sage/categories/examples/sets_cat.py -index e0853d63f94..fbadb9ca405 100644 ---- a/src/sage/categories/examples/sets_cat.py -+++ b/src/sage/categories/examples/sets_cat.py -@@ -619,7 +619,7 @@ class PrimeNumbers_Facade(PrimeNumbers_Abstract): - sage: pf.next() - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute 'next' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute 'next'... - - unlike in the other implementations:: - -diff --git a/src/sage/categories/homset.py b/src/sage/categories/homset.py -index 22ba9d047fc..2a8b8aeedeb 100644 ---- a/src/sage/categories/homset.py -+++ b/src/sage/categories/homset.py -@@ -632,7 +632,7 @@ def __init__(self, X, Y, category=None, base=None, check=True): - sage: H = MyHomset(X, Y, category=1, base = ZZ, check = False) - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute 'Homsets' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute 'Homsets'... - sage: P. = ZZ[] - sage: f = P.hom([1/2*t]) - sage: f.parent().domain() -diff --git a/src/sage/categories/modules_with_basis.py b/src/sage/categories/modules_with_basis.py -index e97bf851388..c4933d0657f 100644 ---- a/src/sage/categories/modules_with_basis.py -+++ b/src/sage/categories/modules_with_basis.py -@@ -2456,7 +2456,7 @@ def apply_multilinear_morphism(self, f, codomain=None): - sage: tensor([a, b]).apply_multilinear_morphism(f) # needs sage.modules - Traceback (most recent call last): - ... -- AttributeError: 'int' object has no attribute 'parent' -+ AttributeError: 'int' object has no attribute 'parent'... - - Here we consider an example where the codomain is a - module with basis with a different base ring:: -diff --git a/src/sage/categories/monoids.py b/src/sage/categories/monoids.py -index 38dd7248c9d..28474bd17b6 100644 ---- a/src/sage/categories/monoids.py -+++ b/src/sage/categories/monoids.py -@@ -556,7 +556,7 @@ def algebra_generators(self): - Traceback (most recent call last): - ... - AttributeError: 'IntegerModMonoid_with_category' object -- has no attribute 'monoid_generators' -+ has no attribute 'monoid_generators'... - sage: Z12.semigroup_generators() - Family (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) - sage: Z12.algebra(QQ).algebra_generators() # needs sage.modules -diff --git a/src/sage/combinat/finite_state_machine.py b/src/sage/combinat/finite_state_machine.py -index 494e8154c80..ec5120e41e6 100644 ---- a/src/sage/combinat/finite_state_machine.py -+++ b/src/sage/combinat/finite_state_machine.py -@@ -1835,7 +1835,7 @@ def __getstate__(self): - sage: T1.transitions - Traceback (most recent call last): - ... -- AttributeError: 'FSMState' object has no attribute 'transitions' -+ AttributeError: 'FSMState' object has no attribute 'transitions'... - sage: A1 = loads(dumps(A)) - sage: all(A.state(j) == A1.state(j) for j in [0, 1]) - True -diff --git a/src/sage/combinat/growth.py b/src/sage/combinat/growth.py -index cf8d18c1764..766eea37917 100644 ---- a/src/sage/combinat/growth.py -+++ b/src/sage/combinat/growth.py -@@ -371,7 +371,7 @@ - sage: GrowthDiagram(RulePascal(), [3,1,2]) - Traceback (most recent call last): - ... -- AttributeError: 'RulePascal' object has no attribute 'forward_rule' -+ AttributeError: 'RulePascal' object has no attribute 'forward_rule'... - - We now re-implement the rule where we provide the dual graded graphs:: - -diff --git a/src/sage/combinat/integer_lists/lists.py b/src/sage/combinat/integer_lists/lists.py -index 5143e5cb5e8..9117a6076f7 100644 ---- a/src/sage/combinat/integer_lists/lists.py -+++ b/src/sage/combinat/integer_lists/lists.py -@@ -261,7 +261,7 @@ def __getattr__(self, name): - sage: L.foo - Traceback (most recent call last): - ... -- AttributeError: 'NoneType' object has no attribute 'foo' -+ AttributeError: 'NoneType' object has no attribute 'foo'... - """ - return getattr(self.backend, name) - -diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py -index c31597c72e9..c74bfc67cee 100644 ---- a/src/sage/combinat/posets/posets.py -+++ b/src/sage/combinat/posets/posets.py -@@ -8825,7 +8825,7 @@ def is_induced_subposet(self, other): - sage: Poset().is_induced_subposet('junk') - Traceback (most recent call last): - ... -- AttributeError: 'str' object has no attribute 'subposet' -+ AttributeError: 'str' object has no attribute 'subposet'... - """ - if (not self._is_facade or (isinstance(other, FinitePoset) and - not other._is_facade)): -diff --git a/src/sage/cpython/atexit.pyx b/src/sage/cpython/atexit.pyx -index 961aa348d0a..e5a82735137 100644 ---- a/src/sage/cpython/atexit.pyx -+++ b/src/sage/cpython/atexit.pyx -@@ -154,6 +154,10 @@ cdef extern from *: - #undef _PyGC_FINALIZED - #include "internal/pycore_interp.h" - #include "internal/pycore_pystate.h" -+ #if PY_VERSION_HEX >= 0x030c0000 -+ // struct atexit_callback was renamed in 3.12 to atexit_py_callback -+ #define atexit_callback atexit_py_callback -+ #endif - static atexit_callback ** _atexit_callbacks(PyObject *self) { - PyInterpreterState *interp = _PyInterpreterState_GET(); - struct atexit_state state = interp->atexit; -diff --git a/src/sage/cpython/debug.pyx b/src/sage/cpython/debug.pyx -index 986abff2a99..cdaca3a4854 100644 ---- a/src/sage/cpython/debug.pyx -+++ b/src/sage/cpython/debug.pyx -@@ -78,7 +78,7 @@ def getattr_debug(obj, name, default=_no_default): - - EXAMPLES:: - -- sage: _ = getattr_debug(list, "reverse") -+ sage: _ = getattr_debug(list, "reverse") # not tested - broken in python 3.12 - getattr_debug(obj=, name='reverse'): - type(obj) = - object has __dict__ slot () -@@ -123,7 +123,7 @@ def getattr_debug(obj, name, default=_no_default): - sage: _ = getattr_debug(1, "foo") - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute 'foo' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute 'foo'... - sage: _ = getattr_debug(1, "foo", "xyz") - getattr_debug(obj=1, name='foo'): - type(obj) = -diff --git a/src/sage/cpython/dict_internal.h b/src/sage/cpython/dict_internal.h -index 42a57bcb468..a5ee35bc198 100644 ---- a/src/sage/cpython/dict_internal.h -+++ b/src/sage/cpython/dict_internal.h -@@ -169,6 +169,7 @@ dictkeys_set_index(PyDictKeysObject *keys, Py_ssize_t i, Py_ssize_t ix) - #else /* Python >= 3.11 */ - - #define Py_BUILD_CORE -+#undef _PyGC_FINALIZED - #include - - /************************************************************/ -diff --git a/src/sage/cpython/getattr.pyx b/src/sage/cpython/getattr.pyx -index 52afed49d64..1f49e5230c3 100644 ---- a/src/sage/cpython/getattr.pyx -+++ b/src/sage/cpython/getattr.pyx -@@ -53,12 +53,12 @@ cdef class AttributeErrorMessage: - sage: 1.bla #indirect doctest - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute 'bla' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute 'bla'... - sage: x = polygen(ZZ, 'x') - sage: QQ[x].gen().bla # needs sage.libs.flint - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint' object has no attribute 'bla' -+ AttributeError: 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint' object has no attribute 'bla'... - - :: - -@@ -144,7 +144,7 @@ cpdef raw_getattr(obj, name): - sage: raw_getattr(X, "attr") - Traceback (most recent call last): - ... -- AttributeError: '...' object has no attribute 'attr' -+ AttributeError: '...' object has no attribute 'attr'... - sage: x = X() - sage: raw_getattr(x, "prop") - -@@ -173,7 +173,7 @@ cpdef raw_getattr(obj, name): - sage: raw_getattr(Y, "attr") - Traceback (most recent call last): - ... -- AttributeError: '...' object has no attribute 'attr' -+ AttributeError: '...' object has no attribute 'attr'... - sage: y = Y() - sage: raw_getattr(y, "prop") - -@@ -278,7 +278,7 @@ cpdef getattr_from_other_class(self, cls, name): - sage: getattr_from_other_class(1, A, "lazy_attribute") - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute 'lazy_attribute' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute 'lazy_attribute'... - - The integer ring is a parent, so, lazy attributes work:: - -@@ -289,7 +289,7 @@ cpdef getattr_from_other_class(self, cls, name): - sage: getattr_from_other_class(17, A, "lazy_attribute") - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute 'lazy_attribute' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute 'lazy_attribute'... - - In general, descriptors are not yet well supported, because they - often do not accept to be cheated with the type of their instance:: -@@ -305,7 +305,7 @@ cpdef getattr_from_other_class(self, cls, name): - sage: getattr_from_other_class(1, A, "__weakref__") - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute '__weakref__' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute '__weakref__'... - - This was caught by :trac:`8296` for which we do a couple more tests:: - -@@ -314,7 +314,7 @@ cpdef getattr_from_other_class(self, cls, name): - sage: 1.__weakref__ - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute '__weakref__' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute '__weakref__'... - - sage: n = 1 - sage: ip = get_ipython() # not tested: only works in interactive shell -@@ -329,7 +329,7 @@ cpdef getattr_from_other_class(self, cls, name): - sage: getattr_from_other_class(1, A, "__call__") - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute '__call__' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute '__call__'... - - TESTS: - -@@ -339,14 +339,14 @@ cpdef getattr_from_other_class(self, cls, name): - sage: getattr_from_other_class(1, type, "__name__") - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute '__name__' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute '__name__'... - - Non-strings as "name" are handled gracefully:: - - sage: getattr_from_other_class(1, type, None) - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute None -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute None... - """ - if not isinstance(cls, type): - raise TypeError(f"{cls!r} is not a type") -diff --git a/src/sage/cpython/pycore_long.h b/src/sage/cpython/pycore_long.h -new file mode 100644 -index 00000000000..ff1a73d097a ---- /dev/null -+++ b/src/sage/cpython/pycore_long.h -@@ -0,0 +1,98 @@ -+#include "Python.h" -+#include -+ -+#if PY_VERSION_HEX >= 0x030C00A5 -+#define ob_digit(o) (((PyLongObject*)o)->long_value.ob_digit) -+#else -+#define ob_digit(o) (((PyLongObject*)o)->ob_digit) -+#endif -+ -+#if PY_VERSION_HEX >= 0x030C00A7 -+// taken from cpython:Include/internal/pycore_long.h @ 3.12 -+ -+/* Long value tag bits: -+ * 0-1: Sign bits value = (1-sign), ie. negative=2, positive=0, zero=1. -+ * 2: Reserved for immortality bit -+ * 3+ Unsigned digit count -+ */ -+#define SIGN_MASK 3 -+#define SIGN_ZERO 1 -+#define SIGN_NEGATIVE 2 -+#define NON_SIZE_BITS 3 -+ -+static inline bool -+_PyLong_IsZero(const PyLongObject *op) -+{ -+ return (op->long_value.lv_tag & SIGN_MASK) == SIGN_ZERO; -+} -+ -+static inline bool -+_PyLong_IsNegative(const PyLongObject *op) -+{ -+ return (op->long_value.lv_tag & SIGN_MASK) == SIGN_NEGATIVE; -+} -+ -+static inline bool -+_PyLong_IsPositive(const PyLongObject *op) -+{ -+ return (op->long_value.lv_tag & SIGN_MASK) == 0; -+} -+ -+static inline Py_ssize_t -+_PyLong_DigitCount(const PyLongObject *op) -+{ -+ assert(PyLong_Check(op)); -+ return op->long_value.lv_tag >> NON_SIZE_BITS; -+} -+ -+#define TAG_FROM_SIGN_AND_SIZE(sign, size) ((1 - (sign)) | ((size) << NON_SIZE_BITS)) -+ -+static inline void -+_PyLong_SetSignAndDigitCount(PyLongObject *op, int sign, Py_ssize_t size) -+{ -+ assert(size >= 0); -+ assert(-1 <= sign && sign <= 1); -+ assert(sign != 0 || size == 0); -+ op->long_value.lv_tag = TAG_FROM_SIGN_AND_SIZE(sign, (size_t)size); -+} -+ -+#else -+// fallback for < 3.12 -+ -+static inline bool -+_PyLong_IsZero(const PyLongObject *op) -+{ -+ return Py_SIZE(op) == 0; -+} -+ -+static inline bool -+_PyLong_IsNegative(const PyLongObject *op) -+{ -+ return Py_SIZE(op) < 0; -+} -+ -+static inline bool -+_PyLong_IsPositive(const PyLongObject *op) -+{ -+ return Py_SIZE(op) > 0; -+} -+ -+static inline Py_ssize_t -+_PyLong_DigitCount(const PyLongObject *op) -+{ -+ Py_ssize_t size = Py_SIZE(op); -+ return size < 0 ? -size : size; -+} -+ -+static inline void -+_PyLong_SetSignAndDigitCount(PyLongObject *op, int sign, Py_ssize_t size) -+{ -+#if (PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION < 9) -+// The function Py_SET_SIZE is defined starting with python 3.9. -+ Py_SIZE(o) = size; -+#else -+ Py_SET_SIZE(op, sign < 0 ? -size : size); -+#endif -+} -+ -+#endif -diff --git a/src/sage/cpython/pycore_long.pxd b/src/sage/cpython/pycore_long.pxd -new file mode 100644 -index 00000000000..41de637ff18 ---- /dev/null -+++ b/src/sage/cpython/pycore_long.pxd -@@ -0,0 +1,9 @@ -+from cpython.longintrepr cimport py_long, digit -+ -+cdef extern from "pycore_long.h": -+ digit* ob_digit(py_long o) -+ bint _PyLong_IsZero(py_long o) -+ bint _PyLong_IsNegative(py_long o) -+ bint _PyLong_IsPositive(py_long o) -+ Py_ssize_t _PyLong_DigitCount(py_long o) -+ void _PyLong_SetSignAndDigitCount(py_long o, int sign, Py_ssize_t size) -diff --git a/src/sage/crypto/classical.py b/src/sage/crypto/classical.py -index 616dc861652..be899c781e5 100644 ---- a/src/sage/crypto/classical.py -+++ b/src/sage/crypto/classical.py -@@ -494,7 +494,7 @@ def rank_by_chi_square(self, C, pdict): - sage: A.rank_by_chi_square("", Plist) - Traceback (most recent call last): - ... -- AttributeError: 'str' object has no attribute 'parent' -+ AttributeError: 'str' object has no attribute 'parent'... - sage: A.rank_by_chi_square(A.encoding(""), Plist) - Traceback (most recent call last): - ... -@@ -703,7 +703,7 @@ def rank_by_squared_differences(self, C, pdict): - sage: A.rank_by_squared_differences("", Plist) - Traceback (most recent call last): - ... -- AttributeError: 'str' object has no attribute 'parent' -+ AttributeError: 'str' object has no attribute 'parent'... - sage: A.rank_by_squared_differences(A.encoding(""), Plist) - Traceback (most recent call last): - ... -@@ -2114,7 +2114,7 @@ def rank_by_chi_square(self, C, pdict): - sage: S.rank_by_chi_square("", Pdict) - Traceback (most recent call last): - ... -- AttributeError: 'str' object has no attribute 'parent' -+ AttributeError: 'str' object has no attribute 'parent'... - sage: S.rank_by_chi_square(S.encoding(""), Pdict) - Traceback (most recent call last): - ... -@@ -2351,7 +2351,7 @@ def rank_by_squared_differences(self, C, pdict): - sage: S.rank_by_squared_differences("", Pdict) - Traceback (most recent call last): - ... -- AttributeError: 'str' object has no attribute 'parent' -+ AttributeError: 'str' object has no attribute 'parent'... - sage: S.rank_by_squared_differences(S.encoding(""), Pdict) - Traceback (most recent call last): - ... -diff --git a/src/sage/crypto/mq/mpolynomialsystemgenerator.py b/src/sage/crypto/mq/mpolynomialsystemgenerator.py -index 9028dab1d98..4416d9ef7f6 100644 ---- a/src/sage/crypto/mq/mpolynomialsystemgenerator.py -+++ b/src/sage/crypto/mq/mpolynomialsystemgenerator.py -@@ -156,7 +156,7 @@ def sbox(self): - sage: msg.sbox() - Traceback (most recent call last): - ... -- AttributeError: '' object has no attribute '_sbox' -+ AttributeError: '' object has no attribute '_sbox'... - """ - return self._sbox - -diff --git a/src/sage/data_structures/bitset.pyx b/src/sage/data_structures/bitset.pyx -index 446062554c1..d9906b5edd2 100644 ---- a/src/sage/data_structures/bitset.pyx -+++ b/src/sage/data_structures/bitset.pyx -@@ -967,7 +967,7 @@ cdef class FrozenBitset: - sage: None | FrozenBitset('10101') - Traceback (most recent call last): - ... -- AttributeError: 'NoneType' object has no attribute '_union' -+ AttributeError: 'NoneType' object has no attribute '_union'... - """ - return self._union(other) - -@@ -1037,7 +1037,7 @@ cdef class FrozenBitset: - sage: None & FrozenBitset("101011") - Traceback (most recent call last): - ... -- AttributeError: 'NoneType' object has no attribute 'intersection' -+ AttributeError: 'NoneType' object has no attribute 'intersection'... - """ - return self.intersection(other) - -@@ -1106,7 +1106,7 @@ cdef class FrozenBitset: - sage: None - FrozenBitset('10101') - Traceback (most recent call last): - ... -- AttributeError: 'NoneType' object has no attribute 'difference' -+ AttributeError: 'NoneType' object has no attribute 'difference'... - """ - return self.difference(other) - -@@ -1179,7 +1179,7 @@ cdef class FrozenBitset: - sage: None ^^ FrozenBitset('11111' * 10) - Traceback (most recent call last): - ... -- AttributeError: 'NoneType' object has no attribute 'symmetric_difference' -+ AttributeError: 'NoneType' object has no attribute 'symmetric_difference'... - """ - return self.symmetric_difference(other) - -diff --git a/src/sage/doctest/reporting.py b/src/sage/doctest/reporting.py -index 361fea344c2..a3947c07e01 100644 ---- a/src/sage/doctest/reporting.py -+++ b/src/sage/doctest/reporting.py -@@ -368,7 +368,7 @@ def report(self, source, timeout, return_code, results, output, pid=None): - sage: DTR.report(None, None, None, None, None) - Traceback (most recent call last): - ... -- AttributeError: 'NoneType' object has no attribute 'basename' -+ AttributeError: 'NoneType' object has no attribute 'basename'... - - The only-errors mode does not output anything on success:: - -diff --git a/src/sage/dynamics/finite_dynamical_system.py b/src/sage/dynamics/finite_dynamical_system.py -index e5fbf568b7e..4295070615a 100644 ---- a/src/sage/dynamics/finite_dynamical_system.py -+++ b/src/sage/dynamics/finite_dynamical_system.py -@@ -240,7 +240,7 @@ class DiscreteDynamicalSystem(SageObject, metaclass=ClasscallMetaclass): - sage: D.inverse_evolution()(4) - Traceback (most recent call last): - ... -- AttributeError: 'DiscreteDynamicalSystem' object has no attribute 'inverse_evolution' -+ AttributeError: 'DiscreteDynamicalSystem' object has no attribute 'inverse_evolution'... - sage: D.orbit(3) - [3, 5, 1] - -@@ -252,7 +252,7 @@ class DiscreteDynamicalSystem(SageObject, metaclass=ClasscallMetaclass): - sage: D.inverse_evolution()(4) - Traceback (most recent call last): - ... -- AttributeError: 'DiscreteDynamicalSystem' object has no attribute 'inverse_evolution' -+ AttributeError: 'DiscreteDynamicalSystem' object has no attribute 'inverse_evolution'... - sage: D.orbit(3) - [3, 5, 1] - -diff --git a/src/sage/geometry/cone.py b/src/sage/geometry/cone.py -index f0a8620011a..53f78a4b7b6 100644 ---- a/src/sage/geometry/cone.py -+++ b/src/sage/geometry/cone.py -@@ -340,7 +340,7 @@ def Cone(rays, lattice=None, check=True, normalize=True): - sage: Cone([(1,0), (0,1)], check=False, normalize=False) - Traceback (most recent call last): - ... -- AttributeError: 'tuple' object has no attribute 'parent' -+ AttributeError: 'tuple' object has no attribute 'parent'... - - You can construct different "not" cones: not full-dimensional, not - strictly convex, not containing any rays:: -diff --git a/src/sage/geometry/fan.py b/src/sage/geometry/fan.py -index 258544012fe..3aecc84a55b 100644 ---- a/src/sage/geometry/fan.py -+++ b/src/sage/geometry/fan.py -@@ -443,7 +443,7 @@ def Fan(cones, rays=None, lattice=None, check=True, normalize=True, - sage: P2c = Fan(cones, rays, check=False, normalize=False) - Traceback (most recent call last): - ... -- AttributeError: 'tuple' object has no attribute 'parent' -+ AttributeError: 'tuple' object has no attribute 'parent'... - - Yet another way is to use functions :func:`FaceFan` and :func:`NormalFan` - to construct fans from :class:`lattice polytopes -diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx -index f0ac1e774a7..f03f0f832ff 100644 ---- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx -+++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx -@@ -351,7 +351,7 @@ cdef class FaceIterator_base(SageObject): - sage: FaceIterator_base(2) # indirect doctest - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute 'combinatorial_polyhedron' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute 'combinatorial_polyhedron'... - """ - cdef int i - sig_free(self.structure.atom_rep) -@@ -1945,7 +1945,8 @@ cdef inline int next_face_loop(iter_t structure) nogil except -1: - # The function is not supposed to be called, - # just prevent it from crashing. - # Actually raising an error here results in a bad branch prediction. -- return -1 -+ # But return -1 results in a crash with python 3.12 -+ raise StopIteration - - # Getting ``[faces, n_faces, n_visited_all]`` according to dimension. - cdef face_list_t* faces = &structure.new_faces[structure.current_dimension] -diff --git a/src/sage/geometry/toric_plotter.py b/src/sage/geometry/toric_plotter.py -index 50b4008eb0f..950e3ba7ff8 100644 ---- a/src/sage/geometry/toric_plotter.py -+++ b/src/sage/geometry/toric_plotter.py -@@ -706,7 +706,7 @@ def set_rays(self, generators): - sage: tp.plot_rays() # needs sage.plot - Traceback (most recent call last): - ... -- AttributeError: 'ToricPlotter' object has no attribute 'rays' -+ AttributeError: 'ToricPlotter' object has no attribute 'rays'... - sage: tp.set_rays([(0,1)]) - sage: tp.plot_rays() # needs sage.plot - Graphics object consisting of 2 graphics primitives -diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py -index d0ec214bb3b..c8098ad578a 100644 ---- a/src/sage/groups/matrix_gps/finitely_generated.py -+++ b/src/sage/groups/matrix_gps/finitely_generated.py -@@ -268,7 +268,7 @@ def MatrixGroup(*gens, **kwds): - sage: SL2C.gens() - Traceback (most recent call last): - ... -- AttributeError: 'LinearMatrixGroup_generic_with_category' object has no attribute 'gens' -+ AttributeError: 'LinearMatrixGroup_generic_with_category' object has no attribute 'gens'... - """ - if isinstance(gens[-1], dict): # hack for unpickling - kwds.update(gens[-1]) -diff --git a/src/sage/homology/chains.py b/src/sage/homology/chains.py -index 87c0947c0b0..b9a54940943 100644 ---- a/src/sage/homology/chains.py -+++ b/src/sage/homology/chains.py -@@ -298,7 +298,7 @@ def is_cycle(self): - sage: chain.is_cocycle() - Traceback (most recent call last): - ... -- AttributeError: 'Chains_with_category.element_class' object has no attribute 'is_cocycle' -+ AttributeError: 'Chains_with_category.element_class' object has no attribute 'is_cocycle'... - """ - return self.to_complex().is_cycle() - -@@ -325,7 +325,7 @@ def is_boundary(self): - sage: chain.is_coboundary() - Traceback (most recent call last): - ... -- AttributeError: 'Chains_with_category.element_class' object has no attribute 'is_coboundary' -+ AttributeError: 'Chains_with_category.element_class' object has no attribute 'is_coboundary'... - """ - return self.to_complex().is_boundary() - -@@ -539,7 +539,7 @@ def is_cocycle(self): - sage: cochain.is_cycle() - Traceback (most recent call last): - ... -- AttributeError: 'Cochains_with_category.element_class' object has no attribute 'is_cycle' -+ AttributeError: 'Cochains_with_category.element_class' object has no attribute 'is_cycle'... - """ - return self.to_complex().is_cycle() - -@@ -566,7 +566,7 @@ def is_coboundary(self): - sage: cochain.is_boundary() - Traceback (most recent call last): - ... -- AttributeError: 'Cochains_with_category.element_class' object has no attribute 'is_boundary' -+ AttributeError: 'Cochains_with_category.element_class' object has no attribute 'is_boundary'... - """ - return self.to_complex().is_boundary() - -@@ -604,7 +604,7 @@ def eval(self, other): - sage: z.eval(c) # z is not a cochain - Traceback (most recent call last): - ... -- AttributeError: 'Chains_with_category.element_class' object has no attribute 'eval' -+ AttributeError: 'Chains_with_category.element_class' object has no attribute 'eval'... - sage: c.eval(c) # can't evaluate a cochain on a cochain - Traceback (most recent call last): - ... -diff --git a/src/sage/homology/free_resolution.py b/src/sage/homology/free_resolution.py -index e3d38de4240..280a479b438 100644 ---- a/src/sage/homology/free_resolution.py -+++ b/src/sage/homology/free_resolution.py -@@ -275,7 +275,7 @@ def differential(self, i): - sage: FreeResolution.differiental(r, 1) - Traceback (most recent call last): - ... -- AttributeError: type object 'FreeResolution' has no attribute 'differiental' -+ AttributeError: type object 'FreeResolution' has no attribute 'differiental'... - """ - - def target(self): -diff --git a/src/sage/interfaces/magma.py b/src/sage/interfaces/magma.py -index b7a0ac20d03..529bfbc349b 100644 ---- a/src/sage/interfaces/magma.py -+++ b/src/sage/interfaces/magma.py -@@ -824,7 +824,7 @@ def _coerce_from_special_method(self, x): - sage: magma._coerce_from_special_method('2 + 3') # optional - magma - Traceback (most recent call last): - ... -- AttributeError: 'str' object has no attribute '_magma_init_' -+ AttributeError: 'str' object has no attribute '_magma_init_'... - """ - s = x._magma_init_(self) - a = self(s) -diff --git a/src/sage/lfunctions/dokchitser.py b/src/sage/lfunctions/dokchitser.py -index 58499396d6c..16119d20815 100644 ---- a/src/sage/lfunctions/dokchitser.py -+++ b/src/sage/lfunctions/dokchitser.py -@@ -418,8 +418,8 @@ def init_coeffs(self, v, cutoff=1, - sage: L(14) - 0.998583063162746 - sage: a = delta_qexp(1000) -- sage: sum(a[n]/float(n)^14 for n in range(1,1000)) -- 0.9985830631627459 -+ sage: sum(a[n]/float(n)^14 for n in reversed(range(1,1000))) -+ 0.9985830631627461 - - Illustrate that one can give a list of complex numbers for v - (see :trac:`10937`):: -diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py -index bbf289aa21c..e4968866303 100644 ---- a/src/sage/lfunctions/pari.py -+++ b/src/sage/lfunctions/pari.py -@@ -141,8 +141,8 @@ def init_coeffs(self, v, cutoff=None, w=1): - sage: L(14) - 0.998583063162746 - sage: a = delta_qexp(1000) -- sage: sum(a[n]/float(n)^14 for n in range(1,1000)) -- 0.9985830631627459 -+ sage: sum(a[n]/float(n)^14 for n in reversed(range(1,1000))) -+ 0.9985830631627461 - - Illustrate that one can give a list of complex numbers for v - (see :trac:`10937`):: -diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx -index 478caf9f9d0..363024ae281 100644 ---- a/src/sage/libs/gap/element.pyx -+++ b/src/sage/libs/gap/element.pyx -@@ -380,7 +380,7 @@ cdef GapElement make_GapElement(parent, Obj obj): - sage: libgap(None) - Traceback (most recent call last): - ... -- AttributeError: 'NoneType' object has no attribute '_libgap_init_' -+ AttributeError: 'NoneType' object has no attribute '_libgap_init_'... - """ - cdef GapElement r = GapElement.__new__(GapElement) - r._initialize(parent, obj) -diff --git a/src/sage/libs/gmp/pylong.pxd b/src/sage/libs/gmp/pylong.pxd -index a73f1da6d6f..84e1bb8cd87 100644 ---- a/src/sage/libs/gmp/pylong.pxd -+++ b/src/sage/libs/gmp/pylong.pxd -@@ -2,9 +2,10 @@ - Various functions to deal with conversion mpz <-> Python int/long - """ - -+from cpython.longintrepr cimport py_long - from sage.libs.gmp.types cimport * - - cdef mpz_get_pylong(mpz_srcptr z) - cdef mpz_get_pyintlong(mpz_srcptr z) --cdef int mpz_set_pylong(mpz_ptr z, L) except -1 -+cdef int mpz_set_pylong(mpz_ptr z, py_long L) except -1 - cdef Py_hash_t mpz_pythonhash(mpz_srcptr z) -diff --git a/src/sage/libs/gmp/pylong.pyx b/src/sage/libs/gmp/pylong.pyx -index d5993cca5a5..1a36c29d3fa 100644 ---- a/src/sage/libs/gmp/pylong.pyx -+++ b/src/sage/libs/gmp/pylong.pyx -@@ -28,6 +28,8 @@ AUTHORS: - from cpython.object cimport Py_SIZE - from cpython.long cimport PyLong_FromLong - from cpython.longintrepr cimport _PyLong_New, py_long, digit, PyLong_SHIFT -+from sage.cpython.pycore_long cimport (ob_digit, _PyLong_IsNegative, -+ _PyLong_DigitCount, _PyLong_SetSignAndDigitCount) - from .mpz cimport * - - cdef extern from *: -@@ -60,12 +62,9 @@ cdef mpz_get_pylong_large(mpz_srcptr z): - """ - cdef size_t nbits = mpz_sizeinbase(z, 2) - cdef size_t pylong_size = (nbits + PyLong_SHIFT - 1) // PyLong_SHIFT -- L = _PyLong_New(pylong_size) -- mpz_export(L.ob_digit, NULL, -- -1, sizeof(digit), 0, PyLong_nails, z) -- if mpz_sgn(z) < 0: -- # Set correct size -- Py_SET_SIZE(L, -pylong_size) -+ cdef py_long L = _PyLong_New(pylong_size) -+ mpz_export(ob_digit(L), NULL, -1, sizeof(digit), 0, PyLong_nails, z) -+ _PyLong_SetSignAndDigitCount(L, mpz_sgn(z), pylong_size) - return L - - -@@ -88,16 +87,13 @@ cdef mpz_get_pyintlong(mpz_srcptr z): - return mpz_get_pylong_large(z) - - --cdef int mpz_set_pylong(mpz_ptr z, L) except -1: -+cdef int mpz_set_pylong(mpz_ptr z, py_long L) except -1: - """ - Convert a Python ``long`` `L` to an ``mpz``. - """ -- cdef Py_ssize_t pylong_size = Py_SIZE(L) -- if pylong_size < 0: -- pylong_size = -pylong_size -- mpz_import(z, pylong_size, -1, sizeof(digit), 0, PyLong_nails, -- (L).ob_digit) -- if Py_SIZE(L) < 0: -+ cdef Py_ssize_t pylong_size = _PyLong_DigitCount(L) -+ mpz_import(z, pylong_size, -1, sizeof(digit), 0, PyLong_nails, ob_digit(L)) -+ if _PyLong_IsNegative(L): - mpz_neg(z, z) - - -diff --git a/src/sage/manifolds/calculus_method.py b/src/sage/manifolds/calculus_method.py -index f5830c0bc45..303dde6cd13 100644 ---- a/src/sage/manifolds/calculus_method.py -+++ b/src/sage/manifolds/calculus_method.py -@@ -257,7 +257,7 @@ def simplify(self, expression, method=None): - sage: cm.simplify(f) - Traceback (most recent call last): - ... -- AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'combsimp' -+ AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'combsimp'... - - In the present case, one should either transform ``f`` to a SymPy - object:: -diff --git a/src/sage/manifolds/differentiable/vectorfield_module.py b/src/sage/manifolds/differentiable/vectorfield_module.py -index d954b5d4839..af4bfb0ceec 100644 ---- a/src/sage/manifolds/differentiable/vectorfield_module.py -+++ b/src/sage/manifolds/differentiable/vectorfield_module.py -@@ -885,7 +885,7 @@ def tensor(self, *args, **kwds): - sage: XM.tensor(XM).tensor(XM.dual().tensor(XM.dual())) - Traceback (most recent call last): - ... -- AttributeError: 'TensorFieldModule_with_category' object has no attribute '_basis_sym' -+ AttributeError: 'TensorFieldModule_with_category' object has no attribute '_basis_sym'... - - .. SEEALSO:: - -diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx -index 86aca6e00d8..a5f6716e731 100644 ---- a/src/sage/matrix/matrix2.pyx -+++ b/src/sage/matrix/matrix2.pyx -@@ -15303,7 +15303,7 @@ cdef class Matrix(Matrix1): - Traceback (most recent call last): - ... - AttributeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int' object -- has no attribute 'conjugate' -+ has no attribute 'conjugate'... - """ - # limited testing on a 1000 x 1000 matrix over CC: - # transpose is fast, conjugate is slow -diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx -index f54f3423ded..a49bb6240e6 100644 ---- a/src/sage/matrix/matrix_cyclo_dense.pyx -+++ b/src/sage/matrix/matrix_cyclo_dense.pyx -@@ -847,7 +847,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): - sage: A.set_mutable() - Traceback (most recent call last): - ... -- AttributeError: 'sage.matrix.matrix_cyclo_dense.Matrix_cyclo_dense' object has no attribute 'set_mutable' -+ AttributeError: 'sage.matrix.matrix_cyclo_dense.Matrix_cyclo_dense' object has no attribute 'set_mutable'... - sage: B = A.__copy__() - sage: B[0,0] = 20 - sage: B[0,0] -diff --git a/src/sage/matrix/matrix_gfpn_dense.pyx b/src/sage/matrix/matrix_gfpn_dense.pyx -index 4cccf473de1..8e8e4d7336b 100644 ---- a/src/sage/matrix/matrix_gfpn_dense.pyx -+++ b/src/sage/matrix/matrix_gfpn_dense.pyx -@@ -159,7 +159,7 @@ cdef class FieldConverter_class: - sage: C.field_to_fel('foo') - Traceback (most recent call last): - ... -- AttributeError: 'str' object has no attribute 'to_integer' -+ AttributeError: 'str' object has no attribute 'to_integer'... - """ - return FfFromInt(x.to_integer()) - -diff --git a/src/sage/matrix/matrix_space.py b/src/sage/matrix/matrix_space.py -index 6aab58352be..b5e6f52349b 100644 ---- a/src/sage/matrix/matrix_space.py -+++ b/src/sage/matrix/matrix_space.py -@@ -1619,7 +1619,7 @@ def __getitem__(self, x): - sage: MS[2] - Traceback (most recent call last): - ... -- AttributeError: 'MatrixSpace_with_category' object has no attribute 'list' -+ AttributeError: 'MatrixSpace_with_category' object has no attribute 'list'... - """ - if isinstance(x, (integer.Integer, int)): - return self.list()[x] -diff --git a/src/sage/matroids/lean_matrix.pyx b/src/sage/matroids/lean_matrix.pyx -index 54c68e637c0..a137cbf70e5 100644 ---- a/src/sage/matroids/lean_matrix.pyx -+++ b/src/sage/matroids/lean_matrix.pyx -@@ -1,5 +1,4 @@ - # sage.doctest: optional - sage.rings.finite_rings --# cython: profile=True - """ - Lean matrices - -diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx -index 36f563aa433..318c82f2b64 100644 ---- a/src/sage/matroids/linear_matroid.pyx -+++ b/src/sage/matroids/linear_matroid.pyx -@@ -1134,7 +1134,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): - Traceback (most recent call last): - ... - AttributeError: 'sage.matroids.basis_matroid.BasisMatroid' object -- has no attribute 'base_ring' -+ has no attribute 'base_ring'... - sage: from sage.matroids.advanced import * - sage: M4 = BinaryMatroid(Matrix(M1)) - sage: M5 = LinearMatroid(reduced_matrix=Matrix(GF(2), [[-1, 0, 1], -diff --git a/src/sage/misc/dev_tools.py b/src/sage/misc/dev_tools.py -index e7bf176592c..3ece7db2894 100644 ---- a/src/sage/misc/dev_tools.py -+++ b/src/sage/misc/dev_tools.py -@@ -171,6 +171,7 @@ def load_submodules(module=None, exclude_pattern=None): - load sage.geometry.polyhedron.ppl_lattice_polygon... succeeded - """ - from .package_dir import walk_packages -+ import importlib.util - - if module is None: - import sage -@@ -194,8 +195,12 @@ def load_submodules(module=None, exclude_pattern=None): - try: - sys.stdout.write("load %s..." % module_name) - sys.stdout.flush() -- loader = importer.find_module(module_name) -- loader.load_module(module_name) -+ # see -+ # https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly -+ spec = importer.find_spec(module_name) -+ module = importlib.util.module_from_spec(spec) -+ sys.modules[module_name] = module -+ spec.loader.exec_module(module) - sys.stdout.write(" succeeded\n") - except (ValueError, AttributeError, TypeError, ImportError): - # we might get error because of cython code that has been -diff --git a/src/sage/misc/functional.py b/src/sage/misc/functional.py -index c922b8f6f12..03697f08b7c 100644 ---- a/src/sage/misc/functional.py -+++ b/src/sage/misc/functional.py -@@ -86,7 +86,7 @@ def base_field(x): - sage: R.base_field() - Traceback (most recent call last): - ... -- AttributeError: 'PolynomialRing_dense_mod_p_with_category' object has no attribute 'base_field' -+ AttributeError: 'PolynomialRing_dense_mod_p_with_category' object has no attribute 'base_field'... - """ - try: - return x.base_field() -diff --git a/src/sage/misc/instancedoc.pyx b/src/sage/misc/instancedoc.pyx -index d8e1e4ac536..44ee70f64ba 100644 ---- a/src/sage/misc/instancedoc.pyx -+++ b/src/sage/misc/instancedoc.pyx -@@ -256,7 +256,7 @@ cdef class InstanceDocDescriptor: - sage: descr.__delete__(obj) - Traceback (most recent call last): - ... -- AttributeError: 'X' object has no attribute '__doc__' -+ AttributeError: 'X' object has no attribute '__doc__'... - - sage: descr.__delete__([]) - Traceback (most recent call last): -diff --git a/src/sage/misc/lazy_attribute.pyx b/src/sage/misc/lazy_attribute.pyx -index bdbec3b3ba1..1f07870b8ec 100644 ---- a/src/sage/misc/lazy_attribute.pyx -+++ b/src/sage/misc/lazy_attribute.pyx -@@ -441,37 +441,37 @@ class lazy_attribute(_lazy_attribute): - sage: B().unimplemented_A # todo: not implemented - Traceback (most recent call last): - ... -- AttributeError: 'super' object has no attribute 'unimplemented_A' -+ AttributeError: 'super' object has no attribute 'unimplemented_A'... - - We now make some systematic checks:: - - sage: B().unimplemented_A - Traceback (most recent call last): - ... -- AttributeError: '...' object has no attribute 'unimplemented_A' -+ AttributeError: '...' object has no attribute 'unimplemented_A'... - sage: B().unimplemented_B - Traceback (most recent call last): - ... -- AttributeError: '...' object has no attribute 'unimplemented_B' -+ AttributeError: '...' object has no attribute 'unimplemented_B'... - sage: B().unimplemented_AB - Traceback (most recent call last): - ... -- AttributeError: '...' object has no attribute 'unimplemented_AB' -+ AttributeError: '...' object has no attribute 'unimplemented_AB'... - sage: B().unimplemented_B_implemented_A - 1 - - sage: C().unimplemented_A() - Traceback (most recent call last): - ... -- AttributeError: '...' object has no attribute 'unimplemented_A' -+ AttributeError: '...' object has no attribute 'unimplemented_A'... - sage: C().unimplemented_B() - Traceback (most recent call last): - ... -- AttributeError: '...' object has no attribute 'unimplemented_B' -+ AttributeError: '...' object has no attribute 'unimplemented_B'... - sage: C().unimplemented_AB() - Traceback (most recent call last): - ... -- AttributeError: '...' object has no attribute 'unimplemented_AB' -+ AttributeError: '...' object has no attribute 'unimplemented_AB'... - sage: C().unimplemented_B_implemented_A # todo: not implemented - 1 - """ -diff --git a/src/sage/misc/object_multiplexer.py b/src/sage/misc/object_multiplexer.py -index d4e811ef16e..00fd89d6652 100644 ---- a/src/sage/misc/object_multiplexer.py -+++ b/src/sage/misc/object_multiplexer.py -@@ -85,7 +85,7 @@ def __getattr__(self, name): - sage: m.__bork__ - Traceback (most recent call last): - ... -- AttributeError: 'Multiplex' has no attribute '__bork__' -+ AttributeError: 'Multiplex' has no attribute '__bork__'... - """ - if name.startswith("__"): - raise AttributeError("'Multiplex' has no attribute '%s'" % name) -diff --git a/src/sage/misc/sage_input.py b/src/sage/misc/sage_input.py -index 66e78ecccbc..00e8d96ee9e 100644 ---- a/src/sage/misc/sage_input.py -+++ b/src/sage/misc/sage_input.py -@@ -3461,7 +3461,7 @@ def verify_same(a, b): - sage: verify_same(1, 1r) - Traceback (most recent call last): - ... -- AttributeError: 'int' object has no attribute 'parent' -+ AttributeError: 'int' object has no attribute 'parent'... - sage: verify_same(1r, 1) - Traceback (most recent call last): - ... -@@ -3525,7 +3525,7 @@ def verify_si_answer(x, answer, preparse): - sage: verify_si_answer(1, '1', False) - Traceback (most recent call last): - ... -- AttributeError: 'int' object has no attribute 'parent' -+ AttributeError: 'int' object has no attribute 'parent'... - sage: verify_si_answer(1, 'ZZ(1)', None) - """ - from sage.misc.sage_eval import sage_eval -diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py -index f0545be7d81..811afc48755 100644 ---- a/src/sage/misc/sageinspect.py -+++ b/src/sage/misc/sageinspect.py -@@ -602,7 +602,7 @@ def visit_Num(self, node): - On Python 3 negative numbers are parsed first, for some reason, as - a UnaryOp node. - """ -- return node.n -+ return node.value - - def visit_Str(self, node): - r""" -@@ -624,7 +624,7 @@ def visit_Str(self, node): - sage: [vis(s) for s in ['"abstract"', "'syntax'", r'''r"tr\ee"''']] - ['abstract', 'syntax', 'tr\\ee'] - """ -- return node.s -+ return node.value - - def visit_List(self, node): - """ -diff --git a/src/sage/modules/fp_graded/steenrod/module.py b/src/sage/modules/fp_graded/steenrod/module.py -index 18460b0e9a1..4acfa6b4002 100755 ---- a/src/sage/modules/fp_graded/steenrod/module.py -+++ b/src/sage/modules/fp_graded/steenrod/module.py -@@ -70,7 +70,7 @@ - sage: SteenrodFPModule(ZZ, [0]) - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer_ring.IntegerRing_class' object has no attribute 'free_graded_module' -+ AttributeError: 'sage.rings.integer_ring.IntegerRing_class' object has no attribute 'free_graded_module'... - - AUTHORS: - -diff --git a/src/sage/monoids/trace_monoid.py b/src/sage/monoids/trace_monoid.py -index 00baa4d14f8..f8176a1e1f2 100644 ---- a/src/sage/monoids/trace_monoid.py -+++ b/src/sage/monoids/trace_monoid.py -@@ -40,7 +40,6 @@ - # https://www.gnu.org/licenses/ - # **************************************************************************** - --from collections import OrderedDict - from itertools import repeat, chain, product - - from sage.misc.cachefunc import cached_method -@@ -633,14 +632,14 @@ def _compute_dependence_stack(self, x): - sage: x = b*a*d*a*c*b - sage: M._compute_dependence_stack(x) - ({a, b, c, d}, -- OrderedDict([(a, [False, False, True, True, False]), -- (b, [True, False, False, False, True]), -- (c, [True, False, False, False]), -- (d, [False, False, True, False])])) -+ {a: [False, False, True, True, False], -+ b: [True, False, False, False, True], -+ c: [True, False, False, False], -+ d: [False, False, True, False]}) - """ - independence = self._independence - generators_set = set(e for e, _ in x) -- stacks = OrderedDict(sorted((g, []) for g in generators_set)) -+ stacks = dict(sorted((g, []) for g in generators_set)) - for generator, times in reversed(list(x)): - stacks[generator].extend(repeat(True, times)) - for other_gen in generators_set: -diff --git a/src/sage/parallel/map_reduce.py b/src/sage/parallel/map_reduce.py -index 11e0673ee91..5441943731d 100644 ---- a/src/sage/parallel/map_reduce.py -+++ b/src/sage/parallel/map_reduce.py -@@ -1234,7 +1234,7 @@ def finish(self): - sage: S.print_communication_statistics() - Traceback (most recent call last): - ... -- AttributeError: 'RESetMPExample' object has no attribute '_stats' -+ AttributeError: 'RESetMPExample' object has no attribute '_stats'... - - sage: S.finish() - -diff --git a/src/sage/plot/colors.py b/src/sage/plot/colors.py -index 8c0db2b3c34..3281199400b 100644 ---- a/src/sage/plot/colors.py -+++ b/src/sage/plot/colors.py -@@ -1099,7 +1099,7 @@ def __getattr__(self, name): - sage: cols.punk - Traceback (most recent call last): - ... -- AttributeError: 'ColorsDict' has no attribute or colormap punk -+ AttributeError: 'ColorsDict' has no attribute or colormap punk... - """ - try: - return self[name] -@@ -1599,7 +1599,7 @@ def __getattr__(self, name): - sage: maps.punk - Traceback (most recent call last): - ... -- AttributeError: 'Colormaps' has no attribute or colormap punk -+ AttributeError: 'Colormaps' has no attribute or colormap punk... - sage: maps['punk'] - Traceback (most recent call last): - ... -diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py -index b07319382d3..994490e6616 100644 ---- a/src/sage/rings/asymptotic/asymptotic_ring.py -+++ b/src/sage/rings/asymptotic/asymptotic_ring.py -@@ -1091,7 +1091,7 @@ def monomial_coefficient(self, monomial): - sage: O(n).monomial_coefficient(n) - Traceback (most recent call last): - ... -- AttributeError: 'OTermMonoid_with_category.element_class' object has no attribute 'coefficient' -+ AttributeError: 'OTermMonoid_with_category.element_class' object has no attribute 'coefficient'... - - The ``monomial`` must be exact:: - -diff --git a/src/sage/rings/asymptotic/growth_group.py b/src/sage/rings/asymptotic/growth_group.py -index 27c14592bca..5be12537d62 100644 ---- a/src/sage/rings/asymptotic/growth_group.py -+++ b/src/sage/rings/asymptotic/growth_group.py -@@ -1572,7 +1572,7 @@ def variable_names(self): - Traceback (most recent call last): - ... - AttributeError: 'GenericGrowthGroup_with_category.element_class' object -- has no attribute 'is_one' -+ has no attribute 'is_one'... - """ - if self.is_one(): - return tuple() -diff --git a/src/sage/rings/ideal.py b/src/sage/rings/ideal.py -index d36d9406f32..01c9fa3bf2d 100644 ---- a/src/sage/rings/ideal.py -+++ b/src/sage/rings/ideal.py -@@ -1553,7 +1553,7 @@ def gcd(self, other): - sage: J.gcd(I) - Traceback (most recent call last): - ... -- AttributeError: 'Ideal_generic' object has no attribute 'gcd' -+ AttributeError: 'Ideal_generic' object has no attribute 'gcd'... - - Note:: - -diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py -index 7fe89197011..8832d27e8ea 100644 ---- a/src/sage/rings/number_field/number_field.py -+++ b/src/sage/rings/number_field/number_field.py -@@ -3823,7 +3823,7 @@ def primes_above(self, x, degree=None): - sage: F.prime_above(0) - Traceback (most recent call last): - ... -- AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors' -+ AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors'... - """ - if degree is not None: - degree = ZZ(degree) -@@ -3917,7 +3917,7 @@ def prime_above(self, x, degree=None): - sage: F.prime_above(0) - Traceback (most recent call last): - ... -- AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors' -+ AttributeError: 'NumberFieldIdeal' object has no attribute 'prime_factors'... - - """ - ids = self.primes_above(x, degree) -@@ -5926,7 +5926,7 @@ def factor(self, n): - sage: L.factor(0) - Traceback (most recent call last): - ... -- AttributeError: 'NumberFieldIdeal' object has no attribute 'factor' -+ AttributeError: 'NumberFieldIdeal' object has no attribute 'factor'... - - AUTHORS: - -@@ -12698,7 +12698,7 @@ def is_real_place(v): - sage: is_real_place(v_fin) - Traceback (most recent call last): - ... -- AttributeError: 'NumberFieldFractionalIdeal' object has no attribute 'im_gens' -+ AttributeError: 'NumberFieldFractionalIdeal' object has no attribute 'im_gens'... - - """ - RR = sage.rings.real_mpfr.RealField(53) -diff --git a/src/sage/rings/padics/generic_nodes.py b/src/sage/rings/padics/generic_nodes.py -index 7047020edec..b6b514d4005 100644 ---- a/src/sage/rings/padics/generic_nodes.py -+++ b/src/sage/rings/padics/generic_nodes.py -@@ -740,7 +740,7 @@ def _get_element_class(self, name=None): - sage: R._get_element_class("foobar") - Traceback (most recent call last): - ... -- AttributeError: module 'sage.rings.padics.padic_relaxed_element' has no attribute 'pAdicRelaxedElement_foobar' -+ AttributeError: module 'sage.rings.padics.padic_relaxed_element' has no attribute 'pAdicRelaxedElement_foobar'... - """ - if name is None: - return self.Element -diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx -index c5a1129aecf..a5b7f937cfe 100644 ---- a/src/sage/rings/polynomial/polynomial_element.pyx -+++ b/src/sage/rings/polynomial/polynomial_element.pyx -@@ -10793,7 +10793,7 @@ cdef class Polynomial(CommutativePolynomial): - sage: (y**2 + x).nth_root(2) - Traceback (most recent call last): - ... -- AttributeError: ... has no attribute 'nth_root' -+ AttributeError: ... has no attribute 'nth_root'... - - TESTS:: - -@@ -11831,7 +11831,7 @@ cdef class Polynomial_generic_dense(Polynomial): - sage: int(1) // x # check that this doesn't segfault - Traceback (most recent call last): - ... -- AttributeError: type object 'int' has no attribute 'base_ring' -+ AttributeError: type object 'int' has no attribute 'base_ring'... - """ - if have_same_parent(self, right): - return (self)._floordiv_(right) -diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py -index e372be888ee..aca4f08420f 100644 ---- a/src/sage/rings/polynomial/polynomial_quotient_ring.py -+++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py -@@ -2362,7 +2362,7 @@ def field_extension(self, names): - sage: F, g, h = S.field_extension('b') # needs sage.rings.finite_rings - Traceback (most recent call last): - ... -- AttributeError: 'PolynomialQuotientRing_generic_with_category' object has no attribute 'field_extension' -+ AttributeError: 'PolynomialQuotientRing_generic_with_category' object has no attribute 'field_extension'... - - Over a finite field, the corresponding field extension is not a - number field:: -diff --git a/src/sage/rings/ring.pyx b/src/sage/rings/ring.pyx -index 5273891a5b0..a6e999b8805 100644 ---- a/src/sage/rings/ring.pyx -+++ b/src/sage/rings/ring.pyx -@@ -1734,7 +1734,7 @@ cdef class IntegralDomain(CommutativeRing): - sage: Z5.is_integrally_closed() - Traceback (most recent call last): - ... -- AttributeError: 'IntegerModRing_generic_with_category' object has no attribute 'is_integrally_closed' -+ AttributeError: 'IntegerModRing_generic_with_category' object has no attribute 'is_integrally_closed'... - """ - raise NotImplementedError - -diff --git a/src/sage/sat/solvers/satsolver.pyx b/src/sage/sat/solvers/satsolver.pyx -index c2f41b18f55..1c4ac400cb6 100644 ---- a/src/sage/sat/solvers/satsolver.pyx -+++ b/src/sage/sat/solvers/satsolver.pyx -@@ -375,10 +375,10 @@ def SAT(solver=None, *args, **kwds): - DIMACS Solver: 'kissat -q {input}' - """ - if solver is None: -- import pkgutil -- if pkgutil.find_loader('pycryptosat') is not None: -+ from importlib.util import find_spec -+ if find_spec('pycryptosat') is not None: - solver = "cryptominisat" -- elif pkgutil.find_loader('pycosat') is not None: -+ elif find_spec('pycosat') is not None: - solver = "picosat" - else: - solver = "LP" -diff --git a/src/sage/schemes/toric/morphism.py b/src/sage/schemes/toric/morphism.py -index 1c8944b6dfc..5d64d632f97 100644 ---- a/src/sage/schemes/toric/morphism.py -+++ b/src/sage/schemes/toric/morphism.py -@@ -246,7 +246,7 @@ - Traceback (most recent call last): - ... - AttributeError: 'SchemeMorphism_fan_toric_variety' object -- has no attribute 'fiber_generic' -+ has no attribute 'fiber_generic'... - - Let's use factorization mentioned above:: - -diff --git a/src/sage/sets/disjoint_union_enumerated_sets.py b/src/sage/sets/disjoint_union_enumerated_sets.py -index 3dea567a779..5c5e08612f2 100644 ---- a/src/sage/sets/disjoint_union_enumerated_sets.py -+++ b/src/sage/sets/disjoint_union_enumerated_sets.py -@@ -597,7 +597,7 @@ def Element(self): - sage: U.Element - Traceback (most recent call last): - ... -- AttributeError: 'DisjointUnionEnumeratedSets_with_category' object has no attribute 'Element' -+ AttributeError: 'DisjointUnionEnumeratedSets_with_category' object has no attribute 'Element'... - """ - if not self._facade: - return ElementWrapper -diff --git a/src/sage/sets/set.py b/src/sage/sets/set.py -index a1789c61300..112d3d8dc3b 100644 ---- a/src/sage/sets/set.py -+++ b/src/sage/sets/set.py -@@ -163,7 +163,7 @@ def Set(X=None, category=None): - sage: sorted(B.list(), key=repr) - Traceback (most recent call last): - ... -- AttributeError: 'Set_object_with_category' object has no attribute 'list' -+ AttributeError: 'Set_object_with_category' object has no attribute 'list'... - sage: type(B) - - -diff --git a/src/sage/structure/category_object.pyx b/src/sage/structure/category_object.pyx -index b6a7eaecb5b..c06933494dc 100644 ---- a/src/sage/structure/category_object.pyx -+++ b/src/sage/structure/category_object.pyx -@@ -836,7 +836,7 @@ cdef class CategoryObject(SageObject): - sage: Sets().example().sadfasdf - Traceback (most recent call last): - ... -- AttributeError: 'PrimeNumbers_with_category' object has no attribute 'sadfasdf' -+ AttributeError: 'PrimeNumbers_with_category' object has no attribute 'sadfasdf'... - """ - return self.getattr_from_category(name) - -diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx -index caae7e40ffc..543506e9a74 100644 ---- a/src/sage/structure/element.pyx -+++ b/src/sage/structure/element.pyx -@@ -219,7 +219,7 @@ the parents:: - sage: x._add_(x) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_add_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_add_'... - sage: x + x - Traceback (most recent call last): - ... -@@ -478,13 +478,13 @@ cdef class Element(SageObject): - sage: 1.blah_blah - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.integer.Integer' object has no attribute 'blah_blah' -+ AttributeError: 'sage.rings.integer.Integer' object has no attribute 'blah_blah'... - sage: Semigroups().example().an_element().is_idempotent - - sage: Semigroups().example().an_element().blah_blah - Traceback (most recent call last): - ... -- AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah' -+ AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah'... - """ - return self.getattr_from_category(name) - -@@ -1269,7 +1269,7 @@ cdef class Element(SageObject): - sage: e._add_(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_add_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_add_'... - """ - try: - python_op = (self)._add_ -@@ -1381,7 +1381,7 @@ cdef class Element(SageObject): - sage: e._sub_(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_sub_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_sub_'... - """ - try: - python_op = (self)._sub_ -@@ -1435,7 +1435,7 @@ cdef class Element(SageObject): - sage: e._neg_() - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_neg_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_neg_'... - """ - try: - python_op = (self)._neg_ -@@ -1549,7 +1549,7 @@ cdef class Element(SageObject): - sage: e._mul_(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_mul_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_mul_'... - """ - try: - python_op = (self)._mul_ -@@ -1662,7 +1662,7 @@ cdef class Element(SageObject): - sage: e._matmul_(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_matmul_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_matmul_'... - """ - try: - python_op = (self)._matmul_ -@@ -1765,7 +1765,7 @@ cdef class Element(SageObject): - sage: e._div_(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_div_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_div_'... - """ - try: - python_op = (self)._div_ -@@ -1865,7 +1865,7 @@ cdef class Element(SageObject): - sage: e._floordiv_(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_floordiv_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_floordiv_'... - """ - try: - python_op = (self)._floordiv_ -@@ -1965,7 +1965,7 @@ cdef class Element(SageObject): - sage: e._mod_(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_mod_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_mod_'... - """ - try: - python_op = (self)._mod_ -@@ -2092,7 +2092,7 @@ cdef class Element(SageObject): - sage: e._pow_(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_pow_' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_pow_'... - """ - try: - python_op = (self)._pow_ -@@ -2122,7 +2122,7 @@ cdef class Element(SageObject): - sage: e._pow_int(e) - Traceback (most recent call last): - ... -- AttributeError: 'sage.structure.element.Element' object has no attribute '_pow_int' -+ AttributeError: 'sage.structure.element.Element' object has no attribute '_pow_int'... - """ - try: - python_op = (self)._pow_int -@@ -2856,7 +2856,7 @@ cdef class RingElement(ModuleElement): - sage: m.is_nilpotent() # needs sage.modules - Traceback (most recent call last): - ... -- AttributeError: ... object has no attribute 'is_nilpotent' -+ AttributeError: '...' object has no attribute 'is_nilpotent'... - """ - if self.is_unit(): - return False -@@ -4671,7 +4671,7 @@ def coerce_binop(method): - sage: x.test_add(CC(2)) - Traceback (most recent call last): - ... -- AttributeError: 'sage.rings.complex_mpfr.ComplexNumber' object has no attribute 'test_add' -+ AttributeError: 'sage.rings.complex_mpfr.ComplexNumber' object has no attribute 'test_add'... - - TESTS: - -diff --git a/src/sage/structure/sequence.py b/src/sage/structure/sequence.py -index 0c700c1fb81..c3972532ac3 100644 ---- a/src/sage/structure/sequence.py -+++ b/src/sage/structure/sequence.py -@@ -854,7 +854,7 @@ def __getattr__(self, name): - sage: S.universe() - Traceback (most recent call last): - ... -- AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__universe' -+ AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__universe'... - sage: S._Sequence__universe = 'foobar' - sage: S.universe() - 'foobar' -@@ -867,7 +867,7 @@ def __getattr__(self, name): - sage: hash(S) - Traceback (most recent call last): - ... -- AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__hash' -+ AttributeError: 'Sequence_generic' object has no attribute '_Sequence_generic__hash'... - sage: S._Sequence__hash = int(34) - sage: hash(S) - 34 -diff --git a/src/sage/symbolic/assumptions.py b/src/sage/symbolic/assumptions.py -index 7dcb15f0d85..15f6fa07ce6 100644 ---- a/src/sage/symbolic/assumptions.py -+++ b/src/sage/symbolic/assumptions.py -@@ -636,7 +636,7 @@ def assume(*args): - Traceback (most recent call last): - ... - AttributeError: 'sage.rings.integer.Integer' object has no -- attribute 'assume' -+ attribute 'assume'... - - Ensure that we can combine the two types of assumptions, as documented:: - -diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx -index 0f251ac4e5c..66f624141b3 100644 ---- a/src/sage/symbolic/expression.pyx -+++ b/src/sage/symbolic/expression.pyx -@@ -13712,7 +13712,7 @@ cdef get_dynamic_class_for_function(unsigned serial): - Traceback (most recent call last): - ... - AttributeError: 'sage.symbolic.expression.Expression' object has no -- attribute 'argp1' -+ attribute 'argp1'... - sage: t = (e + 1).op[0]; t - tfunc(x) - sage: t -diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp -index c4152e092e3..4bcf45e8793 100644 ---- a/src/sage/symbolic/ginac/numeric.cpp -+++ b/src/sage/symbolic/ginac/numeric.cpp -@@ -67,6 +67,7 @@ - #include "archive.h" - #include "tostring.h" - #include "utils.h" -+#include "../../cpython/pycore_long.h" - - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wdeprecated-register" -@@ -706,18 +707,12 @@ static long _mpq_pythonhash(mpq_t the_rat) - // Initialize an mpz_t from a Python long integer - static void _mpz_set_pylong(mpz_t z, PyLongObject* l) - { -- Py_ssize_t pylong_size = Py_SIZE(l); -- int sign = 1; -- -- if (pylong_size < 0) { -- pylong_size = -pylong_size; -- sign = -1; -- } -+ Py_ssize_t pylong_size = _PyLong_DigitCount(l); - - mpz_import(z, pylong_size, -1, sizeof(digit), 0, -- 8*sizeof(digit) - PyLong_SHIFT, l->ob_digit); -+ 8*sizeof(digit) - PyLong_SHIFT, ob_digit(l)); - -- if (sign < 0) -+ if (_PyLong_IsNegative(l)) - mpz_neg(z, z); - } - -diff --git a/src/sage/symbolic/pynac_impl.pxi b/src/sage/symbolic/pynac_impl.pxi -index 68c31dcfde7..7fd7c3b314b 100644 ---- a/src/sage/symbolic/pynac_impl.pxi -+++ b/src/sage/symbolic/pynac_impl.pxi -@@ -619,7 +619,7 @@ def tolerant_is_symbol(a): - sage: None.is_symbol() - Traceback (most recent call last): - ... -- AttributeError: 'NoneType' object has no attribute 'is_symbol' -+ AttributeError: 'NoneType' object has no attribute 'is_symbol'... - """ - try: - return a.is_symbol() diff --git a/srcpkgs/sagemath/patches/36769-fix_jmol_detect.patch b/srcpkgs/sagemath/patches/36769-fix_jmol_detect.patch new file mode 100644 index 0000000000000..c7c983fe50c0d --- /dev/null +++ b/srcpkgs/sagemath/patches/36769-fix_jmol_detect.patch @@ -0,0 +1,92 @@ +diff --git a/src/sage/interfaces/jmoldata.py b/src/sage/interfaces/jmoldata.py +index a68e53e2d85..55c07255b74 100644 +--- a/src/sage/interfaces/jmoldata.py ++++ b/src/sage/interfaces/jmoldata.py +@@ -71,6 +71,47 @@ def is_jvm_available(self): + java_version_number = int(re.sub(r'.*version "(0\.|1\.)?(\d*)[\s\S]*', r'\2', version, flags=re.S)) + return java_version_number >= 7 + ++ def jmolpath(self): ++ """ ++ Return the path to the jar file. ++ ++ EXAMPLES:: ++ ++ sage: from sage.interfaces.jmoldata import JmolData ++ sage: JData = JmolData() ++ sage: JData.jmolpath() ++ '.../JmolData.jar' ++ ++ """ ++ jmolpath = os.path.join(JMOL_DIR, "JmolData.jar") ++ ++ if sys.platform == 'cygwin': ++ import cygwin ++ jmolpath = cygwin.cygpath(jmolpath, 'w') ++ ++ return jmolpath ++ ++ def is_jmol_available(self): ++ """ ++ Returns True if jmol is available and False if not. ++ ++ EXAMPLES: ++ ++ Check that it returns a boolean:: ++ ++ sage: from sage.interfaces.jmoldata import JmolData ++ sage: JData = JmolData() ++ sage: type(JData.is_jmol_available()) ++ <... 'bool'> ++ """ ++ if not os.path.isfile(self.jmolpath()): ++ return False ++ ++ if not self.is_jvm_available(): ++ return False ++ ++ return True ++ + def export_image(self, + targetfile, + datafile, #name (path) of data file Jmol can read or script file telling it what to read or load +@@ -154,12 +195,11 @@ def export_image(self, + sage: archive.close() + """ + # Set up paths, file names and scripts +- jmolpath = os.path.join(JMOL_DIR, "JmolData.jar") ++ jmolpath = self.jmolpath() + target_native = targetfile + + if sys.platform == 'cygwin': + import cygwin +- jmolpath = cygwin.cygpath(jmolpath, 'w') + target_native = cygwin.cygpath(target_native, 'w') + if datafile_cmd != 'script': + datafile = cygwin.cygpath(datafile, 'w') +diff --git a/src/sage/plot/plot3d/base.pyx b/src/sage/plot/plot3d/base.pyx +index 253f152130c..7588cde2e27 100644 +--- a/src/sage/plot/plot3d/base.pyx ++++ b/src/sage/plot/plot3d/base.pyx +@@ -278,7 +278,7 @@ cdef class Graphics3d(SageObject): + T.export_jmol(scene_zip, **opts) + from sage.interfaces.jmoldata import JmolData + jdata = JmolData() +- if not jdata.is_jvm_available(): ++ if not jdata.is_jmol_available(): + # We can only use JMol to generate preview if a jvm is installed + from sage.repl.rich_output.output_graphics import OutputImagePng + tachyon = self._rich_repr_tachyon(OutputImagePng, **opts) +diff --git a/src/sage/repl/rich_output/backend_ipython.py b/src/sage/repl/rich_output/backend_ipython.py +index 69e63b76d60..10ccdc0c2c8 100644 +--- a/src/sage/repl/rich_output/backend_ipython.py ++++ b/src/sage/repl/rich_output/backend_ipython.py +@@ -369,7 +369,7 @@ def launch_jmol(self, output_jmol, plain_text): + from sage.doctest import DOCTEST_MODE + from sage.interfaces.jmoldata import JmolData + jdata = JmolData() +- if not jdata.is_jvm_available() and not DOCTEST_MODE: ++ if not jdata.is_jmol_available() and not DOCTEST_MODE: + raise RuntimeError('jmol cannot run, no suitable java version found') + launch_script = output_jmol.launch_script_filename() + jmol_cmd = 'jmol' diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 95a6963432948..a552b402727d3 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -1,6 +1,6 @@ #! /bin/sh -version=10.1 +version=10.2 URL_BASE_PR="https://github.com/sagemath/sage/pull/" URL_BASE_COMPARE="https://github.com/sagemath/sage/compare/${version}..." @@ -20,24 +20,6 @@ get_pr() { # run from patches dir cd $(dirname "$0") -# merged in 10.2.beta0 -#get_pr 36018 "singular 4.3.2p4" # included in #35934 -get_pr 36046 "fix memory leak" - -# merged in 10.2.beta1 -get_pr 35934 "singular 4.3.2p7" - -# merged in 10.2.beta2 -get_pr 36006 "gmp 6.3.0" - -# merged in 10.2.beta3 -get_pr 36235 "ecl 23.9.9" - -# merged in 10.2.beta4 -get_pr 36279 "matplotlib 3.8.0" - -# positive review -#get_pr 36403 "python 3.12" # included in #36407 - # needs review -get_pr 36407 "python 3.12" +get_pr 35848 "flintlib 3.0" +get_pr 36769 "fix jmol detect" diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index a80d8b7187ece..5d5bdccd70a25 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,14 +1,14 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.1 -revision=4 +version=10.2 +revision=1 build_wrksrc=pkgs/sagemath-standard build_style=python3-module _bindir=/usr/lib/sagemath/$version/bin make_install_args="--install-scripts=$_bindir" -hostmakedepends="m4 pkg-config python3-Cython0.29 python3-Jinja2 +hostmakedepends="m4 pkg-config python3-Cython python3-Jinja2 python3-pkgconfig python3-setuptools" -makedepends="arb-devel boost-devel brial-devel cliquer-devel ecl eclib-devel +makedepends="boost-devel brial-devel cliquer-devel ecl eclib-devel ecm-devel fflas-ffpack flintlib-devel gap-devel gd-devel giac-devel glpk-devel gsl-devel iml-devel lcalc-devel libbraiding-devel libhomfly-devel libmpc-devel libpng-devel linbox-devel m4ri-devel m4rie-devel mpfi-devel @@ -18,7 +18,7 @@ makedepends="arb-devel boost-devel brial-devel cliquer-devel ecl eclib-devel depends="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 - pari-galpol-small pari-seadata-small pkg-config python3-Cython0.29 python3-cypari2 + pari-galpol-small pari-seadata-small pkg-config python3-Cython python3-cypari2 python3-cysignals python3-devel python3-fpylll python3-ipython python3-lrcalc python3-ipython_ipykernel python3-jupyter_ipywidgets python3-matplotlib python3-memory_allocator python3-networkx python3-pip python3-pkgconfig @@ -33,8 +33,8 @@ license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz" -checksum=a658612b1b2376ddaf207cc8ed0ef458d4c2880c16e19139bedbe8baa42ad62f -nocross="due to ntl (flintlib), fflas-ffpack, givaro, linbox, cysignals, sympow, maxima" +checksum=e7125f13495e1068edab73735aca7f9b2c655688096e9d109e628c023e76411f +nocross="due to ntl (eclib), fflas-ffpack, givaro, linbox, sympow, maxima" post_patch() { # git tree needs bootstrapping diff --git a/srcpkgs/sagemath/update b/srcpkgs/sagemath/update index 68be3c5752d06..1a4e4049af025 100644 --- a/srcpkgs/sagemath/update +++ b/srcpkgs/sagemath/update @@ -1,2 +1,6 @@ pkgname="sage" -site="https://mirrors.mit.edu/sage/src/index.html" +site="https://mirrors.mit.edu/sage/src/" +if [[ "$version" == *[abr]* ]]; then + site+=" +https://mirrors.mit.edu/sage/devel/" +fi