sagemath: update to 9.8.
Also: - fix edge case of python 3.11 integer conversion on 32 bit - support tachyon 0.99.5 - support singular 4.3.1p3 - fix tests for giac 1.9.0.35 - fix tests for numpy 1.24 - skip unstable tests in klyachko.py - remove zn_poly dependency - fix very slow test in stream.py
This commit is contained in:
parent
e11738213b
commit
a59f11fd25
|
@ -1,3 +1,4 @@
|
|||
# configuration for sage on void linux
|
||||
SAGE_SHARE = "/usr/share/sagemath"
|
||||
GAP_ROOT_DIR = "/usr/share/gap"
|
||||
GAP_SHARE_DIR = "/usr/share/gap"
|
||||
GAP_LIB_DIR = "/usr/lib/gap"
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
- This fixes a doctest failure due to a small numerical issue when running
|
||||
maxima-sbcl on 32 bit
|
||||
|
||||
--- a/src/sage/interfaces/maxima_abstract.py
|
||||
+++ b/src/sage/interfaces/maxima_abstract.py
|
||||
@@ -1525,7 +1525,7 @@ class MaximaAbstractElement(ExtraTabCompletion, InterfaceElement):
|
||||
EXAMPLES::
|
||||
|
||||
sage: maxima('exp(-sqrt(x))').nintegral('x',0,1)
|
||||
- (0.5284822353142306, 4.1633141378838...e-11, 231, 0)
|
||||
+ (0.5284822353142306, 4.163...e-11, 231, 0)
|
||||
|
||||
Note that GP also does numerical integration, and can do so to very
|
||||
high precision very quickly::
|
|
@ -0,0 +1,47 @@
|
|||
diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
|
||||
index d5f7157217f..1a9d11aec68 100644
|
||||
--- a/src/sage/rings/number_field/number_field_ideal.py
|
||||
+++ b/src/sage/rings/number_field/number_field_ideal.py
|
||||
@@ -996,16 +996,36 @@ def is_prime(self):
|
||||
False
|
||||
sage: K.ideal(17).is_prime() # ramified
|
||||
False
|
||||
+
|
||||
+ TESTS:
|
||||
+
|
||||
+ Check that we do not factor the norm of the ideal, this used
|
||||
+ to take half an hour, see :trac:`33360`::
|
||||
+
|
||||
+ sage: K.<a,b,c> = NumberField([x^2-2,x^2-3,x^2-5])
|
||||
+ sage: t = (((-2611940*c + 1925290/7653)*b - 1537130/7653*c
|
||||
+ ....: + 10130950)*a + (1343014/7653*c - 8349770)*b
|
||||
+ ....: + 6477058*c - 2801449990/4002519)
|
||||
+ sage: t.is_prime()
|
||||
+ False
|
||||
"""
|
||||
try:
|
||||
return self._pari_prime is not None
|
||||
except AttributeError:
|
||||
- F = self.factor() # factorization with caching
|
||||
- if len(F) != 1 or F[0][1] != 1:
|
||||
- self._pari_prime = None
|
||||
- else:
|
||||
- self._pari_prime = F[0][0]._pari_prime
|
||||
- return self._pari_prime is not None
|
||||
+ pass
|
||||
+
|
||||
+ K = self.number_field().pari_nf()
|
||||
+ I = self.pari_hnf()
|
||||
+
|
||||
+ self._pari_prime = K.idealismaximal(I) or None
|
||||
+
|
||||
+ # PARI uses probabilistic primality testing inside idealismaximal().
|
||||
+ if self._pari_prime \
|
||||
+ and get_flag(None, 'arithmetic') \
|
||||
+ and not self._pari_prime[0].isprime():
|
||||
+ self._pari_prime = None
|
||||
+
|
||||
+ return self._pari_prime is not None
|
||||
|
||||
def pari_prime(self):
|
||||
r"""
|
|
@ -0,0 +1,58 @@
|
|||
diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx
|
||||
index 3ac5f1cc2b0..cb1f327c199 100644
|
||||
--- a/src/sage/misc/persist.pyx
|
||||
+++ b/src/sage/misc/persist.pyx
|
||||
@@ -157,7 +157,7 @@ def load(*filename, compress=True, verbose=True, **kwargs):
|
||||
....: _ = f.write(code)
|
||||
sage: load(t)
|
||||
sage: hello
|
||||
- <fortran object>
|
||||
+ <fortran ...>
|
||||
"""
|
||||
import sage.repl.load
|
||||
if len(filename) != 1:
|
||||
diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
|
||||
index 6f0aeab87ae..b77c69b2f77 100644
|
||||
--- a/src/sage/plot/complex_plot.pyx
|
||||
+++ b/src/sage/plot/complex_plot.pyx
|
||||
@@ -461,6 +461,8 @@ def complex_to_rgb(z_values, contoured=False, tiled=False,
|
||||
rgb[i, j, 2] = b
|
||||
|
||||
sig_off()
|
||||
+ nan_indices = np.isnan(rgb).any(-1) # Mask for undefined points
|
||||
+ rgb[nan_indices] = 1 # Make nan_indices white
|
||||
return rgb
|
||||
|
||||
|
||||
diff --git a/src/sage/plot/histogram.py b/src/sage/plot/histogram.py
|
||||
index 3bc2b76b58e..388c2d1391d 100644
|
||||
--- a/src/sage/plot/histogram.py
|
||||
+++ b/src/sage/plot/histogram.py
|
||||
@@ -87,13 +87,8 @@ def get_minmax_data(self):
|
||||
|
||||
TESTS::
|
||||
|
||||
- sage: h = histogram([10,3,5], normed=True)[0]
|
||||
- doctest:warning...:
|
||||
- DeprecationWarning: the 'normed' option is deprecated. Use 'density' instead.
|
||||
- See https://trac.sagemath.org/25260 for details.
|
||||
+ sage: h = histogram([10,3,5], density=True)[0]
|
||||
sage: h.get_minmax_data()
|
||||
- doctest:warning ...
|
||||
- ...VisibleDeprecationWarning: Passing `normed=True` on non-uniform bins has always been broken, and computes neither the probability density function nor the probability mass function. The result is only correct if the bins are uniform, when density=True will produce the same result anyway. The argument will be removed in a future version of numpy.
|
||||
{'xmax': 10.0, 'xmin': 3.0, 'ymax': 0.476190476190..., 'ymin': 0}
|
||||
"""
|
||||
import numpy
|
||||
diff --git a/src/sage/repl/ipython_extension.py b/src/sage/repl/ipython_extension.py
|
||||
index 798671aab42..cad6a47ca8b 100644
|
||||
--- a/src/sage/repl/ipython_extension.py
|
||||
+++ b/src/sage/repl/ipython_extension.py
|
||||
@@ -405,7 +405,7 @@ def fortran(self, line, cell):
|
||||
....: C END FILE FIB1.F
|
||||
....: ''')
|
||||
sage: fib
|
||||
- <fortran object>
|
||||
+ <fortran ...>
|
||||
sage: from numpy import array
|
||||
sage: a = array(range(10), dtype=float)
|
||||
sage: fib(a, 10)
|
|
@ -0,0 +1,57 @@
|
|||
diff --git a/src/sage/interfaces/tachyon.py b/src/sage/interfaces/tachyon.py
|
||||
index 23671e50892..ce1d50f71bc 100644
|
||||
--- a/src/sage/interfaces/tachyon.py
|
||||
+++ b/src/sage/interfaces/tachyon.py
|
||||
@@ -683,12 +683,14 @@
|
||||
#*****************************************************************************
|
||||
|
||||
import os
|
||||
+import re
|
||||
|
||||
from sage.cpython.string import bytes_to_str
|
||||
from sage.misc.pager import pager
|
||||
from sage.misc.superseded import deprecation
|
||||
from sage.misc.temporary_file import tmp_filename
|
||||
from sage.structure.sage_object import SageObject
|
||||
+from sage.misc.cachefunc import cached_method
|
||||
|
||||
|
||||
class TachyonRT(SageObject):
|
||||
@@ -799,6 +801,11 @@ def __call__(self, model, outfile='sage.png', verbose=1, extra_opts=''):
|
||||
Parser failed due to an input file syntax error.
|
||||
Aborting render.
|
||||
"""
|
||||
+ if self.version() >= '0.99.2':
|
||||
+ # this keyword was changed in 0.99.2
|
||||
+ model = model.replace(
|
||||
+ " focallength ",
|
||||
+ " focaldist ")
|
||||
modelfile = tmp_filename(ext='.dat')
|
||||
with open(modelfile, 'w') as file:
|
||||
file.write(model)
|
||||
@@ -851,6 +858,25 @@ def usage(self, use_pager=True):
|
||||
else:
|
||||
print(r)
|
||||
|
||||
+ @cached_method
|
||||
+ def version(self):
|
||||
+ """
|
||||
+ Returns the version of the Tachyon raytracer being used.
|
||||
+
|
||||
+ TESTS::
|
||||
+
|
||||
+ sage: tachyon_rt.version() # random
|
||||
+ 0.98.9
|
||||
+ sage: tachyon_rt.version() >= '0.98.9'
|
||||
+ True
|
||||
+ """
|
||||
+ with os.popen('tachyon') as f:
|
||||
+ r = f.readline()
|
||||
+ res = re.search(r"Version ([\d.]*)", r)
|
||||
+ # debian patches tachyon so it won't report the version
|
||||
+ # we hardcode '0.99' since that's indeed the version they ship
|
||||
+ return res[1] if res else '0.99'
|
||||
+
|
||||
def help(self, use_pager=True):
|
||||
"""
|
||||
Deprecated: type 'sage.interfaces.tachyon?' for help
|
|
@ -0,0 +1,36 @@
|
|||
diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
|
||||
index 1c9a53387a0..d96b98f247c 100644
|
||||
--- a/src/sage/arith/long.pxd
|
||||
+++ b/src/sage/arith/long.pxd
|
||||
@@ -270,6 +270,17 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
|
||||
sage: L += [-x for x in L] + [0, long_min()]
|
||||
sage: for v in L:
|
||||
....: assert check_long_py(int(v)) == v
|
||||
+ sage: check_long_py(int(2^60))
|
||||
+ 1152921504606846976 # 64-bit
|
||||
+ 'Overflow (...)' # 32-bit
|
||||
+ sage: check_long_py(int(2^61))
|
||||
+ 2305843009213693952 # 64-bit
|
||||
+ 'Overflow (...)' # 32-bit
|
||||
+ sage: check_long_py(int(2^62))
|
||||
+ 4611686018427387904 # 64-bit
|
||||
+ 'Overflow (...)' # 32-bit
|
||||
+ sage: check_long_py(int(2^63))
|
||||
+ 'Overflow (...)'
|
||||
sage: check_long_py(int(2^100))
|
||||
'Overflow (...)'
|
||||
sage: check_long_py(int(long_max() + 1))
|
||||
@@ -309,7 +320,12 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
|
||||
|
||||
cdef long lead
|
||||
cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
|
||||
- cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
|
||||
+ cdef long lead_3_overflow
|
||||
+ if BITS_IN_LONG < 2 * PyLong_SHIFT:
|
||||
+ # in this case 3 digit is always overflow
|
||||
+ lead_3_overflow = 0
|
||||
+ else:
|
||||
+ lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
|
||||
if size == 0:
|
||||
value[0] = 0
|
||||
err[0] = 0
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/src/sage/schemes/toric/sheaf/klyachko.py b/src/sage/schemes/toric/sheaf/klyachko.py
|
||||
index b1304a16913..77fae4b7545 100644
|
||||
--- a/src/sage/schemes/toric/sheaf/klyachko.py
|
||||
+++ b/src/sage/schemes/toric/sheaf/klyachko.py
|
||||
@@ -26,7 +26,7 @@
|
||||
(0, 0, 18, 16, 1)
|
||||
sage: Gtilde = G_sum.random_deformation()
|
||||
sage: V = Gtilde.wedge(2) * K # long time
|
||||
- sage: V.cohomology(dim=True, weight=(0,0,0,0)) # long time
|
||||
+ sage: V.cohomology(dim=True, weight=(0,0,0,0)) # long time # random failure (see #32773)
|
||||
(0, 0, 3, 0, 0)
|
||||
|
||||
REFERENCES:
|
||||
@@ -948,7 +948,7 @@ def random_deformation(self, epsilon=None):
|
||||
sage: V.cohomology(dim=True, weight=(0,))
|
||||
(1, 0)
|
||||
sage: Vtilde = V.random_deformation()
|
||||
- sage: Vtilde.cohomology(dim=True, weight=(0,))
|
||||
+ sage: Vtilde.cohomology(dim=True, weight=(0,)) # random failure (see #32773)
|
||||
(1, 0)
|
||||
"""
|
||||
filt = self._filt.random_deformation(epsilon)
|
|
@ -0,0 +1,62 @@
|
|||
From 9ac7840134054155545e24fa3e66402d42b91c0f Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Rojas <arojas@archlinux.org>
|
||||
Date: Fri, 20 Jan 2023 21:36:27 +0100
|
||||
Subject: [PATCH] Fix tests with giac 1.9.0.35
|
||||
|
||||
---
|
||||
src/sage/libs/giac/giac.pyx | 3 +--
|
||||
src/sage/symbolic/relation.py | 15 +++++----------
|
||||
2 files changed, 6 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/sage/libs/giac/giac.pyx b/src/sage/libs/giac/giac.pyx
|
||||
index 4e451dba5e7..ccad5169836 100644
|
||||
--- a/src/sage/libs/giac/giac.pyx
|
||||
+++ b/src/sage/libs/giac/giac.pyx
|
||||
@@ -374,8 +374,7 @@ def _giac(s):
|
||||
|
||||
sage: x = libgiac('x')
|
||||
sage: (1+2*sin(3*x)).solve(x).simplify()
|
||||
- Warning, argument is not an equation, solving 1+2*sin(3*x)=0
|
||||
- list[-pi/18,7*pi/18]
|
||||
+ ...list[-pi/18,7*pi/18]
|
||||
|
||||
sage: libgiac.solve('sin(3*x)>2*sin(x)',x)
|
||||
Traceback (most recent call last):
|
||||
diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
|
||||
index e9dbc0fea30..b8896a94be9 100644
|
||||
--- a/src/sage/symbolic/relation.py
|
||||
+++ b/src/sage/symbolic/relation.py
|
||||
@@ -935,8 +935,7 @@ def solve(f, *args, **kwds):
|
||||
|
||||
sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
|
||||
sage: solve(f, x, algorithm='giac')
|
||||
- ...
|
||||
- [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
|
||||
+ ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
|
||||
|
||||
sage: x, y = SR.var('x,y')
|
||||
sage: solve([x+y-4,x*y-3],[x,y],algorithm='giac')
|
||||
@@ -1440,19 +1439,15 @@ def _giac_solver(f, x, solution_dict=False):
|
||||
EXAMPLES::
|
||||
|
||||
sage: solve([(2/3)^x-2], [x], algorithm='giac')
|
||||
- ...
|
||||
- [[-log(2)/(log(3) - log(2))]]
|
||||
+ ...[[-log(2)/(log(3) - log(2))]]
|
||||
sage: solve([(2/3)^x-2], [x], algorithm='giac', solution_dict=True)
|
||||
- ...
|
||||
- [{x: -log(2)/(log(3) - log(2))}]
|
||||
+ ...[{x: -log(2)/(log(3) - log(2))}]
|
||||
|
||||
sage: f = (sin(x) - 8*cos(x)*sin(x))*(sin(x)^2 + cos(x)) - (2*cos(x)*sin(x) - sin(x))*(-2*sin(x)^2 + 2*cos(x)^2 - cos(x))
|
||||
sage: solve(f, x, algorithm='giac')
|
||||
- ...
|
||||
- [-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
|
||||
+ ...[-2*arctan(sqrt(2)), 0, 2*arctan(sqrt(2)), pi]
|
||||
sage: solve(f, x, algorithm='giac', solution_dict=True)
|
||||
- ...
|
||||
- [{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
|
||||
+ ...[{x: -2*arctan(sqrt(2))}, {x: 0}, {x: 2*arctan(sqrt(2))}, {x: pi}]
|
||||
|
||||
sage: x, y = SR.var('x,y')
|
||||
sage: solve([x+y-7,x*y-10],[x,y],algorithm='giac')
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,15 @@
|
|||
diff --git a/src/sage/data_structures/stream.py b/src/sage/data_structures/stream.py
|
||||
index f8f6dc6a186..002e925f02f 100644
|
||||
--- a/src/sage/data_structures/stream.py
|
||||
+++ b/src/sage/data_structures/stream.py
|
||||
@@ -2090,8 +2090,8 @@ def compute_product(self, n, la):
|
||||
sage: f = Stream_exact([1]) # irrelevant for this test
|
||||
sage: g = Stream_function(lambda n: s[n], True, 0)
|
||||
sage: h = Stream_plethysm(f, g, True, p)
|
||||
- sage: B = p[2, 2, 1](sum(s[i] for i in range(7)))
|
||||
- sage: all(h.compute_product(k, Partition([2, 2, 1])) == B.restrict_degree(k) for k in range(7))
|
||||
+ sage: B = p[2, 2, 1](sum(p(s[i]) for i in range(7))) # long time
|
||||
+ sage: all(h.compute_product(k, Partition([2, 2, 1])) == B.restrict_degree(k) for k in range(7)) # long time
|
||||
True
|
||||
"""
|
||||
# This is the approximate order of the result
|
|
@ -0,0 +1,41 @@
|
|||
#! /bin/sh
|
||||
|
||||
URL_BASE_PR="https://github.com/sagemath/sage/pull/"
|
||||
URL_BASE_COMPARE="https://github.com/sagemath/sage/compare/9.8..."
|
||||
|
||||
case "$1" in
|
||||
-n) DO=echo ;;
|
||||
esac
|
||||
|
||||
# get_pr <PR number> <description> [ext]
|
||||
get_pr() {
|
||||
pr=$1
|
||||
desc=$(echo "$2" | sed -e 's/ /_/g')
|
||||
ext=${3-diff}
|
||||
$DO wget "$URL_BASE_PR$pr.$ext" -O "$pr-$desc.patch"
|
||||
}
|
||||
|
||||
get_trac() {
|
||||
ticket=$1
|
||||
desc=$(echo "$2" | sed -e 's/ /_/g')
|
||||
commit=$3
|
||||
$DO wget "$URL_BASE_COMPARE$commit.diff" -O "trac-$ticket-$desc-$commit.patch"
|
||||
}
|
||||
|
||||
# run from patches dir
|
||||
cd $(dirname "$0")
|
||||
|
||||
# merged in 10.0.beta0
|
||||
get_trac 34851 "support singular 4.3.1.p3" 5e5737a0c
|
||||
get_pr 35068 "fix tests giac 1.9.0.35" patch
|
||||
|
||||
# positive review
|
||||
get_pr 34994 "fix tests numpy 1.24"
|
||||
get_pr 34997 "fix edge case of integer_check"
|
||||
get_pr 35058 "skip unstable tests klyachko"
|
||||
get_pr 35094 "support gap 4.12" # includes PR 35093
|
||||
|
||||
# needs review
|
||||
get_pr 34995 "support tachyon 0.99.2"
|
||||
get_pr 34980 "avoid factoring in is_prime"
|
||||
get_pr 35127 "fix very slow test stream.py"
|
|
@ -1,53 +0,0 @@
|
|||
From 6330cee1a69229b2f5d8ac4a09a73d8152f5e14d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
|
||||
Date: Mon, 28 Feb 2022 23:15:16 -0300
|
||||
Subject: trac 33360: avoid factoring in is_prime()
|
||||
|
||||
In the added TEST, the ideal norm is product of two primes but factoring
|
||||
this product takes about half an hour, so factoring the ideal is slow.
|
||||
|
||||
To fix the issue, we only factor the ideal if the norm is a prime power.
|
||||
---
|
||||
src/sage/rings/number_field/number_field_ideal.py | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
|
||||
index f785f22..10d1f88 100644
|
||||
--- a/src/sage/rings/number_field/number_field_ideal.py
|
||||
+++ b/src/sage/rings/number_field/number_field_ideal.py
|
||||
@@ -995,10 +995,32 @@ class NumberFieldIdeal(Ideal_generic):
|
||||
False
|
||||
sage: K.ideal(17).is_prime() # ramified
|
||||
False
|
||||
+
|
||||
+ TESTS::
|
||||
+
|
||||
+ Check that we do not factor the norm of the ideal, this used
|
||||
+ to take half an hour, see :trac:`33360`
|
||||
+
|
||||
+ sage: K.<a,b,c> = NumberField([x^2-2,x^2-3,x^2-5])
|
||||
+ sage: t = (((-2611940*c + 1925290/7653)*b - 1537130/7653*c
|
||||
+ ....: + 10130950)*a + (1343014/7653*c - 8349770)*b
|
||||
+ ....: + 6477058*c - 2801449990/4002519)
|
||||
+ sage: t.is_prime()
|
||||
+ False
|
||||
+
|
||||
"""
|
||||
try:
|
||||
return self._pari_prime is not None
|
||||
except AttributeError:
|
||||
+ K = self.number_field().pari_nf()
|
||||
+ I = self.pari_hnf()
|
||||
+ # This would be better, but it is broken in pari 2.13.3.
|
||||
+ # self._pari_prime = K.idealismaximal(I) or None
|
||||
+ # Instead we factor I, but only if the norm is a prime power
|
||||
+ n = K.idealnorm(I)
|
||||
+ if n.denominator() > 1 or not n.isprimepower():
|
||||
+ self._pari_prime = None
|
||||
+ return False
|
||||
F = self.factor() # factorization with caching
|
||||
if len(F) != 1 or F[0][1] != 1:
|
||||
self._pari_prime = None
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
|
@ -1,427 +0,0 @@
|
|||
From 9feec282d039ca25bbefa50710f8217b775ce111 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
|
||||
Date: Thu, 3 Mar 2022 14:47:00 -0300
|
||||
Subject: gap: do not directly dlopen() the gap library
|
||||
|
||||
This needs the soname (as in sage.env.GAP_SO) which has issues for
|
||||
system gap as explained in #33446.
|
||||
|
||||
Instead we dlopen() the extension module sage.libs.gap.util which,
|
||||
having a link time dependency to libgap, will indirectly dlopen() it.
|
||||
|
||||
For the record: by the time we run dlopen() the libgap should be already
|
||||
loaded. The purpose of doing it is to change mode to RTLD_GLOBAL so that
|
||||
symbols in libgap are placed in the global symbol table. This is
|
||||
required to compiled load gap packages.
|
||||
|
||||
An easy test that this is working ok is:
|
||||
|
||||
sage: libgap.LoadPackage("io")
|
||||
true
|
||||
|
||||
This requires optional spkg `gap_packages` to be installed.
|
||||
---
|
||||
src/sage/libs/gap/util.pyx | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
|
||||
index 344ab88..aff604b 100644
|
||||
--- a/src/sage/libs/gap/util.pyx
|
||||
+++ b/src/sage/libs/gap/util.pyx
|
||||
@@ -13,7 +13,7 @@ Utility functions for GAP
|
||||
#*****************************************************************************
|
||||
|
||||
from libc.signal cimport signal, SIGCHLD, SIG_DFL
|
||||
-from posix.dlfcn cimport dlopen, dlclose, RTLD_NOW, RTLD_GLOBAL
|
||||
+from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
|
||||
|
||||
from cpython.exc cimport PyErr_Fetch, PyErr_Restore
|
||||
from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
|
||||
@@ -232,12 +232,12 @@ cdef initialize():
|
||||
# this isn't portable
|
||||
|
||||
cdef void* handle
|
||||
- libgapname = str_to_bytes(sage.env.GAP_SO)
|
||||
- handle = dlopen(libgapname, RTLD_NOW | RTLD_GLOBAL)
|
||||
+ # reload the current module to force reload of libgap (see #33446)
|
||||
+ lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
|
||||
+ handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
|
||||
if handle is NULL:
|
||||
- raise RuntimeError(
|
||||
- "Could not dlopen() libgap even though it should already "
|
||||
- "be loaded!")
|
||||
+ err = dlerror()
|
||||
+ raise RuntimeError(f"Could not reload gap library with RTLD_GLOBAL ({err})")
|
||||
dlclose(handle)
|
||||
|
||||
# Define argv variable, which we will pass in to
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From 704a7953b97ab726e2af610724726aa562bc8bf8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
|
||||
Date: Thu, 3 Mar 2022 23:00:07 -0300
|
||||
Subject: singular: do not directly dlopen() the singular library
|
||||
|
||||
Same as for gap in the previous commit. Instead of requiring the soname
|
||||
(as in sage.env.LIBSINGULAR_PATH) we dlopen() the extension module
|
||||
sage.libs.singular.singular which will indirectly dlopen() libSingular.
|
||||
---
|
||||
src/sage/libs/singular/singular.pyx | 15 ++++-----------
|
||||
1 file changed, 4 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
|
||||
index d8ea7b0..4beb177 100644
|
||||
--- a/src/sage/libs/singular/singular.pyx
|
||||
+++ b/src/sage/libs/singular/singular.pyx
|
||||
@@ -1705,14 +1705,7 @@ cdef object si2sa_intvec(intvec *v):
|
||||
cdef extern from *: # hack to get at cython macro
|
||||
int unlikely(int)
|
||||
|
||||
-cdef extern from "dlfcn.h":
|
||||
- void *dlopen(char *, long)
|
||||
- char *dlerror()
|
||||
- void dlclose(void *handle)
|
||||
-
|
||||
-cdef extern from "dlfcn.h":
|
||||
- cdef long RTLD_LAZY
|
||||
- cdef long RTLD_GLOBAL
|
||||
+from posix.dlfcn cimport dlopen, dlclose, dlerror, RTLD_LAZY, RTLD_GLOBAL
|
||||
|
||||
cdef int overflow_check(unsigned long e, ring *_ring) except -1:
|
||||
"""
|
||||
@@ -1762,8 +1755,6 @@ cdef init_libsingular():
|
||||
|
||||
cdef void *handle = NULL
|
||||
|
||||
- from sage.env import LIBSINGULAR_PATH
|
||||
- lib = str_to_bytes(LIBSINGULAR_PATH, FS_ENCODING, "surrogateescape")
|
||||
|
||||
# This is a workaround for https://github.com/Singular/Singular/issues/1113
|
||||
# and can be removed once that fix makes it into release of Singular that
|
||||
@@ -1780,10 +1771,12 @@ cdef init_libsingular():
|
||||
|
||||
import platform
|
||||
if not platform.system().startswith("CYGWIN"):
|
||||
+ # reload the current module to force reload of libSingular (see #33446)
|
||||
+ lib = str_to_bytes(__loader__.path, FS_ENCODING, "surrogateescape")
|
||||
handle = dlopen(lib, RTLD_GLOBAL|RTLD_LAZY)
|
||||
if not handle:
|
||||
err = dlerror()
|
||||
- raise ImportError(f"cannot load Singular library from {LIBSINGULAR_PATH} ({err})")
|
||||
+ raise RuntimeError(f"Could not reload Singular library with RTLD_GLOBAL ({err})")
|
||||
|
||||
# load SINGULAR
|
||||
siInit(lib)
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From d7145c14ef58acfbe00d8f941d2802e96ad4ba15 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
|
||||
Date: Fri, 4 Mar 2022 16:37:34 -0300
|
||||
Subject: singular: remove LIBSINGULAR_PATH, no longer needed
|
||||
|
||||
---
|
||||
build/pkgs/singular/spkg-configure.m4 | 63 +----------------------------------
|
||||
pkgs/sage-conf/_sage_conf/_conf.py.in | 3 --
|
||||
src/sage/env.py | 6 ----
|
||||
3 files changed, 1 insertion(+), 71 deletions(-)
|
||||
|
||||
diff --git a/build/pkgs/singular/spkg-configure.m4 b/build/pkgs/singular/spkg-configure.m4
|
||||
index af2eb85..6d3d3da 100644
|
||||
--- a/build/pkgs/singular/spkg-configure.m4
|
||||
+++ b/build/pkgs/singular/spkg-configure.m4
|
||||
@@ -9,52 +9,7 @@ SAGE_SPKG_CONFIGURE([singular], [
|
||||
AC_MSG_CHECKING([that Singular's help is working])
|
||||
AS_IF([test x`printf "system(\"--browser\", \"builtin\"); \n help;" | Singular 2>&1 | grep "error\ occurred"` = x], [
|
||||
AC_MSG_RESULT(yes)
|
||||
- dnl We have Singular. Now determine the shared library path on
|
||||
- dnl platforms on which sage.libs.singular needs to reload the library with RTLD_GLOBAL.
|
||||
- AS_CASE([$host_os],
|
||||
- [cygwin*], [dnl Nothing to do
|
||||
- ],
|
||||
- [dnl Use pkg-config to get singular's libdir while we're at it. As a
|
||||
- dnl moral compromise for using pkg-config, this ultimately allows us
|
||||
- dnl to pass an absolute path to dlopen(), which is the only approach
|
||||
- dnl that POSIX guarantees will work.
|
||||
- PKG_CHECK_VAR([SINGULAR_LIB_DIR], [Singular], [libdir])
|
||||
- dnl The acl_shlibext variable is set in the top-level configure.ac.
|
||||
- AC_LANG_PUSH(C)
|
||||
- ORIG_LIBS="${LIBS}"
|
||||
- LIBS="${LIBS} -ldl"
|
||||
- AC_MSG_CHECKING([if we can dlopen($LIBSINGULAR_PATH)])
|
||||
- LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libSingular.${acl_shlibext}"
|
||||
-
|
||||
- dnl if we can dlopen() it, substitute the name for sage_conf;
|
||||
- dnl otherwise, fall back to using the SPKG.
|
||||
- AC_RUN_IFELSE(
|
||||
- [AC_LANG_PROGRAM(
|
||||
- [[#include <dlfcn.h>]],
|
||||
- [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
|
||||
- if (h == 0) { return 1; } else { return dlclose(h); }]]
|
||||
- )], [
|
||||
- AC_MSG_RESULT(yes)
|
||||
- ], [
|
||||
- dnl try Debian-specific name
|
||||
- LIBSINGULAR_PATH="${SINGULAR_LIB_DIR}/libsingular-Singular.${acl_shlibext}"
|
||||
- AC_RUN_IFELSE(
|
||||
- [AC_LANG_PROGRAM(
|
||||
- [[#include <dlfcn.h>]],
|
||||
- [[void* h = dlopen("${LIBSINGULAR_PATH}", RTLD_LAZY | RTLD_GLOBAL);
|
||||
- if (h == 0) { return 1; } else { return dlclose(h); }]]
|
||||
- )], [
|
||||
- AC_MSG_RESULT(yes)
|
||||
- ], [
|
||||
- AC_MSG_RESULT(no)
|
||||
- sage_spkg_install_singular=yes
|
||||
- ], [AC_MSG_RESULT(yes)])
|
||||
- ], [AC_MSG_RESULT(yes)])
|
||||
-
|
||||
- AC_LANG_POP()
|
||||
- LIBS="${ORIG_LIBS}"
|
||||
- ]
|
||||
- )], [
|
||||
+ ], [
|
||||
AC_MSG_RESULT(no)
|
||||
sage_spkg_install_singular=yes
|
||||
]
|
||||
@@ -64,20 +19,4 @@ SAGE_SPKG_CONFIGURE([singular], [
|
||||
])
|
||||
])
|
||||
])
|
||||
-],[],[],[
|
||||
- dnl Post-check phase
|
||||
- dnl We make the sage_conf substitutions here, because the "default"
|
||||
- dnl substitution needs to be made even if we skipped the system-Singular
|
||||
- dnl checks themselves.
|
||||
- AS_IF([test "x${sage_spkg_install_singular}" = "xyes"], [
|
||||
- AS_CASE([$host_os],
|
||||
- [cygwin*], [dnl Nothing to do
|
||||
- ],
|
||||
- [dnl Set shared library path, needed for reloading the library with RTLD_GLOBAL
|
||||
- LIBSINGULAR_PATH="\$SAGE_LOCAL/lib/libSingular.${acl_shlibext}"
|
||||
- ]
|
||||
- )
|
||||
- ])
|
||||
-
|
||||
- AC_SUBST(LIBSINGULAR_PATH, "${LIBSINGULAR_PATH}")
|
||||
])
|
||||
diff --git a/pkgs/sage-conf/_sage_conf/_conf.py.in b/pkgs/sage-conf/_sage_conf/_conf.py.in
|
||||
index 6cd28f5..d66bdb3 100644
|
||||
--- a/pkgs/sage-conf/_sage_conf/_conf.py.in
|
||||
+++ b/pkgs/sage-conf/_sage_conf/_conf.py.in
|
||||
@@ -55,9 +55,6 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"
|
||||
OPENMP_CFLAGS = "@OPENMP_CFLAGS@"
|
||||
OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"
|
||||
|
||||
-# The full absolute path to the main Singular library.
|
||||
-LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)
|
||||
-
|
||||
# Installation location of wheels. This is determined at configuration time
|
||||
# and does not depend on the installation location of sage-conf.
|
||||
SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels"
|
||||
diff --git a/src/sage/env.py b/src/sage/env.py
|
||||
index 911f34b..93f79de 100644
|
||||
--- a/src/sage/env.py
|
||||
+++ b/src/sage/env.py
|
||||
@@ -229,12 +229,6 @@ NTL_LIBDIR = var("NTL_LIBDIR")
|
||||
LIE_INFO_DIR = var("LIE_INFO_DIR", join(SAGE_LOCAL, "lib", "LiE"))
|
||||
SINGULAR_BIN = var("SINGULAR_BIN") or "Singular"
|
||||
|
||||
-# The path to libSingular, to be passed to dlopen(). This will
|
||||
-# typically be set to an absolute path in sage_conf, but the relative
|
||||
-# fallback path here works on systems where dlopen() searches the
|
||||
-# system's library locations.
|
||||
-LIBSINGULAR_PATH = var("LIBSINGULAR_PATH", "libSingular.so")
|
||||
-
|
||||
# OpenMP
|
||||
OPENMP_CFLAGS = var("OPENMP_CFLAGS", "")
|
||||
OPENMP_CXXFLAGS = var("OPENMP_CXXFLAGS", "")
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From 92e5a211c792f86f5325d601abfddf667da6a776 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
|
||||
Date: Fri, 4 Mar 2022 15:49:26 -0300
|
||||
Subject: Revert "src/sage/interfaces/gap_workspace.py: Use hash of GAP_SO to
|
||||
disambiguate the workspace file, not SAGE_LOCAL"
|
||||
|
||||
This reverts commit a801e6d85bd420b60ea75b1671856eb43ac6b18b.
|
||||
|
||||
See #33446.
|
||||
---
|
||||
src/sage/interfaces/gap_workspace.py | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
|
||||
index 33a87dd..953dc85 100644
|
||||
--- a/src/sage/interfaces/gap_workspace.py
|
||||
+++ b/src/sage/interfaces/gap_workspace.py
|
||||
@@ -16,7 +16,7 @@ Support for (lib)GAP workspace files
|
||||
import os
|
||||
import time
|
||||
import hashlib
|
||||
-from sage.env import DOT_SAGE, GAP_SO
|
||||
+from sage.env import DOT_SAGE, SAGE_LOCAL
|
||||
|
||||
|
||||
def gap_workspace_file(system="gap", name="workspace", dir=None):
|
||||
@@ -59,10 +59,7 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
|
||||
if dir is None:
|
||||
dir = os.path.join(DOT_SAGE, 'gap')
|
||||
|
||||
- if GAP_SO:
|
||||
- h = hashlib.sha1(GAP_SO.encode('utf-8')).hexdigest()
|
||||
- else:
|
||||
- h = 'unknown'
|
||||
+ h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
|
||||
return os.path.join(dir, '%s-%s-%s' % (system, name, h))
|
||||
|
||||
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From b45e555b5711ae10d369b568333940c2aa771053 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
|
||||
Date: Fri, 4 Mar 2022 16:38:49 -0300
|
||||
Subject: gap: remove GAP_SO, no longer needed
|
||||
|
||||
---
|
||||
src/sage/env.py | 75 ---------------------------------------------------------
|
||||
1 file changed, 75 deletions(-)
|
||||
|
||||
diff --git a/src/sage/env.py b/src/sage/env.py
|
||||
index 93f79de..c16a094 100644
|
||||
--- a/src/sage/env.py
|
||||
+++ b/src/sage/env.py
|
||||
@@ -249,81 +249,6 @@ if SAGE_GAP_MEMORY is not None:
|
||||
SAGE_GAP_COMMAND = var('SAGE_GAP_COMMAND', _gap_cmd)
|
||||
|
||||
|
||||
-def _get_shared_lib_path(*libnames: str) -> Optional[str]:
|
||||
- """
|
||||
- Return the full path to a shared library file installed in
|
||||
- ``$SAGE_LOCAL/lib`` or the directories associated with the
|
||||
- Python sysconfig.
|
||||
-
|
||||
- This can also be passed more than one library name (e.g. for cases where
|
||||
- some library may have multiple names depending on the platform) in which
|
||||
- case the first one found is returned.
|
||||
-
|
||||
- This supports most *NIX variants (in which ``lib<libname>.so`` is found
|
||||
- under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
|
||||
- extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
|
||||
- or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
|
||||
-
|
||||
- For distributions like Debian that use a multiarch layout, we also try the
|
||||
- multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
|
||||
-
|
||||
- This returns ``None`` if no matching library file could be found.
|
||||
-
|
||||
- EXAMPLES::
|
||||
-
|
||||
- sage: from sage.env import _get_shared_lib_path
|
||||
- sage: "gap" in _get_shared_lib_path("gap")
|
||||
- True
|
||||
- sage: _get_shared_lib_path("an_absurd_lib") is None
|
||||
- True
|
||||
-
|
||||
- """
|
||||
-
|
||||
- for libname in libnames:
|
||||
- search_directories: List[Path] = []
|
||||
- patterns: List[str] = []
|
||||
- if sys.platform == 'cygwin':
|
||||
- # Later down we take the first matching DLL found, so search
|
||||
- # SAGE_LOCAL first so that it takes precedence
|
||||
- if SAGE_LOCAL:
|
||||
- search_directories.append(Path(SAGE_LOCAL) / 'bin')
|
||||
- search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
|
||||
- # Note: The following is not very robust, since if there are multible
|
||||
- # versions for the same library this just selects one more or less
|
||||
- # at arbitrary. However, practically speaking, on Cygwin, there
|
||||
- # will only ever be one version
|
||||
- patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
|
||||
- else:
|
||||
- if sys.platform == 'darwin':
|
||||
- ext = 'dylib'
|
||||
- else:
|
||||
- ext = 'so'
|
||||
-
|
||||
- if SAGE_LOCAL:
|
||||
- search_directories.append(Path(SAGE_LOCAL) / 'lib')
|
||||
- libdir = sysconfig.get_config_var('LIBDIR')
|
||||
- if libdir is not None:
|
||||
- libdir = Path(libdir)
|
||||
- search_directories.append(libdir)
|
||||
-
|
||||
- multiarchlib = sysconfig.get_config_var('MULTIARCH')
|
||||
- if multiarchlib is not None:
|
||||
- search_directories.append(libdir / multiarchlib),
|
||||
-
|
||||
- patterns = [f'lib{libname}.{ext}']
|
||||
-
|
||||
- for directory in search_directories:
|
||||
- for pattern in patterns:
|
||||
- path = next(directory.glob(pattern), None)
|
||||
- if path is not None:
|
||||
- return str(path.resolve())
|
||||
-
|
||||
- # Just return None if no files were found
|
||||
- return None
|
||||
-
|
||||
-# locate libgap shared object
|
||||
-GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
|
||||
-
|
||||
# post process
|
||||
if DOT_SAGE is not None and ' ' in DOT_SAGE:
|
||||
if UNAME[:6] == 'CYGWIN':
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From 31e3fc4ec8b8687bccd22d2e3161c86cf5553e06 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
|
||||
Date: Sun, 6 Mar 2022 12:10:37 -0300
|
||||
Subject: gap_workspace_file: include hostname and gap version
|
||||
|
||||
---
|
||||
src/sage/interfaces/gap_workspace.py | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/sage/interfaces/gap_workspace.py b/src/sage/interfaces/gap_workspace.py
|
||||
index 953dc85..8c03b6b 100644
|
||||
--- a/src/sage/interfaces/gap_workspace.py
|
||||
+++ b/src/sage/interfaces/gap_workspace.py
|
||||
@@ -16,7 +16,8 @@ Support for (lib)GAP workspace files
|
||||
import os
|
||||
import time
|
||||
import hashlib
|
||||
-from sage.env import DOT_SAGE, SAGE_LOCAL
|
||||
+import subprocess
|
||||
+from sage.env import DOT_SAGE, SAGE_LOCAL, HOSTNAME, GAP_ROOT_DIR
|
||||
|
||||
|
||||
def gap_workspace_file(system="gap", name="workspace", dir=None):
|
||||
@@ -59,8 +60,12 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
|
||||
if dir is None:
|
||||
dir = os.path.join(DOT_SAGE, 'gap')
|
||||
|
||||
- h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
|
||||
- return os.path.join(dir, '%s-%s-%s' % (system, name, h))
|
||||
+ data = SAGE_LOCAL
|
||||
+ sysinfo = os.path.join(GAP_ROOT_DIR, "sysinfo.gap")
|
||||
+ if os.path.exists(sysinfo):
|
||||
+ data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
|
||||
+ h = hashlib.sha1(data.encode('utf-8')).hexdigest()
|
||||
+ return os.path.join(dir, '%s-%s-%s-%s' % (system, name, HOSTNAME, h))
|
||||
|
||||
|
||||
def prepare_workspace_dir(dir=None):
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
From de38bac21e276c6dba95b8b33f7457a0ac56bdeb Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
|
||||
Date: Tue, 25 Oct 2022 19:43:53 -0700
|
||||
Subject: [PATCH] src/sage: Apply python-3.11.patch from
|
||||
https://github.com/void-linux/void-packages/commit/6229f313450ecae88743b4d5e99da2ed4de44e07
|
||||
|
||||
---
|
||||
src/sage/cpython/cython_metaclass.h | 2 +-
|
||||
src/sage/libs/gmp/pylong.pyx | 8 +++-----
|
||||
src/sage/symbolic/ginac/numeric.cpp | 1 -
|
||||
3 files changed, 4 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/sage/cpython/cython_metaclass.h b/src/sage/cpython/cython_metaclass.h
|
||||
index cc620a4dac7..6487342b71e 100644
|
||||
--- a/src/sage/cpython/cython_metaclass.h
|
||||
+++ b/src/sage/cpython/cython_metaclass.h
|
||||
@@ -66,7 +66,7 @@ static CYTHON_INLINE int Sage_PyType_Ready(PyTypeObject* t)
|
||||
}
|
||||
|
||||
/* Now, set t.__class__ to metaclass */
|
||||
- Py_TYPE(t) = metaclass;
|
||||
+ Py_SET_TYPE(t, metaclass);
|
||||
PyType_Modified(t);
|
||||
}
|
||||
else
|
||||
diff --git a/src/sage/libs/gmp/pylong.pyx b/src/sage/libs/gmp/pylong.pyx
|
||||
index 388be32c55e..e772b60e3e0 100644
|
||||
--- a/src/sage/libs/gmp/pylong.pyx
|
||||
+++ b/src/sage/libs/gmp/pylong.pyx
|
||||
@@ -32,7 +32,7 @@ from cpython.longintrepr cimport _PyLong_New, py_long, digit, PyLong_SHIFT
|
||||
from .mpz cimport *
|
||||
|
||||
cdef extern from *:
|
||||
- Py_ssize_t* Py_SIZE_PTR "&Py_SIZE"(object)
|
||||
+ void Py_SET_SIZE(object, Py_ssize_t)
|
||||
int hash_bits """
|
||||
#ifdef _PyHASH_BITS
|
||||
_PyHASH_BITS /* Python 3 */
|
||||
@@ -57,10 +57,8 @@ cdef mpz_get_pylong_large(mpz_srcptr z):
|
||||
mpz_export(L.ob_digit, NULL,
|
||||
-1, sizeof(digit), 0, PyLong_nails, z)
|
||||
if mpz_sgn(z) < 0:
|
||||
- # Set correct size (use a pointer to hack around Cython's
|
||||
- # non-support for lvalues).
|
||||
- sizeptr = Py_SIZE_PTR(L)
|
||||
- sizeptr[0] = -pylong_size
|
||||
+ # Set correct size
|
||||
+ Py_SET_SIZE(L, -pylong_size)
|
||||
return L
|
||||
|
||||
|
||||
diff --git a/src/sage/symbolic/ginac/numeric.cpp b/src/sage/symbolic/ginac/numeric.cpp
|
||||
index 22060441760..b40ed64edb5 100644
|
||||
--- a/src/sage/symbolic/ginac/numeric.cpp
|
||||
+++ b/src/sage/symbolic/ginac/numeric.cpp
|
||||
@@ -52,7 +52,6 @@
|
||||
#define register
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include <Python.h>
|
||||
-#include <longintrepr.h>
|
||||
#include "flint/fmpz.h"
|
||||
#include "flint/fmpz_factor.h"
|
||||
|
||||
--
|
||||
2.38.1
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
From 9eb08f3afde3266bbd667e196513240a0fe245f4 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
|
||||
Date: Tue, 25 Oct 2022 22:52:56 -0700
|
||||
Subject: [PATCH] inspect.ArgSpec -> inspect.FullArgSpec
|
||||
|
||||
---
|
||||
src/sage/misc/cachefunc.pyx | 4 ++--
|
||||
src/sage/misc/decorators.py | 6 ++++--
|
||||
src/sage/misc/function_mangling.pyx | 2 +-
|
||||
src/sage/misc/sageinspect.py | 24 +++++++++++++-----------
|
||||
4 files changed, 20 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx
|
||||
index 9fa967ce737..72042ef13d6 100644
|
||||
--- a/src/sage/misc/cachefunc.pyx
|
||||
+++ b/src/sage/misc/cachefunc.pyx
|
||||
@@ -2818,7 +2818,7 @@ cdef class CachedMethod():
|
||||
except Exception:
|
||||
pass
|
||||
if self.nargs == 0:
|
||||
- args, varargs, keywords, defaults = sage_getargspec(f)
|
||||
+ args, varargs, keywords, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
|
||||
if varargs is None and keywords is None and len(args)<=1:
|
||||
self.nargs = 1
|
||||
else:
|
||||
@@ -2954,7 +2954,7 @@ cdef class CachedSpecialMethod(CachedMethod):
|
||||
# we need to analyse the argspec
|
||||
f = self._cachedfunc.f
|
||||
if self.nargs == 0:
|
||||
- args, varargs, keywords, defaults = sage_getargspec(f)
|
||||
+ args, varargs, keywords, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
|
||||
if varargs is None and keywords is None and len(args)<=1:
|
||||
self.nargs = 1
|
||||
Caller = CachedMethodCallerNoArgs(inst, f, name=name, do_pickle=self._cachedfunc.do_pickle)
|
||||
diff --git a/src/sage/misc/decorators.py b/src/sage/misc/decorators.py
|
||||
index 28c52448813..311a5105739 100644
|
||||
--- a/src/sage/misc/decorators.py
|
||||
+++ b/src/sage/misc/decorators.py
|
||||
@@ -32,7 +32,8 @@ from copy import copy
|
||||
|
||||
from sage.misc.sageinspect import (sage_getsource, sage_getsourcelines,
|
||||
sage_getargspec)
|
||||
-from inspect import ArgSpec
|
||||
+
|
||||
+from inspect import FullArgSpec
|
||||
|
||||
|
||||
def sage_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
|
||||
@@ -499,7 +500,8 @@ class options():
|
||||
list(self.options))
|
||||
defaults = (argspec.defaults or ()) + tuple(self.options.values())
|
||||
# Note: argspec.defaults is not always a tuple for some reason
|
||||
- return ArgSpec(args, argspec.varargs, argspec.keywords, defaults)
|
||||
+ return FullArgSpec(args, argspec.varargs, argspec.keywords, defaults,
|
||||
+ kwonlyargs=[], kwonlydefaults={}, annotations={})
|
||||
|
||||
wrapper._sage_argspec_ = argspec
|
||||
|
||||
diff --git a/src/sage/misc/function_mangling.pyx b/src/sage/misc/function_mangling.pyx
|
||||
index 0ac03cf0715..e1bb7978953 100644
|
||||
--- a/src/sage/misc/function_mangling.pyx
|
||||
+++ b/src/sage/misc/function_mangling.pyx
|
||||
@@ -116,7 +116,7 @@ cdef class ArgumentFixer:
|
||||
"""
|
||||
def __init__(self, f, classmethod = False):
|
||||
try:
|
||||
- arg_names, varargs, varkw, defaults = sage_getargspec(f)
|
||||
+ arg_names, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations = sage_getargspec(f)
|
||||
except AttributeError:
|
||||
# This error occurs if f is defined in a Cython file and the
|
||||
# source file has gone.
|
||||
diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
|
||||
index fbca2defc20..a3821cb56b9 100644
|
||||
--- a/src/sage/misc/sageinspect.py
|
||||
+++ b/src/sage/misc/sageinspect.py
|
||||
@@ -359,7 +359,7 @@ def _extract_embedded_signature(docstring, name):
|
||||
docstring = L[1] if len(L) > 1 else '' # Remove first line, keep the rest
|
||||
def_string = "def " + name + signature + ": pass"
|
||||
try:
|
||||
- return docstring, inspect.ArgSpec(*_sage_getargspec_cython(def_string))
|
||||
+ return docstring, inspect.FullArgSpec(*_sage_getargspec_cython(def_string))
|
||||
except SyntaxError:
|
||||
docstring = os.linesep.join(L)
|
||||
return docstring, None
|
||||
@@ -1135,8 +1135,9 @@ def _sage_getargspec_from_ast(source):
|
||||
vararg = getattr(ast_args.vararg, 'arg', None)
|
||||
kwarg = getattr(ast_args.kwarg, 'arg', None)
|
||||
|
||||
- return inspect.ArgSpec(args, vararg, kwarg,
|
||||
- tuple(defaults) if defaults else None)
|
||||
+ return inspect.FullArgSpec(args, vararg, kwarg,
|
||||
+ tuple(defaults) if defaults else None,
|
||||
+ kwonlyargs=[], kwonlydefaults={}, annotations={})
|
||||
|
||||
|
||||
def _sage_getargspec_cython(source):
|
||||
@@ -1152,7 +1153,7 @@ def _sage_getargspec_cython(source):
|
||||
|
||||
OUTPUT:
|
||||
|
||||
- - an instance of :obj:`inspect.ArgSpec`, i.e., a named tuple
|
||||
+ - an instance of :class:`inspect.FullArgSpec`, i.e., a named tuple
|
||||
|
||||
EXAMPLES::
|
||||
|
||||
@@ -1662,11 +1663,11 @@ def sage_getargspec(obj):
|
||||
return sage_getargspec(obj.__call__)
|
||||
if isinstance(obj, (lazy_attribute, AbstractMethod)):
|
||||
source = sage_getsource(obj)
|
||||
- return inspect.ArgSpec(*_sage_getargspec_cython(source))
|
||||
+ return inspect.FullArgSpec(*_sage_getargspec_cython(source))
|
||||
if not callable(obj):
|
||||
raise TypeError("obj is not a code object")
|
||||
try:
|
||||
- return inspect.ArgSpec(*obj._sage_argspec_())
|
||||
+ return inspect.FullArgSpec(*obj._sage_argspec_())
|
||||
except (AttributeError, TypeError):
|
||||
pass
|
||||
# If we are lucky, the function signature is embedded in the docstring.
|
||||
@@ -1682,7 +1683,7 @@ def sage_getargspec(obj):
|
||||
# Note that this may give a wrong result for the constants!
|
||||
try:
|
||||
args, varargs, varkw = inspect.getargs(obj.__code__)
|
||||
- return inspect.ArgSpec(args, varargs, varkw, obj.__defaults__)
|
||||
+ return inspect.FullArgSpec(args, varargs, varkw, obj.__defaults__)
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
if isclassinstance(obj):
|
||||
@@ -1717,7 +1718,7 @@ def sage_getargspec(obj):
|
||||
except TypeError: # happens for Python builtins
|
||||
source = ''
|
||||
if source:
|
||||
- return inspect.ArgSpec(*_sage_getargspec_cython(source))
|
||||
+ return inspect.FullArgSpec(*_sage_getargspec_cython(source))
|
||||
else:
|
||||
func_obj = obj
|
||||
|
||||
@@ -1730,7 +1731,7 @@ def sage_getargspec(obj):
|
||||
except TypeError: # arg is not a code object
|
||||
# The above "hopefully" was wishful thinking:
|
||||
try:
|
||||
- return inspect.ArgSpec(*_sage_getargspec_cython(sage_getsource(obj)))
|
||||
+ return inspect.FullArgSpec(*_sage_getargspec_cython(sage_getsource(obj)))
|
||||
except TypeError: # This happens for Python builtins
|
||||
# The best we can do is to return a generic argspec
|
||||
args = []
|
||||
@@ -1740,7 +1741,8 @@ def sage_getargspec(obj):
|
||||
defaults = func_obj.__defaults__
|
||||
except AttributeError:
|
||||
defaults = None
|
||||
- return inspect.ArgSpec(args, varargs, varkw, defaults)
|
||||
+ return inspect.FullArgSpec(args, varargs, varkw, defaults,
|
||||
+ kwonlyargs=[], kwonlydefaults={}, annotations={})
|
||||
|
||||
|
||||
def formatannotation(annotation, base_module=None):
|
||||
@@ -1811,7 +1813,7 @@ def sage_formatargspec(args, varargs=None, varkw=None, defaults=None,
|
||||
:func:`sage_getargspec`. Since :func:`sage_getargspec` works for
|
||||
Cython functions while Python's inspect module does not, it makes
|
||||
sense to keep this function for formatting instances of
|
||||
- ``inspect.ArgSpec``.
|
||||
+ ``inspect.FullArgSpec``.
|
||||
|
||||
EXAMPLES::
|
||||
|
||||
--
|
||||
2.38.1
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,212 +0,0 @@
|
|||
diff --git a/src/sage/arith/long.pxd b/src/sage/arith/long.pxd
|
||||
index b0c80f61480..1c9a53387a0 100644
|
||||
--- a/src/sage/arith/long.pxd
|
||||
+++ b/src/sage/arith/long.pxd
|
||||
@@ -124,7 +124,7 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
|
||||
....: if err == 0:
|
||||
....: return value
|
||||
....: elif err == ERR_OVERFLOW:
|
||||
- ....: raise OverflowError("integer_check_long: overflow")
|
||||
+ ....: raise OverflowError(f"integer_check_long: overflow ({x})")
|
||||
....: elif err == ERR_TYPE:
|
||||
....: raise TypeError("integer_check_long: wrong type")
|
||||
....: elif err == ERR_INDEX:
|
||||
@@ -136,24 +136,23 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
|
||||
....: def long_max():
|
||||
....: return smallInteger(LONG_MAX)
|
||||
....: ''')
|
||||
- sage: types = (ZZ, QQ, int)
|
||||
sage: L = [1, 12345, 10^9, 2^30, long_max()//9, long_max()//3, long_max()]
|
||||
sage: L += [-x for x in L] + [0, long_min()]
|
||||
sage: for v in L:
|
||||
- ....: for t in (Integer, int):
|
||||
+ ....: for t in (Integer, int, QQ):
|
||||
....: assert check_long(t(v)) == v
|
||||
sage: check_long(2^100)
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
- OverflowError: integer_check_long: overflow
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
sage: check_long(long_max() + 1)
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
- OverflowError: integer_check_long: overflow
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
sage: check_long(long_min() - 1)
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
- OverflowError: integer_check_long: overflow
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
sage: check_long("hello")
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
@@ -162,6 +161,36 @@ cdef inline bint integer_check_long(x, long* value, int* err) except -1:
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
TypeError: integer_check_long: bad __index__
|
||||
+
|
||||
+ Repeat the overflow tests with python integers:
|
||||
+
|
||||
+ sage: check_long(int(2^100))
|
||||
+ Traceback (most recent call last):
|
||||
+ ...
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
+ sage: check_long(int(long_max() + 1))
|
||||
+ Traceback (most recent call last):
|
||||
+ ...
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
+ sage: check_long(int(long_min() - 1))
|
||||
+ Traceback (most recent call last):
|
||||
+ ...
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
+
|
||||
+ And again with rationals:
|
||||
+
|
||||
+ sage: check_long(QQ(2^100))
|
||||
+ Traceback (most recent call last):
|
||||
+ ...
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
+ sage: check_long(QQ(long_max() + 1))
|
||||
+ Traceback (most recent call last):
|
||||
+ ...
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
+ sage: check_long(QQ(long_min() - 1))
|
||||
+ Traceback (most recent call last):
|
||||
+ ...
|
||||
+ OverflowError: integer_check_long: overflow (...)
|
||||
"""
|
||||
cdef int c = integer_check_long_py(x, value, err)
|
||||
if c:
|
||||
@@ -193,35 +222,93 @@ cdef inline long dig(const digit* D, int n):
|
||||
|
||||
cdef inline bint integer_check_long_py(x, long* value, int* err):
|
||||
"""
|
||||
- Part of ``integer_check_long`` in ``long.pxd``, checking only for
|
||||
- Python objects of type ``int`` and ``long``. See that function for
|
||||
- documentation and tests.
|
||||
+ Return whether ``x`` is a python object of type ``int``.
|
||||
+
|
||||
+ If possible, compute the value of this integer as C long and store
|
||||
+ it in ``*value``.
|
||||
+
|
||||
+ Errors are returned as an error indicator ``*err`` (without raising
|
||||
+ any Python exception).
|
||||
+
|
||||
+ Possible errors when returning ``True``:
|
||||
+
|
||||
+ - ``0``: ``x`` was successfully converted to a C long and its value
|
||||
+ is stored in ``*value``.
|
||||
+
|
||||
+ - ``ERR_OVERFLOW``: ``x`` is a python object of type ``int`` but
|
||||
+ too large to store in a C long.
|
||||
+
|
||||
+ Possible errors when returning ``False``:
|
||||
+
|
||||
+ - ``ERR_TYPE``: ``x`` is not a python object of type ``int``.
|
||||
+
|
||||
+ EXAMPLES:
|
||||
+
|
||||
+ We create a pure Python wrapper of this function::
|
||||
+
|
||||
+ sage: cython(''' # optional - sage.misc.cython
|
||||
+ ....: from sage.arith.long cimport *
|
||||
+ ....: def check_long_py(x):
|
||||
+ ....: cdef long value
|
||||
+ ....: cdef int err
|
||||
+ ....: cdef bint c = integer_check_long_py(x, &value, &err)
|
||||
+ ....: if c:
|
||||
+ ....: if err == 0:
|
||||
+ ....: return value
|
||||
+ ....: elif err == ERR_OVERFLOW:
|
||||
+ ....: return f"Overflow ({x})"
|
||||
+ ....: elif err == ERR_TYPE:
|
||||
+ ....: return f"Bad type ({x})"
|
||||
+ ....: return f"This should never happen ({x})"
|
||||
+ ....: from libc.limits cimport LONG_MIN, LONG_MAX
|
||||
+ ....: def long_min():
|
||||
+ ....: return LONG_MIN
|
||||
+ ....: def long_max():
|
||||
+ ....: return LONG_MAX
|
||||
+ ....: ''')
|
||||
+ sage: L = [1, 12345, 10^9, 2^30, long_max()//9, long_max()//3, long_max()]
|
||||
+ sage: L += [-x for x in L] + [0, long_min()]
|
||||
+ sage: for v in L:
|
||||
+ ....: assert check_long_py(int(v)) == v
|
||||
+ sage: check_long_py(int(2^100))
|
||||
+ 'Overflow (...)'
|
||||
+ sage: check_long_py(int(long_max() + 1))
|
||||
+ 'Overflow (...)'
|
||||
+ sage: check_long_py(int(long_min() - 1))
|
||||
+ 'Overflow (...)'
|
||||
+ sage: check_long_py(389)
|
||||
+ 'Bad type (...)'
|
||||
+ sage: check_long_py("hello")
|
||||
+ 'Bad type (...)'
|
||||
+ sage: check_long_py(2/3)
|
||||
+ 'Bad type (...)'
|
||||
"""
|
||||
- if not isinstance(x, long):
|
||||
- if isinstance(x, int):
|
||||
- # This can happen only on Python 2
|
||||
- value[0] = PyInt_AS_LONG(x)
|
||||
- err[0] = 0
|
||||
- return 1
|
||||
+ if not isinstance(x, int):
|
||||
err[0] = ERR_TYPE
|
||||
return 0
|
||||
|
||||
- # x is a Python "long" (called "int" on Python 3)
|
||||
+ # x is a Python "int" (aka PyLongObject or py_long in cython)
|
||||
cdef const digit* D = (<py_long>x).ob_digit
|
||||
cdef Py_ssize_t size = Py_SIZE(x)
|
||||
|
||||
- # We assume that PyLong_SHIFT is 15 on a 32-bit system and 30 on a
|
||||
- # 64-bit system. This is not guaranteed by Python, but it is the
|
||||
- # default configuration.
|
||||
+ # We assume PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT.
|
||||
+ # This is true in all the default configurations:
|
||||
+ # - BITS_IN_LONG = 63, PyLong_SHIFT = 30
|
||||
+ # - BITS_IN_LONG = 31, PyLong_SHIFT = 15 (python <= 3.10)
|
||||
+ # - BITS_IN_LONG = 31, PyLong_SHIFT = 30 (new in python 3.11)
|
||||
+ # cf. https://trac.sagemath.org/ticket/33842#comment:130
|
||||
#
|
||||
- # This way, we know that 1 and 2 digits certainly fit in a C long
|
||||
- # and 4 or more digits never fit. For 3 digits, we need an explicit
|
||||
- # overflow check.
|
||||
+ # This way, we know that 1 digit certainly fits in a C long
|
||||
+ # and 4 or more digits never fit.
|
||||
+ # For 2 or 3 digits, we need an explicit overflow check.
|
||||
cdef int BITS_IN_LONG = 8 * sizeof(long) - 1
|
||||
- if not (2 * PyLong_SHIFT <= BITS_IN_LONG < 4 * PyLong_SHIFT):
|
||||
- raise AssertionError
|
||||
+ if not (PyLong_SHIFT <= BITS_IN_LONG <= 3 * PyLong_SHIFT):
|
||||
+ raise AssertionError(
|
||||
+ f"PyLong_SHIFT = {PyLong_SHIFT}, "
|
||||
+ f"BITS_IN_LONG = {BITS_IN_LONG}")
|
||||
|
||||
cdef long lead
|
||||
+ cdef long lead_2_overflow = (<long>1) << (BITS_IN_LONG - PyLong_SHIFT)
|
||||
cdef long lead_3_overflow = (<long>1) << (BITS_IN_LONG - 2 * PyLong_SHIFT)
|
||||
if size == 0:
|
||||
value[0] = 0
|
||||
@@ -233,9 +320,20 @@ cdef inline bint integer_check_long_py(x, long* value, int* err):
|
||||
value[0] = -dig(D, 0)
|
||||
err[0] = 0
|
||||
elif size == 2:
|
||||
+ if BITS_IN_LONG < 2 * PyLong_SHIFT and D[1] >= lead_2_overflow:
|
||||
+ err[0] = ERR_OVERFLOW
|
||||
+ return 1
|
||||
value[0] = dig(D, 0) + dig(D, 1)
|
||||
err[0] = 0
|
||||
elif size == -2:
|
||||
+ if BITS_IN_LONG < 2 * PyLong_SHIFT and D[1] >= lead_2_overflow:
|
||||
+ if D[0] == 0 and D[1] == lead_2_overflow:
|
||||
+ # Special case for LONG_MIN
|
||||
+ value[0] = (<long>-1) << BITS_IN_LONG
|
||||
+ err[0] = 0
|
||||
+ else:
|
||||
+ err[0] = ERR_OVERFLOW
|
||||
+ return 1
|
||||
value[0] = -(dig(D, 0) + dig(D, 1))
|
||||
err[0] = 0
|
||||
elif size == 3:
|
|
@ -1,42 +0,0 @@
|
|||
commit 5db5d4e56243c609f44afc1f21c112b026f9e1fe
|
||||
Author: Oscar Benjamin <oscar.j.benjamin@gmail.com>
|
||||
Date: Mon Jul 11 21:24:01 2022 +0100
|
||||
|
||||
Update doctests for SymPy 1.11
|
||||
|
||||
Doctests related to SymPy's rsolve function are updated in:
|
||||
|
||||
src/sage/calculus/test_sympy.py
|
||||
src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
|
||||
|
||||
The form of the output from SymPy has changed since
|
||||
|
||||
https://github.com/sympy/sympy/pull/23567
|
||||
|
||||
diff --git a/src/sage/calculus/test_sympy.py b/src/sage/calculus/test_sympy.py
|
||||
index 7cf7f3f6bfd..927e6ee4fb6 100644
|
||||
--- a/src/sage/calculus/test_sympy.py
|
||||
+++ b/src/sage/calculus/test_sympy.py
|
||||
@@ -193,7 +193,7 @@ This was fixed in Sympy, see :trac:`14437`::
|
||||
sage: u = Function('u')
|
||||
sage: n = Symbol('n', integer=True)
|
||||
sage: f = u(n+2) - u(n+1) + u(n)/4
|
||||
- sage: 2**n * rsolve(f,u(n))
|
||||
- C1*n + C0
|
||||
+ sage: expand(2**n * rsolve(f,u(n)))
|
||||
+ 2*C1*n + C0
|
||||
|
||||
"""
|
||||
diff --git a/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py b/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
|
||||
index 1062f4f7e8c..f53f813d793 100644
|
||||
--- a/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
|
||||
+++ b/src/sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py
|
||||
@@ -382,7 +382,7 @@ Sage example in ./recequadiff.tex, line 1798::
|
||||
sage: from sympy import rsolve_hyper
|
||||
sage: from sympy.abc import n
|
||||
sage: rsolve_hyper([-2,1],2**(n+2),n)
|
||||
- 2**n*C0 + 2**(n + 2)*(C0 + n/2)
|
||||
+ 2**n*C0 + 2**(n + 1)*n
|
||||
|
||||
"""
|
||||
|
|
@ -1,526 +0,0 @@
|
|||
From aeff992d53a65a705dca5cd5216bcb97c218dce7 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Rojas <arojas@archlinux.org>
|
||||
Date: Mon, 29 Aug 2022 23:14:03 +0200
|
||||
Subject: Adapt to API changes in OpenOutputStream and CloseOutput
|
||||
|
||||
---
|
||||
src/sage/libs/gap/element.pyx | 5 +++--
|
||||
src/sage/libs/gap/gap_includes.pxd | 6 ++++--
|
||||
2 files changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
|
||||
index be43c4c..e268116 100644
|
||||
--- a/src/sage/libs/gap/element.pyx
|
||||
+++ b/src/sage/libs/gap/element.pyx
|
||||
@@ -130,6 +130,7 @@ cdef char *capture_stdout(Obj func, Obj obj):
|
||||
"""
|
||||
cdef Obj s, stream, output_text_string
|
||||
cdef UInt res
|
||||
+ cdef TypOutputFile output
|
||||
# The only way to get a string representation of an object that is truly
|
||||
# consistent with how it would be represented at the GAP REPL is to call
|
||||
# ViewObj on it. Unfortunately, ViewObj *prints* to the output stream,
|
||||
@@ -145,12 +146,12 @@ cdef char *capture_stdout(Obj func, Obj obj):
|
||||
output_text_string = GAP_ValueGlobalVariable("OutputTextString")
|
||||
stream = CALL_2ARGS(output_text_string, s, GAP_True)
|
||||
|
||||
- if not OpenOutputStream(stream):
|
||||
+ if not OpenOutputStream(&output, stream):
|
||||
raise GAPError("failed to open output capture stream for "
|
||||
"representing GAP object")
|
||||
|
||||
CALL_1ARGS(func, obj)
|
||||
- CloseOutput()
|
||||
+ CloseOutput(&output)
|
||||
return CSTR_STRING(s)
|
||||
finally:
|
||||
GAP_Leave()
|
||||
diff --git a/src/sage/libs/gap/gap_includes.pxd b/src/sage/libs/gap/gap_includes.pxd
|
||||
index 5a9ab48..34035fe 100644
|
||||
--- a/src/sage/libs/gap/gap_includes.pxd
|
||||
+++ b/src/sage/libs/gap/gap_includes.pxd
|
||||
@@ -76,8 +76,10 @@ cdef extern from "gap/intobj.h" nogil:
|
||||
|
||||
|
||||
cdef extern from "gap/io.h" nogil:
|
||||
- UInt OpenOutputStream(Obj stream)
|
||||
- UInt CloseOutput()
|
||||
+ ctypedef struct TypOutputFile:
|
||||
+ pass
|
||||
+ UInt OpenOutputStream(TypOutputFile* output, Obj stream)
|
||||
+ UInt CloseOutput(TypOutputFile* output)
|
||||
|
||||
|
||||
cdef extern from "gap/libgap-api.h" nogil:
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From c3367b4290981e5e93b7a30c48b02f1ae3770dc8 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Rojas <arojas@archlinux.org>
|
||||
Date: Mon, 29 Aug 2022 23:14:53 +0200
|
||||
Subject: Disable colored prompt as it breaks the pexpect interface
|
||||
|
||||
---
|
||||
src/sage/interfaces/gap.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/sage/interfaces/gap.py b/src/sage/interfaces/gap.py
|
||||
index c34fe53..569caa2 100644
|
||||
--- a/src/sage/interfaces/gap.py
|
||||
+++ b/src/sage/interfaces/gap.py
|
||||
@@ -1512,6 +1512,8 @@ def gap_reset_workspace(max_workspace_size=None, verbose=False):
|
||||
"""
|
||||
# Create new workspace with filename WORKSPACE
|
||||
g = Gap(use_workspace_cache=False, max_workspace_size=None)
|
||||
+ g.eval('ColorPrompt(false)')
|
||||
+ g.eval('SetUserPreference("UseColorPrompt", false)')
|
||||
g.eval('SetUserPreference("HistoryMaxLines", 30)')
|
||||
from sage.tests.gap_packages import all_installed_packages
|
||||
for pkg in all_installed_packages(gap=g):
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From 3b63e998e4d6118fc86b13b940c8f3d3b8307a50 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Rojas <arojas@archlinux.org>
|
||||
Date: Mon, 29 Aug 2022 23:16:03 +0200
|
||||
Subject: Port NaturalHomomorphism uses
|
||||
|
||||
---
|
||||
src/sage/groups/abelian_gps/abelian_group_gap.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/sage/groups/abelian_gps/abelian_group_gap.py b/src/sage/groups/abelian_gps/abelian_group_gap.py
|
||||
index a4b0471..86090b4 100644
|
||||
--- a/src/sage/groups/abelian_gps/abelian_group_gap.py
|
||||
+++ b/src/sage/groups/abelian_gps/abelian_group_gap.py
|
||||
@@ -338,7 +338,7 @@ class AbelianGroup_gap(UniqueRepresentation, GroupMixinLibGAP, ParentLibGAP, Abe
|
||||
if isinstance(x, AbelianGroupElement_gap):
|
||||
try:
|
||||
if x in self._cover:
|
||||
- x = self.gap().NaturalHomomorphism().Image(x.gap())
|
||||
+ x = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations).Image(x.gap())
|
||||
else:
|
||||
x = x.gap()
|
||||
except AttributeError:
|
||||
@@ -1043,7 +1043,7 @@ class AbelianGroupQuotient_gap(AbelianGroup_gap):
|
||||
From: Abelian group with gap, generator orders (4,)
|
||||
To: Quotient abelian group with generator orders (2,)
|
||||
"""
|
||||
- phi = self.gap().NaturalHomomorphism()
|
||||
+ phi = self._cover.gap().NaturalHomomorphismByNormalSubgroup(self._relations)
|
||||
Hom = self._cover.Hom(self)
|
||||
return Hom(phi)
|
||||
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From bc40764be044653e06f2da3497e1e05da08251f7 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Rojas <arojas@archlinux.org>
|
||||
Date: Mon, 29 Aug 2022 23:17:36 +0200
|
||||
Subject: Fix tests with GAP 4.12
|
||||
|
||||
---
|
||||
src/doc/en/thematic_tutorials/lie/weyl_groups.rst | 12 ++++++------
|
||||
src/sage/coding/codecan/autgroup_can_label.pyx | 2 +-
|
||||
src/sage/coding/linear_code.py | 22 +++++++++++-----------
|
||||
.../root_system/hecke_algebra_representation.py | 2 +-
|
||||
src/sage/combinat/symmetric_group_algebra.py | 2 +-
|
||||
src/sage/groups/finitely_presented.py | 6 +++---
|
||||
src/sage/groups/fqf_orthogonal.py | 2 +-
|
||||
src/sage/groups/libgap_wrapper.pyx | 6 +++---
|
||||
.../perm_gps/partn_ref2/refinement_generic.pyx | 2 +-
|
||||
src/sage/groups/perm_gps/permgroup.py | 8 ++++----
|
||||
src/sage/libs/gap/libgap.pyx | 2 +-
|
||||
src/sage/libs/gap/util.pyx | 8 +-------
|
||||
src/sage/tests/gap_packages.py | 2 +-
|
||||
13 files changed, 35 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
|
||||
index c917338..182e74a 100644
|
||||
--- a/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
|
||||
+++ b/src/doc/en/thematic_tutorials/lie/weyl_groups.rst
|
||||
@@ -139,12 +139,12 @@ string, which you can print::
|
||||
X.1 1 1 1 1 1 1 1 1 1 1 1 1 1
|
||||
X.2 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1
|
||||
X.3 2 . 2 -1 . 2 2 . . . -1 2 2
|
||||
- X.4 3 -1 -1 . 1 -1 3 -1 1 -1 . -1 3
|
||||
- X.5 3 -1 -1 . 1 3 -1 -1 -1 1 . -1 3
|
||||
- X.6 3 1 -1 . -1 -1 3 1 -1 1 . -1 3
|
||||
- X.7 3 1 -1 . -1 3 -1 1 1 -1 . -1 3
|
||||
- X.8 3 -1 3 . -1 -1 -1 -1 1 1 . -1 3
|
||||
- X.9 3 1 3 . 1 -1 -1 1 -1 -1 . -1 3
|
||||
+ X.4 3 -1 -1 . 1 3 -1 -1 -1 1 . -1 3
|
||||
+ X.5 3 1 -1 . -1 3 -1 1 1 -1 . -1 3
|
||||
+ X.6 3 -1 3 . -1 -1 -1 -1 1 1 . -1 3
|
||||
+ X.7 3 -1 -1 . 1 -1 3 -1 1 -1 . -1 3
|
||||
+ X.8 3 1 3 . 1 -1 -1 1 -1 -1 . -1 3
|
||||
+ X.9 3 1 -1 . -1 -1 3 1 -1 1 . -1 3
|
||||
X.10 4 -2 . -1 . . . 2 . . 1 . -4
|
||||
X.11 4 2 . -1 . . . -2 . . 1 . -4
|
||||
X.12 6 . -2 . . -2 -2 . . . . 2 6
|
||||
diff --git a/src/sage/coding/codecan/autgroup_can_label.pyx b/src/sage/coding/codecan/autgroup_can_label.pyx
|
||||
index de5db98..c83b926 100644
|
||||
--- a/src/sage/coding/codecan/autgroup_can_label.pyx
|
||||
+++ b/src/sage/coding/codecan/autgroup_can_label.pyx
|
||||
@@ -76,7 +76,7 @@ columns do share the same coloring::
|
||||
((1,),
|
||||
(2,),
|
||||
(3, 5, 4),
|
||||
- (6, 19, 16, 9, 21, 10, 8, 15, 14, 11, 20, 13, 12, 7, 17, 18))
|
||||
+ (6, 19, 16, 21, 9, 10, 15, 8, 20, 11, 14, 13, 7, 12, 18, 17))
|
||||
|
||||
We can also restrict the group action to linear isometries::
|
||||
|
||||
diff --git a/src/sage/coding/linear_code.py b/src/sage/coding/linear_code.py
|
||||
index e8e32f8..9d45160 100644
|
||||
--- a/src/sage/coding/linear_code.py
|
||||
+++ b/src/sage/coding/linear_code.py
|
||||
@@ -466,27 +466,27 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric):
|
||||
0
|
||||
sage: C = codes.HammingCode(GF(4, 'z'), 3)
|
||||
sage: C.automorphism_group_gens()
|
||||
- ([((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ ([((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ Defn: z |--> z + 1),
|
||||
+ ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z + 1),
|
||||
- ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
|
||||
- Defn: z |--> z),
|
||||
((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z)],
|
||||
362880)
|
||||
sage: C.automorphism_group_gens(equivalence="linear")
|
||||
- ([((z + 1, 1, z + 1, z + 1, z + 1, z, 1, z, 1, 1, 1, 1, z + 1, z + 1, z + 1, z, z, 1, z, z, z); (1,15,2,8,16,18,3)(4,9,12,13,20,10,11)(5,21,14,6,7,19,17), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ ([((z, 1, z + 1, z + 1, 1, z + 1, z, 1, z + 1, z + 1, 1, z, 1, z + 1, z, 1, z, 1, z + 1, 1, 1); (1,12,11,10,6,8,9,20,13,21,5,14,3,16,17,19,7,4,2,15,18), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z),
|
||||
- ((z + 1, z + 1, z + 1, z + 1, z + 1, 1, z, 1, z, z, z, 1, z, 1, 1, 1, z + 1, z + 1, z + 1, 1, z); (1,15,21,8,9)(2,18,5,3,11,16,7,10,19,13,12,4,17,6,20), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ ((z + 1, z + 1, z + 1, z, 1, 1, z, z, 1, z + 1, z, 1, 1, z, 1, z + 1, z, z + 1, z + 1, 1, z); (1,3,18,2,17,6,19)(4,15,13,20,7,14,16)(5,11,8,21,12,9,10), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z),
|
||||
((z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1, z + 1); (), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z)],
|
||||
181440)
|
||||
sage: C.automorphism_group_gens(equivalence="permutational")
|
||||
- ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ ([((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z),
|
||||
- ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,11)(3,10)(4,9)(5,7)(12,21)(14,20)(15,19)(16,17), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,18)(3,19)(4,10)(5,16)(8,13)(9,14)(11,21)(15,20), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z),
|
||||
- ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,17)(2,8)(3,14)(4,10)(7,12)(9,19)(13,18)(15,20), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ ((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (1,19)(3,17)(4,21)(5,20)(7,14)(9,12)(10,16)(11,15), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z),
|
||||
((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); (2,13)(3,14)(4,20)(5,11)(8,18)(9,19)(10,15)(16,21), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z)],
|
||||
@@ -692,10 +692,10 @@ class AbstractLinearCode(AbstractLinearCodeNoMetric):
|
||||
sage: C_iso == aut_group_can_label.get_canonical_form()
|
||||
True
|
||||
sage: aut_group_can_label.get_autom_gens()
|
||||
- [((1, 1, 1, 1, 1, z + 1, z, z + 1, z, z, z, 1, 1, z + 1, z + 1, z, z + 1, z, z + 1, z + 1, z + 1); (1,14,6,7,4,10,11,19)(2,8,16,13,3,17,21,15)(9,12,18,20), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ [((1, 1, 1, z, z + 1, 1, 1, 1, 1, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z); (1,13,14,20)(2,21,8,18,7,16,19,15)(3,10,5,12,17,9,6,4), Ring endomorphism of Finite Field in z of size 2^2
|
||||
+ Defn: z |--> z + 1),
|
||||
+ ((z, 1, z, z, z, z + 1, z, z, z, z, z, z, z + 1, z, z, z, z, z + 1, z, z, z); (1,11,5,12,3,19)(2,8)(6,18,13)(7,17,15)(9,10,14,16,20,21), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z + 1),
|
||||
- ((z + 1, 1, 1, z, z + 1, z, z, z + 1, z + 1, z + 1, 1, z + 1, z, z, 1, z + 1, 1, z, z + 1, z + 1, z); (1,18,6,19,2,9,17,10,13,14,21,11,4,5,12)(3,20,7,16,8), Ring endomorphism of Finite Field in z of size 2^2
|
||||
- Defn: z |--> z),
|
||||
((z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z, z); (), Ring endomorphism of Finite Field in z of size 2^2
|
||||
Defn: z |--> z)]
|
||||
"""
|
||||
diff --git a/src/sage/combinat/root_system/hecke_algebra_representation.py b/src/sage/combinat/root_system/hecke_algebra_representation.py
|
||||
index bde2823..bffcc85 100644
|
||||
--- a/src/sage/combinat/root_system/hecke_algebra_representation.py
|
||||
+++ b/src/sage/combinat/root_system/hecke_algebra_representation.py
|
||||
@@ -355,7 +355,7 @@ class HeckeAlgebraRepresentation(WithEqualityById, SageObject):
|
||||
sage: q1, q2 = K.gens()
|
||||
sage: KW = W.algebra(K)
|
||||
sage: x = KW.an_element(); x
|
||||
- 123 + 3*32 + 2*3 + e
|
||||
+ 123 + 3*2312 + 2*31 + e
|
||||
|
||||
sage: T = KW.demazure_lusztig_operators(q1,q2)
|
||||
sage: T12 = T.Tw( (1,2) )
|
||||
diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py
|
||||
index c3d6755..da953d2 100644
|
||||
--- a/src/sage/combinat/symmetric_group_algebra.py
|
||||
+++ b/src/sage/combinat/symmetric_group_algebra.py
|
||||
@@ -101,7 +101,7 @@ def SymmetricGroupAlgebra(R, W, category=None):
|
||||
sage: SGA.group()
|
||||
Weyl Group of type ['A', 3] (as a matrix group acting on the ambient space)
|
||||
sage: SGA.an_element()
|
||||
- s1*s2*s3 + 3*s3*s2 + 2*s3 + 1
|
||||
+ s1*s2*s3 + 3*s2*s3*s1*s2 + 2*s3*s1 + 1
|
||||
|
||||
The preferred way to construct the symmetric group algebra is to
|
||||
go through the usual ``algebra`` method::
|
||||
diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py
|
||||
index 2a61bbf..d26891a 100644
|
||||
--- a/src/sage/groups/finitely_presented.py
|
||||
+++ b/src/sage/groups/finitely_presented.py
|
||||
@@ -596,9 +596,9 @@ class RewritingSystem():
|
||||
sage: k = G.rewriting_system()
|
||||
sage: k.gap()
|
||||
Knuth Bendix Rewriting System for Monoid( [ a, A, b, B ] ) with rules
|
||||
- [ [ a^2, <identity ...> ], [ a*A, <identity ...> ],
|
||||
- [ A*a, <identity ...> ], [ b^2, <identity ...> ],
|
||||
- [ b*B, <identity ...> ], [ B*b, <identity ...> ] ]
|
||||
+ [ [ a*A, <identity ...> ], [ A*a, <identity ...> ],
|
||||
+ [ b*B, <identity ...> ], [ B*b, <identity ...> ],
|
||||
+ [ a^2, <identity ...> ], [ b^2, <identity ...> ] ]
|
||||
"""
|
||||
return self._gap
|
||||
|
||||
diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
|
||||
index 75de408..dd7d84d 100644
|
||||
--- a/src/sage/groups/fqf_orthogonal.py
|
||||
+++ b/src/sage/groups/fqf_orthogonal.py
|
||||
@@ -143,7 +143,7 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
|
||||
[2/3 0 0]
|
||||
[ 0 2/3 0]
|
||||
[ 0 0 4/3]
|
||||
- generated by 2 elements
|
||||
+ generated by 3 elements
|
||||
sage: q = matrix.diagonal(QQ, [3/2, 1/4, 1/4])
|
||||
sage: T = TorsionQuadraticForm(q)
|
||||
sage: T.orthogonal_group().order()
|
||||
diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx
|
||||
index a76afc2..9340c0d 100644
|
||||
--- a/src/sage/groups/libgap_wrapper.pyx
|
||||
+++ b/src/sage/groups/libgap_wrapper.pyx
|
||||
@@ -25,7 +25,7 @@ Note how we call the constructor of both superclasses to initialize
|
||||
its output via LibGAP::
|
||||
|
||||
sage: FooGroup()
|
||||
- <pc group of size 3 with 1 generators>
|
||||
+ <pc group of size 3 with 1 generator>
|
||||
sage: type(FooGroup().gap())
|
||||
<class 'sage.libs.gap.element.GapElement'>
|
||||
|
||||
@@ -106,7 +106,7 @@ class ParentLibGAP(SageObject):
|
||||
....: ParentLibGAP.__init__(self, lg)
|
||||
....: Group.__init__(self)
|
||||
sage: FooGroup()
|
||||
- <pc group of size 3 with 1 generators>
|
||||
+ <pc group of size 3 with 1 generator>
|
||||
"""
|
||||
|
||||
def __init__(self, libgap_parent, ambient=None):
|
||||
@@ -461,7 +461,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement):
|
||||
....: ParentLibGAP.__init__(self, lg)
|
||||
....: Group.__init__(self)
|
||||
sage: FooGroup()
|
||||
- <pc group of size 3 with 1 generators>
|
||||
+ <pc group of size 3 with 1 generator>
|
||||
sage: FooGroup().gens()
|
||||
(f1,)
|
||||
"""
|
||||
diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
|
||||
index 2fcb036..ca73c6b 100644
|
||||
--- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
|
||||
+++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx
|
||||
@@ -427,7 +427,7 @@ cdef class LabelledBranching:
|
||||
sage: from sage.groups.perm_gps.partn_ref2.refinement_generic import LabelledBranching
|
||||
sage: L = LabelledBranching(3)
|
||||
sage: L.small_generating_set()
|
||||
- []
|
||||
+ [()]
|
||||
sage: L.add_gen(libgap.eval('(1,2,3)'))
|
||||
sage: L.small_generating_set()
|
||||
[(1,2,3)]
|
||||
diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
|
||||
index 4908934..34ba0cc 100644
|
||||
--- a/src/sage/groups/perm_gps/permgroup.py
|
||||
+++ b/src/sage/groups/perm_gps/permgroup.py
|
||||
@@ -913,7 +913,7 @@ class PermutationGroup_generic(FiniteGroup):
|
||||
sage: f = PG._coerce_map_from_(MG)
|
||||
sage: mg = MG.an_element()
|
||||
sage: p = f(mg); p
|
||||
- (2,33,32,23,31,55)(3,49,38,44,40,28)(4,17,59,62,58,46)(5,21,47,20,43,8)(6,53,50)(7,37,12,57,14,29)(9,41,56,34,64,10)(11,25,19)(13,61,26,51,22,15)(16,45,36)(18,27,35,48,52,54)(24,63,42)(30,39,60)
|
||||
+ (1,2,6,19,35,33)(3,9,26,14,31,23)(4,13,5)(7,22,17)(8,24,12)(10,16,32,27,20,28)(11,30,18)(15,25,36,34,29,21)
|
||||
sage: PG(p._gap_()) == p
|
||||
True
|
||||
|
||||
@@ -959,12 +959,12 @@ class PermutationGroup_generic(FiniteGroup):
|
||||
sage: P = G.as_permutation_group(algorithm='smaller', seed=5)
|
||||
sage: P1 = G.as_permutation_group()
|
||||
sage: P == P1
|
||||
- False
|
||||
+ True
|
||||
sage: g1, g2, g3 = G.gens()
|
||||
sage: P(g1*g2)
|
||||
- (1,3,7,12)(2,4,8,10)(5,11)(6,9)
|
||||
+ (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
|
||||
sage: P1(g1*g2)
|
||||
- (2,29,25,68)(3,57,13,54)(4,11,72,37)(5,39,60,23)(6,64,75,63)(7,21,50,73)(8,46,38,32)(9,74,35,18)(10,44,49,48)(12,16,34,71)(14,79,27,40)(15,26)(17,62,59,76)(19,78,70,65)(20,22,58,51)(24,33,36,43)(28,81,80,52)(30,53,56,69)(31,61)(41,42,67,55)(45,77)(47,66)
|
||||
+ (1,4,13,11)(2,5,14,18)(3,15,8,16)(6,7)(9,20,19,12)(10,17)
|
||||
|
||||
Another check for :trac:`5583`::
|
||||
|
||||
diff --git a/src/sage/libs/gap/libgap.pyx b/src/sage/libs/gap/libgap.pyx
|
||||
index b1a64e5..6a36613 100644
|
||||
--- a/src/sage/libs/gap/libgap.pyx
|
||||
+++ b/src/sage/libs/gap/libgap.pyx
|
||||
@@ -695,7 +695,7 @@ class Gap(Parent):
|
||||
sage: libgap.List
|
||||
<Gap function "List">
|
||||
sage: libgap.GlobalRandomSource
|
||||
- <RandomSource in IsGlobalRandomSource>
|
||||
+ <RandomSource in IsGAPRandomSource>
|
||||
"""
|
||||
if name in dir(self.__class__):
|
||||
return getattr(self.__class__, name)
|
||||
diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx
|
||||
index 344ab88..6350987 100644
|
||||
--- a/src/sage/libs/gap/util.pyx
|
||||
+++ b/src/sage/libs/gap/util.pyx
|
||||
@@ -362,15 +362,9 @@ cdef Obj gap_eval(str gap_string) except? NULL:
|
||||
GAPError: Error, Variable: 'Complex' must have a value
|
||||
Syntax error: ; expected in stream:1
|
||||
Complex Field with 53 bits of precision;;
|
||||
- ^^^^^^^^^^^^
|
||||
+ ^^^^^
|
||||
Error, Variable: 'with' must have a value
|
||||
- Syntax error: ; expected in stream:1
|
||||
- Complex Field with 53 bits of precision;;
|
||||
- ^^^^^^^^^^^^^^^^^^^^
|
||||
Error, Variable: 'bits' must have a value
|
||||
- Syntax error: ; expected in stream:1
|
||||
- Complex Field with 53 bits of precision;;
|
||||
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Error, Variable: 'precision' must have a value
|
||||
|
||||
Test that on a subsequent attempt we get the same message (no garbage was
|
||||
diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py
|
||||
index 2e4518c..c302b16 100644
|
||||
--- a/src/sage/tests/gap_packages.py
|
||||
+++ b/src/sage/tests/gap_packages.py
|
||||
@@ -103,7 +103,7 @@ def all_installed_packages(ignore_dot_gap=False, gap=None):
|
||||
|
||||
sage: from sage.tests.gap_packages import all_installed_packages
|
||||
sage: all_installed_packages()
|
||||
- (...'GAPDoc'...)
|
||||
+ (...'gapdoc'...)
|
||||
sage: all_installed_packages(ignore_dot_gap=True) == all_installed_packages(gap=gap, ignore_dot_gap=True)
|
||||
True
|
||||
"""
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From cbc902a79ff9ec01d4d4eb9a767a1c661fb5dda7 Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Rojas <arojas@archlinux.org>
|
||||
Date: Fri, 30 Sep 2022 19:17:42 +0200
|
||||
Subject: Adapt test to new is_transitive and is_primitive behavior
|
||||
|
||||
---
|
||||
src/sage/groups/perm_gps/permgroup.py | 22 ++++++++++++++++------
|
||||
1 file changed, 16 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
|
||||
index 34ba0cc..5832b98 100644
|
||||
--- a/src/sage/groups/perm_gps/permgroup.py
|
||||
+++ b/src/sage/groups/perm_gps/permgroup.py
|
||||
@@ -4359,17 +4359,23 @@ class PermutationGroup_generic(FiniteGroup):
|
||||
|
||||
::
|
||||
|
||||
- sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
|
||||
- sage: G.is_transitive([1,4,5])
|
||||
+ sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)],[(6,7)]])
|
||||
+ sage: G.is_transitive([1,2,3,4,5])
|
||||
True
|
||||
- sage: G.is_transitive([2..6])
|
||||
+ sage: G.is_transitive([1..7])
|
||||
False
|
||||
sage: G.is_transitive(G.non_fixed_points())
|
||||
- True
|
||||
+ False
|
||||
sage: H = PermutationGroup([[(1,2,3)],[(4,5,6)]])
|
||||
sage: H.is_transitive(H.non_fixed_points())
|
||||
False
|
||||
|
||||
+ If `G` does not act on the domain, it always returns ``False``::
|
||||
+
|
||||
+ sage: G = PermutationGroup([[(1,2,3,4,5)],[(1,2)]]) #S_5 on [1..5]
|
||||
+ sage: G.is_transitive([1,4,5])
|
||||
+ False
|
||||
+
|
||||
Note that this differs from the definition in GAP, where
|
||||
``IsTransitive`` returns whether the group is transitive on the
|
||||
set of points moved by the group.
|
||||
@@ -4425,12 +4431,16 @@ class PermutationGroup_generic(FiniteGroup):
|
||||
sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
|
||||
sage: G.is_primitive([1..4])
|
||||
False
|
||||
- sage: G.is_primitive([1,2,3])
|
||||
- True
|
||||
sage: G = PermutationGroup([[(3,4,5,6)],[(3,4)]]) #S_4 on [3..6]
|
||||
sage: G.is_primitive(G.non_fixed_points())
|
||||
True
|
||||
|
||||
+ If `G` does not act on the domain, it always returns ``False``::
|
||||
+
|
||||
+ sage: G = PermutationGroup([[(1,2,3,4)],[(2,4)]])
|
||||
+ sage: G.is_primitive([1,2,3])
|
||||
+ False
|
||||
+
|
||||
"""
|
||||
#If the domain is not a subset of self.domain(), then the
|
||||
#action isn't primitive.
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From 80dd6b338236f170efca1fc3545df18ce8d8795c Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Rojas <arojas@archlinux.org>
|
||||
Date: Fri, 30 Sep 2022 19:18:06 +0200
|
||||
Subject: Mark test as random. With gap 4.12 on x86_64 it is no longer 2
|
||||
|
||||
---
|
||||
src/sage/groups/perm_gps/permgroup.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/sage/groups/perm_gps/permgroup.py b/src/sage/groups/perm_gps/permgroup.py
|
||||
index 5832b98..c1230a3 100644
|
||||
--- a/src/sage/groups/perm_gps/permgroup.py
|
||||
+++ b/src/sage/groups/perm_gps/permgroup.py
|
||||
@@ -1287,7 +1287,7 @@ class PermutationGroup_generic(FiniteGroup):
|
||||
sage: G.gens_small() # random
|
||||
[('b','c'), ('a','c','b')] ## (on 64-bit Linux)
|
||||
[('a','b'), ('a','c','b')] ## (on Solaris)
|
||||
- sage: len(G.gens_small()) == 2
|
||||
+ sage: len(G.gens_small()) == 2 # random
|
||||
True
|
||||
"""
|
||||
gens = self._libgap_().SmallGeneratingSet()
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
||||
|
||||
From a6c293d67cfcdf8fba7bc6aa7899e2086d42cc7e Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Rojas <arojas@archlinux.org>
|
||||
Date: Fri, 30 Sep 2022 19:18:30 +0200
|
||||
Subject: Remove test that is now redundant, all seeds give the same answer
|
||||
|
||||
---
|
||||
src/sage/groups/matrix_gps/finitely_generated.py | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py
|
||||
index a6d3dc0..63956ad 100644
|
||||
--- a/src/sage/groups/matrix_gps/finitely_generated.py
|
||||
+++ b/src/sage/groups/matrix_gps/finitely_generated.py
|
||||
@@ -563,9 +563,6 @@ class FinitelyGeneratedMatrixGroup_gap(MatrixGroup_gap):
|
||||
21499084800
|
||||
sage: P = G.as_permutation_group()
|
||||
sage: Psmaller = G.as_permutation_group(algorithm="smaller", seed=6)
|
||||
- sage: P == Psmaller # see the note below
|
||||
- True
|
||||
- sage: Psmaller = G.as_permutation_group(algorithm="smaller")
|
||||
sage: P == Psmaller
|
||||
False
|
||||
sage: P.cardinality()
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
commit 04971318f032caf8dc1c0de9489346d894409091
|
||||
Author: John H. Palmieri <jhpalmieri64@gmail.com>
|
||||
Date: Wed Aug 31 14:22:26 2022 -0700
|
||||
|
||||
trac 34465: fix invalid escape sequence in functions/special.py
|
||||
|
||||
diff --git a/src/sage/functions/special.py b/src/sage/functions/special.py
|
||||
index 02596e49620..901f02f9bee 100644
|
||||
--- a/src/sage/functions/special.py
|
||||
+++ b/src/sage/functions/special.py
|
||||
@@ -849,7 +849,7 @@ class EllipticF(BuiltinFunction):
|
||||
- :wikipedia:`Elliptic_integral#Incomplete_elliptic_integral_of_the_first_kind`
|
||||
"""
|
||||
def __init__(self):
|
||||
- """
|
||||
+ r"""
|
||||
EXAMPLES::
|
||||
|
||||
sage: loads(dumps(elliptic_f))
|
File diff suppressed because it is too large
Load Diff
|
@ -1,29 +0,0 @@
|
|||
From f0365f30834b6890313790b3845c647d0160fa6a Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Delecroix <20100.delecroix@gmail.com*>
|
||||
Date: Fri, 30 Sep 2022 16:31:08 +0200
|
||||
Subject: fix doctest if fqf_orthogonal
|
||||
|
||||
---
|
||||
src/sage/groups/fqf_orthogonal.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/sage/groups/fqf_orthogonal.py b/src/sage/groups/fqf_orthogonal.py
|
||||
index 75de408..7fc4dbe 100644
|
||||
--- a/src/sage/groups/fqf_orthogonal.py
|
||||
+++ b/src/sage/groups/fqf_orthogonal.py
|
||||
@@ -245,10 +245,10 @@ class FqfOrthogonalGroup(AbelianGroupAutomorphismGroup_subgroup):
|
||||
sage: all(x*f==x*fbar for x in q.gens())
|
||||
True
|
||||
sage: L = IntegralLattice("A2").twist(3)
|
||||
- sage: q = L.discriminant_group()
|
||||
sage: OL = L.orthogonal_group()
|
||||
+ sage: assert OL(OL.0.matrix()) == OL.0
|
||||
+ sage: q = L.discriminant_group()
|
||||
sage: Oq = q.orthogonal_group()
|
||||
- sage: assert Oq(OL.0) == Oq(OL.0.matrix())
|
||||
sage: assert Oq(Oq.0.matrix()) == Oq.0
|
||||
"""
|
||||
from sage.libs.gap.element import GapElement
|
||||
--
|
||||
cgit v1.0-1-gd88e
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
commit 5501e0de0dca1cff0355326dd42bd8c7e5749568
|
||||
Author: Gonzalo Tornaría <tornaria@cmat.edu.uy>
|
||||
Date: Tue Oct 11 17:25:04 2022 -0300
|
||||
|
||||
Support matplotlib 3.6
|
||||
|
||||
diff --git a/src/sage/plot/arc.py b/src/sage/plot/arc.py
|
||||
index bb834763afc..f65973bcbd5 100644
|
||||
--- a/src/sage/plot/arc.py
|
||||
+++ b/src/sage/plot/arc.py
|
||||
@@ -273,9 +273,9 @@ class Arc(GraphicPrimitive):
|
||||
p = patches.Arc((self.x, self.y),
|
||||
2. * self.r1,
|
||||
2. * self.r2,
|
||||
- fmod(self.angle, 2 * pi) * (180. / pi),
|
||||
- self.s1 * (180. / pi),
|
||||
- self.s2 * (180. / pi))
|
||||
+ angle=fmod(self.angle, 2 * pi) * (180. / pi),
|
||||
+ theta1=self.s1 * (180. / pi),
|
||||
+ theta2=self.s2 * (180. / pi))
|
||||
return p
|
||||
|
||||
def bezier_path(self):
|
||||
diff --git a/src/sage/plot/ellipse.py b/src/sage/plot/ellipse.py
|
||||
index a77e6fe640a..c35bed574ef 100644
|
||||
--- a/src/sage/plot/ellipse.py
|
||||
+++ b/src/sage/plot/ellipse.py
|
||||
@@ -192,7 +192,8 @@ class Ellipse(GraphicPrimitive):
|
||||
options = self.options()
|
||||
p = patches.Ellipse(
|
||||
(self.x,self.y),
|
||||
- self.r1*2.,self.r2*2.,self.angle/pi*180.)
|
||||
+ self.r1*2.,self.r2*2.,
|
||||
+ angle=self.angle/pi*180.)
|
||||
p.set_linewidth(float(options['thickness']))
|
||||
p.set_fill(options['fill'])
|
||||
a = float(options['alpha'])
|
||||
diff --git a/src/sage/plot/graphics.py b/src/sage/plot/graphics.py
|
||||
index e779e1210e3..8d620b5c625 100644
|
||||
--- a/src/sage/plot/graphics.py
|
||||
+++ b/src/sage/plot/graphics.py
|
||||
@@ -2007,7 +2007,7 @@ class Graphics(WithEqualityById, SageObject):
|
||||
We can also do custom formatting if you need it. See above for full
|
||||
details::
|
||||
|
||||
- sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex")
|
||||
+ sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") # not tested (broken with matplotlib 3.6)
|
||||
Graphics object consisting of 1 graphics primitive
|
||||
|
||||
This is particularly useful when setting custom ticks in multiples
|
||||
@@ -2341,7 +2341,7 @@ class Graphics(WithEqualityById, SageObject):
|
||||
sage: subplot = Figure().add_subplot(111)
|
||||
sage: p._objects[0]._render_on_subplot(subplot)
|
||||
sage: p._matplotlib_tick_formatter(subplot, **d)
|
||||
- (<AxesSubplot:>,
|
||||
+ (<AxesSubplot:...>,
|
||||
<matplotlib.ticker.MaxNLocator object at ...>,
|
||||
<matplotlib.ticker.MaxNLocator object at ...>,
|
||||
<matplotlib.ticker.ScalarFormatter object at ...>,
|
||||
diff --git a/src/sage/plot/plot.py b/src/sage/plot/plot.py
|
||||
index b36ee57227c..5301a05c3dc 100644
|
||||
--- a/src/sage/plot/plot.py
|
||||
+++ b/src/sage/plot/plot.py
|
||||
@@ -1741,7 +1741,7 @@ def plot(funcs, *args, **kwds):
|
||||
|
||||
::
|
||||
|
||||
- sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex")
|
||||
+ sage: plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],2],tick_formatter="latex") # not tested (broken with matplotlib 3.6)
|
||||
Graphics object consisting of 1 graphics primitive
|
||||
|
||||
.. PLOT::
|
|
@ -0,0 +1,205 @@
|
|||
diff --git a/build/pkgs/singular/checksums.ini b/build/pkgs/singular/checksums.ini
|
||||
index 2e33a405d36..313463d2fea 100644
|
||||
--- a/build/pkgs/singular/checksums.ini
|
||||
+++ b/build/pkgs/singular/checksums.ini
|
||||
@@ -1,5 +1,5 @@
|
||||
tarball=singular-VERSION.tar.gz
|
||||
-sha1=6c2b622d3681e2de3d58d30c654d43d3e32b720c
|
||||
-md5=abb1e37c794472e7760655358ab66054
|
||||
-cksum=17455733
|
||||
+sha1=28bb3ee97ef48d04dfa96de182fd93eebe08426c
|
||||
+md5=fc0a4f5720dadba45a52ee94324ce00c
|
||||
+cksum=1573851737
|
||||
upstream_url=ftp://jim.mathematik.uni-kl.de/pub/Math/Singular/SOURCES/4-3-1/singular-VERSION.tar.gz
|
||||
diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt
|
||||
index 11300c77e7d..66e2bede53a 100644
|
||||
--- a/build/pkgs/singular/package-version.txt
|
||||
+++ b/build/pkgs/singular/package-version.txt
|
||||
@@ -1 +1 @@
|
||||
-4.3.1p1
|
||||
+4.3.1p3
|
||||
diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd
|
||||
index 8e3ac314b67..747a6b1e2fb 100644
|
||||
--- a/src/sage/libs/singular/decl.pxd
|
||||
+++ b/src/sage/libs/singular/decl.pxd
|
||||
@@ -574,7 +574,7 @@ cdef extern from "singular/Singular/libsingular.h":
|
||||
|
||||
# gets a component out of a polynomial vector
|
||||
|
||||
- poly *pTakeOutComp1(poly **, int)
|
||||
+ poly *pTakeOutComp(poly **, int)
|
||||
|
||||
# deep copy p
|
||||
|
||||
diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
|
||||
index d8ea7b07f3c..3a1271cd59f 100644
|
||||
--- a/src/sage/libs/singular/singular.pyx
|
||||
+++ b/src/sage/libs/singular/singular.pyx
|
||||
@@ -1726,20 +1726,21 @@ cdef int overflow_check(unsigned long e, ring *_ring) except -1:
|
||||
|
||||
Whether an overflow occurs or not partially depends
|
||||
on the number of variables in the ring. See trac ticket
|
||||
- :trac:`11856`. With Singular 4, it is by default optimized
|
||||
- for at least 4 variables on 64-bit and 2 variables on 32-bit,
|
||||
- which in both cases makes a maximal default exponent of
|
||||
- 2^16-1.
|
||||
+ :trac:`11856`.
|
||||
|
||||
EXAMPLES::
|
||||
|
||||
sage: P.<x,y> = QQ[]
|
||||
- sage: y^(2^16-1)
|
||||
- y^65535
|
||||
- sage: y^2^16
|
||||
+ sage: y^(2^30)
|
||||
+ Traceback (most recent call last): # 32-bit
|
||||
+ ... # 32-bit
|
||||
+ OverflowError: exponent overflow (1073741824) # 32-bit
|
||||
+ y^1073741824 # 64-bit
|
||||
+ sage: y^2^32
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
- OverflowError: exponent overflow (65536)
|
||||
+ OverflowError: Python int too large to convert to C unsigned long # 32-bit
|
||||
+ OverflowError: exponent overflow (4294967296) # 64-bit
|
||||
"""
|
||||
if unlikely(e > _ring.bitmask):
|
||||
raise OverflowError("exponent overflow (%d)"%(e))
|
||||
diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal.py b/src/sage/rings/polynomial/multi_polynomial_ideal.py
|
||||
index 7dc058a22f0..71494eddbc0 100644
|
||||
--- a/src/sage/rings/polynomial/multi_polynomial_ideal.py
|
||||
+++ b/src/sage/rings/polynomial/multi_polynomial_ideal.py
|
||||
@@ -60,7 +60,7 @@
|
||||
Note that the result of a computation is not necessarily reduced::
|
||||
|
||||
sage: (a+b)^17
|
||||
- 256*a*b^16 + 256*b^17
|
||||
+ a*b^16 + b^17
|
||||
sage: S(17) == 0
|
||||
True
|
||||
|
||||
diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
|
||||
index 4dad016b33f..9bf67dd1425 100644
|
||||
--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
|
||||
+++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
|
||||
@@ -193,7 +193,7 @@ from sage.libs.singular.decl cimport (
|
||||
p_IsUnit, p_IsOne, p_Series, p_Head, idInit, fast_map_common_subexp, id_Delete,
|
||||
p_IsHomogeneous, p_Homogen, p_Totaldegree,pLDeg1_Totaldegree, singclap_pdivide, singclap_factorize,
|
||||
idLift, IDELEMS, On, Off, SW_USE_CHINREM_GCD, SW_USE_EZGCD,
|
||||
- p_LmIsConstant, pTakeOutComp1, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
|
||||
+ p_LmIsConstant, pTakeOutComp, singclap_gcd, pp_Mult_qq, p_GetMaxExp,
|
||||
pLength, kNF, p_Neg, p_Minus_mm_Mult_qq, p_Plus_mm_Mult_qq,
|
||||
pDiff, singclap_resultant, p_Normalize,
|
||||
prCopyR, prCopyR_NoSort)
|
||||
@@ -1587,7 +1587,8 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
|
||||
9/4
|
||||
|
||||
sage: P.monomial_quotient(x,y) # Note the wrong result
|
||||
- x*y^65535*z^65535
|
||||
+ x*y^65535*z^65535 # 32-bit
|
||||
+ x*y^1048575*z^1048575 # 64-bit
|
||||
|
||||
sage: P.monomial_quotient(x,P(1))
|
||||
x
|
||||
@@ -2247,10 +2248,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
|
||||
9/4*x^2 - 1/4*y^2 - y - 1
|
||||
|
||||
sage: P.<x,y> = PolynomialRing(QQ,order='lex')
|
||||
- sage: (x^2^15) * x^2^15
|
||||
+ sage: (x^2^32) * x^2^32
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
- OverflowError: exponent overflow (...)
|
||||
+ OverflowError: Python int too large to convert to C unsigned long # 32-bit
|
||||
+ OverflowError: exponent overflow (...) # 64-bit
|
||||
"""
|
||||
# all currently implemented rings are commutative
|
||||
cdef poly *_p
|
||||
@@ -2371,10 +2373,11 @@ cdef class MPolynomial_libsingular(MPolynomial):
|
||||
ValueError: not a 2nd power
|
||||
|
||||
sage: P.<x,y> = PolynomialRing(QQ,order='lex')
|
||||
- sage: (x+y^2^15)^10
|
||||
+ sage: (x+y^2^32)^10
|
||||
Traceback (most recent call last):
|
||||
....
|
||||
- OverflowError: exponent overflow (...)
|
||||
+ OverflowError: Python int too large to convert to C unsigned long # 32-bit
|
||||
+ OverflowError: exponent overflow (...) # 64-bit
|
||||
|
||||
Test fractional powers (:trac:`22329`)::
|
||||
|
||||
@@ -3461,7 +3464,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
|
||||
x^10000
|
||||
no overflow
|
||||
|
||||
- sage: n = 1000
|
||||
+ sage: n = 100000
|
||||
sage: try:
|
||||
....: f = x^n
|
||||
....: f.subs(x = x^n)
|
||||
@@ -4567,7 +4570,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
|
||||
l = []
|
||||
for i from 0 <= i < IDELEMS(res):
|
||||
for j from 1 <= j <= IDELEMS(_I):
|
||||
- l.append( new_MP(parent, pTakeOutComp1(&res.m[i], j)) )
|
||||
+ l.append( new_MP(parent, pTakeOutComp(&res.m[i], 1)) )
|
||||
|
||||
id_Delete(&fI, r)
|
||||
id_Delete(&_I, r)
|
||||
@@ -4635,7 +4638,7 @@ cdef class MPolynomial_libsingular(MPolynomial):
|
||||
|
||||
sage: f = 3*x
|
||||
sage: f.reduce([2*x,y])
|
||||
- 3*x
|
||||
+ x
|
||||
|
||||
The reduction is not canonical when ``I`` is not a Groebner
|
||||
basis::
|
||||
diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx
|
||||
index 1c9f35e56ba..587511c3888 100644
|
||||
--- a/src/sage/rings/polynomial/plural.pyx
|
||||
+++ b/src/sage/rings/polynomial/plural.pyx
|
||||
@@ -1619,10 +1619,10 @@ cdef class NCPolynomial_plural(RingElement):
|
||||
sage: P = A.g_algebra(relations={y*x:-x*y + z}, order='lex')
|
||||
sage: P.inject_variables()
|
||||
Defining x, z, y
|
||||
- sage: (x^2^15) * x^2^15
|
||||
+ sage: (x^2^31) * x^2^31
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
- OverflowError: exponent overflow (65536)
|
||||
+ OverflowError: exponent overflow (2147483648)
|
||||
"""
|
||||
# all currently implemented rings are commutative
|
||||
cdef poly *_p
|
||||
@@ -1689,10 +1689,10 @@ cdef class NCPolynomial_plural(RingElement):
|
||||
sage: P = A.g_algebra(relations={y*x:-x*y + z}, order='lex')
|
||||
sage: P.inject_variables()
|
||||
Defining x, z, y
|
||||
- sage: (x+y^2^15)^10
|
||||
+ sage: (x+y^2^31)^10
|
||||
Traceback (most recent call last):
|
||||
....
|
||||
- OverflowError: exponent overflow (327680)
|
||||
+ OverflowError: exponent overflow (2147483648)
|
||||
"""
|
||||
if type(exp) is not Integer:
|
||||
try:
|
||||
diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx
|
||||
index b5d83ef71b6..5c45b3fb528 100644
|
||||
--- a/src/sage/structure/element.pyx
|
||||
+++ b/src/sage/structure/element.pyx
|
||||
@@ -2705,10 +2705,10 @@ cdef class RingElement(ModuleElement):
|
||||
with Singular 4::
|
||||
|
||||
sage: K.<x,y> = ZZ[]
|
||||
- sage: (x^12345)^54321
|
||||
+ sage: (x^123456)^654321
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
- OverflowError: exponent overflow (670592745)
|
||||
+ OverflowError: exponent overflow (...)
|
||||
"""
|
||||
return arith_generic_power(self, n)
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'sagemath'
|
||||
pkgname=sagemath
|
||||
version=9.7
|
||||
revision=4
|
||||
version=9.8
|
||||
revision=1
|
||||
build_wrksrc=pkgs/sagemath-standard
|
||||
build_style=python3-module
|
||||
_bindir=/usr/lib/sagemath/$version/bin
|
||||
|
@ -14,7 +14,7 @@ makedepends="arb-devel boost-devel brial-devel cliquer-devel ecl eclib-devel
|
|||
libpng-devel linbox-devel m4ri-devel m4rie-devel mpfi-devel
|
||||
mpfr-devel ntl-devel openblas-devel pari-devel planarity-devel python3-cypari2
|
||||
python3-cysignals python3-devel python3-gmpy2 python3-memory_allocator
|
||||
python3-numpy rankwidth-devel singular symmetrica-devel zn_poly"
|
||||
python3-numpy rankwidth-devel singular symmetrica-devel"
|
||||
depends="FlintQS eclib-devel fflas-ffpack flintlib-devel gcc-fortran gd-devel
|
||||
gfan giac gsl-devel gzip libpng-devel linbox-devel m4ri-devel maxima-ecl
|
||||
mpfr-devel nauty ntl-devel palp pari-devel pari-elldata-small pari-galdata
|
||||
|
@ -32,7 +32,7 @@ maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
|
|||
license="GPL-2.0-or-later"
|
||||
homepage="http://sagemath.org/"
|
||||
distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
|
||||
checksum=9f26f14aa322e3cf38a71835b12ac34b23026b467f74d54b064c5d025e76fbfd
|
||||
checksum=2aff28bd1d18c2d526581f5298acb8336f5b92db5675a7403dec8eaf9a86bc4c
|
||||
|
||||
do_configure() {
|
||||
# git tree needs bootstrapping
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
pkgname="sage"
|
||||
site="https://mirrors.mit.edu/sage/src/index.html"
|
Loading…
Reference in New Issue