Skip to content

Commit

Permalink
Merge pull request #177 from oscarbenjamin/pr_cython_fixes
Browse files Browse the repository at this point in the history
Fixes for latest Cython master
  • Loading branch information
oscarbenjamin authored Aug 8, 2024
2 parents c7720be + d9a0296 commit c4847e7
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 21 deletions.
7 changes: 0 additions & 7 deletions src/flint/types/arb.pyx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from cpython.float cimport PyFloat_AS_DOUBLE
from cpython.version cimport PY_MAJOR_VERSION
from cpython.int cimport PyInt_AS_LONG
from cpython.long cimport PyLong_Check
from cpython.int cimport PyInt_Check

from flint.flint_base.flint_context cimport getprec
from flint.flint_base.flint_context cimport thectx
Expand Down Expand Up @@ -86,10 +83,6 @@ cdef int arb_set_python(arb_t x, obj, bint allow_conversion) except -1:
arb_set_fmpq(x, (<fmpq>obj).val, getprec())
return 1

if PY_MAJOR_VERSION < 3 and PyInt_Check(obj):
arb_set_si(x, PyInt_AS_LONG(obj))
return 1

if PyLong_Check(obj):
fmpz_init(t)
fmpz_set_pylong(t, obj)
Expand Down
6 changes: 0 additions & 6 deletions src/flint/types/fmpz.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from cpython.int cimport PyInt_Check, PyInt_AS_LONG
from cpython.long cimport PyLong_Check
from flint.flint_base.flint_base cimport flint_scalar
from flint.utils.conversion cimport chars_from_str
Expand All @@ -7,8 +6,6 @@ from flint.flintlib.flint cimport slong, pylong_as_slong
from flint.flintlib.flint cimport PyObject
from flint.flintlib.fmpz cimport fmpz_t, fmpz_set_str, fmpz_set_si

from cpython.version cimport PY_MAJOR_VERSION

cdef int fmpz_set_any_ref(fmpz_t x, obj)
cdef fmpz_get_intlong(fmpz_t x)

Expand All @@ -23,9 +20,6 @@ cdef inline int fmpz_set_pylong(fmpz_t x, obj):
fmpz_set_si(x, longval)

cdef inline int fmpz_set_python(fmpz_t x, obj):
if PY_MAJOR_VERSION < 3 and PyInt_Check(obj):
fmpz_set_si(x, PyInt_AS_LONG(obj))
return 1
if PyLong_Check(obj):
fmpz_set_pylong(x, obj)
return 1
Expand Down
2 changes: 0 additions & 2 deletions src/flint/types/fmpz_poly.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from cpython.int cimport PyInt_AS_LONG
from cpython.list cimport PyList_GET_SIZE
from cpython.long cimport PyLong_Check
from cpython.int cimport PyInt_Check

from flint.flint_base.flint_context cimport getprec
from flint.flint_base.flint_base cimport flint_poly
Expand Down
6 changes: 0 additions & 6 deletions src/flint/types/nmod_poly.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,6 @@ cdef class nmod_poly(flint_poly):
else:
raise TypeError("cannot set element of type %s" % type(x))

def degree(self):
return nmod_poly_degree(self.val)

def length(self):
return nmod_poly_length(self.val)

def __bool__(self):
return not nmod_poly_is_zero(self.val)

Expand Down

0 comments on commit c4847e7

Please sign in to comment.