From 5ddff69615e6d341c1360713d96b9f5ac62d40a1 Mon Sep 17 00:00:00 2001 From: Andreas Enge Date: Fri, 19 Dec 2025 16:44:05 +0100 Subject: [PATCH] gnu: sage: Update to 10.7. * gnu/packages/patches/sage-safeguard-sage-getargspec-cython.patch: Remove file. * gnu/local.mk (dist_patch_DATA): Unregister patch. * gnu/packages/sagemath.scm (sage): Update to 10.7. [origin]: Remove patch. Change-Id: I64093e73369bd378b2553df589f0e2c6e5097aef --- gnu/local.mk | 1 - ...age-safeguard-sage-getargspec-cython.patch | 79 ------------------- gnu/packages/sagemath.scm | 9 +-- 3 files changed, 2 insertions(+), 87 deletions(-) delete mode 100644 gnu/packages/patches/sage-safeguard-sage-getargspec-cython.patch diff --git a/gnu/local.mk b/gnu/local.mk index 82d1acd82511521eeb60b897aa3b980c4156a7ba..820ebdb5c7256ca674e9173e6d487e366a54f91d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2283,7 +2283,6 @@ dist_patch_DATA = \ %D%/packages/patches/rxvt-unicode-fix-cursor-position.patch \ %D%/packages/patches/s7-flint-3.patch \ %D%/packages/patches/safeint-disable-tests.patch \ - %D%/packages/patches/sage-safeguard-sage-getargspec-cython.patch \ %D%/packages/patches/sajson-for-gemmi-numbers-as-strings.patch \ %D%/packages/patches/sajson-build-with-gcc10.patch \ %D%/packages/patches/sane-look-for-plugins-in-SANE_BACKEND_LIB_PATH.patch \ diff --git a/gnu/packages/patches/sage-safeguard-sage-getargspec-cython.patch b/gnu/packages/patches/sage-safeguard-sage-getargspec-cython.patch deleted file mode 100644 index 19354703a791181c1c8ad33cfb6313ce64cfb62c..0000000000000000000000000000000000000000 --- a/gnu/packages/patches/sage-safeguard-sage-getargspec-cython.patch +++ /dev/null @@ -1,79 +0,0 @@ -From d87a60c54453763476845138133ad7da54c159a7 Mon Sep 17 00:00:00 2001 -From: user202729 <25191436+user202729@users.noreply.github.com> -Date: Mon, 24 Mar 2025 10:38:12 +0700 -Subject: [PATCH 1/2] Safeguard _sage_getargspec_cython - ---- -This patch was taken from: https://github.com/sagemath/sage/pull/39776 -It will be released in version 10.7 and can be removed after the upgrade. - - src/sage/misc/sageinspect.py | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py -index 6fc0e29551f..d25f1f81820 100644 ---- a/src/sage/misc/sageinspect.py -+++ b/src/sage/misc/sageinspect.py -@@ -1139,6 +1139,11 @@ def _sage_getargspec_cython(source): - defaults=('a string', {(1, 2, 3): True}), - kwonlyargs=[], kwonlydefaults=None, annotations={}) - """ -+ if not isinstance(source, str): -+ # the caller ought to ensure this, but if it forgets (e.g. passing None), -+ # we raise the correct exception type to avoid confusing error message -+ # and possible further hard-to-debug errors, see :issue:`39735` -+ raise TypeError - defpos = source.find('def ') - assert defpos > -1, "The given source does not contain 'def'" - s = source[defpos:].strip() - -From 21dd8224fca8a70490c754309350d08f56178809 Mon Sep 17 00:00:00 2001 -From: user202729 <25191436+user202729@users.noreply.github.com> -Date: Thu, 27 Mar 2025 22:58:22 +0700 -Subject: [PATCH 2/2] Change to AssertionError and handle issue upstream - ---- - src/sage/misc/sageinspect.py | 22 ++++++++++++---------- - 1 file changed, 12 insertions(+), 10 deletions(-) - -diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py -index b617e288b97..bb704d74075 100644 ---- a/src/sage/misc/sageinspect.py -+++ b/src/sage/misc/sageinspect.py -@@ -1140,11 +1140,10 @@ def _sage_getargspec_cython(source): - defaults=('a string', {(1, 2, 3): True}), - kwonlyargs=[], kwonlydefaults=None, annotations={}) - """ -- if not isinstance(source, str): -- # the caller ought to ensure this, but if it forgets (e.g. passing None), -- # we raise the correct exception type to avoid confusing error message -- # and possible further hard-to-debug errors, see :issue:`39735` -- raise TypeError -+ assert isinstance(source, str) -+ # the caller ought to ensure this, but if it forgets (e.g. passing None), -+ # we avoid raising AttributeError to avoid confusing error message -+ # and possible further hard-to-debug errors, see :issue:`39735` - defpos = source.find('def ') - assert defpos > -1, "The given source does not contain 'def'" - s = source[defpos:].strip() -@@ -1682,12 +1681,15 @@ def foo(x, a='\')"', b={not (2+1==3):'bar'}): return - except TypeError: # arg is not a code object - # The above "hopefully" was wishful thinking: - try: -- return inspect.FullArgSpec(*_sage_getargspec_cython(sage_getsource(obj))) -+ source = sage_getsource(obj) - except TypeError: # This happens for Python builtins -- # The best we can do is to return a generic argspec -- args = [] -- varargs = 'args' -- varkw = 'kwds' -+ source = None -+ if source is not None: -+ return inspect.FullArgSpec(*_sage_getargspec_cython(source)) -+ # The best we can do is to return a generic argspec -+ args = [] -+ varargs = 'args' -+ varkw = 'kwds' - try: - defaults = func_obj.__defaults__ - except AttributeError: diff --git a/gnu/packages/sagemath.scm b/gnu/packages/sagemath.scm index 1638b8a004bd50d2bb888f61e908eb324544bc72..a43eab54b7aa53521841950f5d2b57621732ec05 100644 --- a/gnu/packages/sagemath.scm +++ b/gnu/packages/sagemath.scm @@ -363,21 +363,16 @@ database.") (define-public sage (package (name "sage") - (version "10.6") + (version "10.7") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/sagemath/sage") (commit version))) (file-name (git-file-name name version)) - (patches - ;; This patch works around a Cython issue and can be removed - ;; after sage 10.7 is released. See - ;; https://github.com/sagemath/sage/issues/39735 - (search-patches "sage-safeguard-sage-getargspec-cython.patch")) (sha256 (base32 - "0m2f6k6nwgyzfhf45r0kp798aimjxhpfnmsp1k03jpj9d6mhadk4")))) + "0513nmym1shlj0vkb982hpj1v86f327w5kav0523wk1xljc432cx")))) (build-system pyproject-build-system) (native-inputs (list autoconf automake m4 pkg-config ; for ./bootstrap