Skip to content

Commit

Permalink
Trac #24116: Fix Cython warnings in finite_rings
Browse files Browse the repository at this point in the history
Fix all warnings "Compatible but non-identical C method ... not
redeclared" and "Overriding cdef method with def method"

This is part of #23600

URL: https://trac.sagemath.org/24116
Reported by: jdemeyer
Ticket author(s): Jeroen Demeyer
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager authored and vbraun committed Oct 30, 2017
2 parents 9896ca2 + 9dbd211 commit 20f0073
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/sage/rings/finite_rings/element_base.pxd
@@ -1,7 +1,8 @@
from sage.structure.element cimport CommutativeRingElement

cdef class FiniteRingElement(CommutativeRingElement):
pass
cpdef _add_(self, other)
cpdef _mul_(self, other)

cdef class FinitePolyExtElement(FiniteRingElement):
pass
11 changes: 10 additions & 1 deletion src/sage/rings/finite_rings/element_base.pyx
Expand Up @@ -28,6 +28,7 @@ def is_FiniteFieldElement(x):
from sage.rings.finite_rings.finite_field_base import is_FiniteField
return isinstance(x, Element) and is_FiniteField(x.parent())


cdef class FiniteRingElement(CommutativeRingElement):
def _nth_root_common(self, n, all, algorithm, cunningham):
"""
Expand Down Expand Up @@ -99,6 +100,15 @@ cdef class FiniteRingElement(CommutativeRingElement):
else:
raise ValueError("unknown algorithm")

cpdef _add_(self, other):
"""Abstract addition method"""
raise NotImplementedError

cpdef _mul_(self, other):
"""Abstract multiplication method"""
raise NotImplementedError


cdef class FinitePolyExtElement(FiniteRingElement):
"""
Elements represented as polynomials modulo a given ideal.
Expand Down Expand Up @@ -795,4 +805,3 @@ cdef class FinitePolyExtElement(FiniteRingElement):
b^11 + b^10 + b^9 + b^7 + b^5 + b^4 + b^2 + b
"""
return self.pth_power(-k)

1 change: 0 additions & 1 deletion src/sage/rings/finite_rings/element_givaro.pyx
Expand Up @@ -1130,7 +1130,6 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement):
(<FiniteField_givaroElement>right).element)
return make_FiniteField_givaroElement(self._cache,r)


cpdef _div_(self, right):
"""
Divide two elements
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/finite_rings/finite_field_base.pyx
Expand Up @@ -1073,7 +1073,7 @@ cdef class FiniteField(Field):
and hasattr(self, '_prefix') and hasattr(R, '_prefix')):
return R.hom((self.gen() ** ((self.order() - 1)//(R.order() - 1)),))

def _convert_map_from_(self, R):
cpdef _convert_map_from_(self, R):
"""
Conversion from p-adic fields.
Expand Down

0 comments on commit 20f0073

Please sign in to comment.