Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #33193: redeclare val_unit() in padic subclasses that override it.
Browse files Browse the repository at this point in the history
When overriding a C method to add optional parameters in Cython, you
have to re-declare the method in the corresponding subclass pxd file;
otherwise, you'll get warnings like those that Cython is throwing:

  warning: sage/rings/padics/CR_template.pxi:1478:10: Compatible but
  non-identical C method 'val_unit' not redeclared in definition part
  of extension type 'CRElement'.  This may cause incorrect vtables to
  be generated.

In this case, things are a bit convoluted due to templates being used,
but the solution still boils down to re-declaring the subclass methods
with the additional optional argument.
  • Loading branch information
orlitzky committed Jan 17, 2022
1 parent f9b2db9 commit e3f08e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sage/rings/padics/CR_template_header.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cdef class CRElement(pAdicTemplateElement):

cdef CRElement _new_c(self)
cdef int _normalize(self) except -1
cpdef val_unit(self, p=*)

cdef class pAdicCoercion_ZZ_CR(RingHomomorphism):
cdef CRElement _zero
Expand Down
1 change: 1 addition & 0 deletions src/sage/rings/padics/FP_template_header.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cdef class FPElement(pAdicTemplateElement):
cdef FPElement _new_c(self)
cdef int _normalize(self) except -1
cdef int _set_infinity(self) except -1
cpdef val_unit(self, p=*)

cdef class pAdicCoercion_ZZ_FP(RingHomomorphism):
cdef FPElement _zero
Expand Down

0 comments on commit e3f08e8

Please sign in to comment.