Skip to content

Commit

Permalink
sagemath: update to cython 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tornaria committed Aug 30, 2023
1 parent a39f139 commit 9b28949
Show file tree
Hide file tree
Showing 4 changed files with 11,202 additions and 0 deletions.
38 changes: 38 additions & 0 deletions srcpkgs/sagemath/patches/36109-00pre.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
pre-patch so that PR #36109 applies cleanly on top of 10.1
--- a/src/sage/categories/modules_with_basis.py
+++ b/src/sage/categories/modules_with_basis.py
@@ -66,8 +66,8 @@ class ModulesWithBasis(CategoryWithAxiom_over_base_ring):

Let `X` and `Y` be two modules with basis. We can build `Hom(X,Y)`::

- sage: X = CombinatorialFreeModule(QQ, [1,2]); X.__custom_name = "X" # optional - sage.modules
- sage: Y = CombinatorialFreeModule(QQ, [3,4]); Y.__custom_name = "Y" # optional - sage.modules
- sage: H = Hom(X, Y); H # optional - sage.modules
+ sage: X = CombinatorialFreeModule(QQ, [1,2]); X.__custom_name = "X" # needs sage.modules
+ sage: Y = CombinatorialFreeModule(QQ, [3,4]); Y.__custom_name = "Y" # needs sage.modules
+ sage: H = Hom(X, Y); H # needs sage.modules
Set of Morphisms from X to Y
in Category of finite dimensional vector spaces with basis over Rational Field
--- a/src/sage/categories/hopf_algebras_with_basis.py
+++ b/src/sage/categories/hopf_algebras_with_basis.py
@@ -36,7 +36,7 @@ class HopfAlgebrasWithBasis(CategoryWithAxiom_over_base_ring):
- sage: A = C.example(); A # optional - sage.groups
+ sage: A = C.example(); A # needs sage.groups
An example of Hopf algebra with basis: the group algebra of the
Dihedral group of order 6 as a permutation group over Rational Field
- sage: A.__custom_name = "A" # optional - sage.groups
- sage: A.category() # optional - sage.groups
+ sage: A.__custom_name = "A" # needs sage.groups
+ sage: A.category() # needs sage.groups
Category of finite dimensional hopf algebras with basis over Rational Field

--- a/src/sage/misc/cachefunc.pyx
+++ b/src/sage/misc/cachefunc.pyx
@@ -302,6 +302,7 @@ ought to be chosen. A typical example is
or have a public attribute of type ``<dict>`` called ``__cached_methods``. The
latter is easy::

+ sage: # needs sage.misc.cython
sage: cython_code = [
....: "from sage.misc.cachefunc import cached_method",
....: "cdef class MyClass:",
65 changes: 65 additions & 0 deletions srcpkgs/sagemath/patches/36110-00pre.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
pre-patch so that PR #36110 applies cleanly on top of 10.1
--- a/src/sage/misc/cachefunc.pyx
+++ b/src/sage/misc/cachefunc.pyx
@@ -49,7 +49,7 @@ be used::
- sage: cython('''cpdef test_funct(x): return -x''') # optional - sage.misc.cython
- sage: wrapped_funct = cached_function(test_funct, name='wrapped_funct') # optional - sage.misc.cython
- sage: wrapped_funct # optional - sage.misc.cython
+ sage: cython('''cpdef test_funct(x): return -x''')
+ sage: wrapped_funct = cached_function(test_funct, name='wrapped_funct')
+ sage: wrapped_funct
Cached version of <built-in function test_funct>
- sage: wrapped_funct.__name__ # optional - sage.misc.cython
+ sage: wrapped_funct.__name__
'wrapped_funct'
- sage: wrapped_funct(5) # optional - sage.misc.cython
+ sage: wrapped_funct(5)
@@ -82,9 +82,9 @@ approach is still needed for cpdef methods::
- sage: cython(os.linesep.join(cython_code)) # optional - sage.misc.cython
- sage: O = MyClass() # optional - sage.misc.cython
- sage: O.direct_method # optional - sage.misc.cython
+ sage: cython(os.linesep.join(cython_code))
+ sage: O = MyClass()
+ sage: O.direct_method
Cached version of <method 'direct_method' of '...MyClass' objects>
- sage: O.wrapped_method # optional - sage.misc.cython
+ sage: O.wrapped_method
Cached version of <built-in function test_meth>
- sage: O.wrapped_method.__name__ # optional - sage.misc.cython
+ sage: O.wrapped_method.__name__
'wrapped_method'
- sage: O.wrapped_method(5) # optional - sage.misc.cython
+ sage: O.wrapped_method(5)
@@ -270,6 +270,6 @@ Introspection works::
"some doc for a wrapped cython method"
return -x
- sage: print(sage_getsource(O.direct_method)) # optional - sage.misc.cython
+ sage: print(sage_getsource(O.direct_method))
def direct_method(self, x):
"Some doc for direct method"
return 2*x
--- a/src/sage/misc/lazy_import.pyx
+++ b/src/sage/misc/lazy_import.pyx
@@ -1095,6 +1095,7 @@ def lazy_import(module, names, as_=None, *,
- sage: lazy_import('ppl', 'equation', feature=PythonModule('ppl', spkg='pplpy', type='standard'))
- sage: equation
+ sage: lazy_import('ppl', 'equation',
+ ....: feature=PythonModule('ppl', spkg='pplpy', type='standard'))
+ sage: equation # needs pplpy
<built-in function equation>
sage: lazy_import('PyNormaliz', 'NmzListConeProperties', feature=PythonModule('PyNormaliz', spkg='pynormaliz')) # optional - pynormaliz
sage: NmzListConeProperties # optional - pynormaliz
<built-in function NmzListConeProperties>
--- a/src/sage/modules/free_module_element.pyx
+++ b/src/sage/modules/free_module_element.pyx
@@ -1634,7 +1634,7 @@ cdef class FreeModuleElement(Vector): # abstract base class

- sage: v = vector([1,2/3,pi])
- sage: v.items()
+ sage: v = vector([1,2/3,pi]) # needs sage.symbolic
+ sage: v.items() # needs sage.symbolic
<generator object at ...>
- sage: list(v.items())
+ sage: list(v.items()) # needs sage.symbolic
[(0, 1), (1, 2/3), (2, pi)]

Loading

0 comments on commit 9b28949

Please sign in to comment.