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

Commit

Permalink
py3: some care for libs/ntl
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Chapoton authored and embray committed Nov 26, 2018
1 parent 1d7066c commit 79d5bdf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/sage/libs/ntl/ntl_GF2X.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ cdef class ntl_GF2X(object):
TESTS::
sage: hex(e)
sage: hex(e) # py2
doctest:warning...:
DeprecationWarning: use the method .hex instead
See http://trac.sagemath.org/24514 for details.
Expand Down
16 changes: 7 additions & 9 deletions src/sage/libs/ntl/ntl_ZZ_pX.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2005 William Stein <[email protected]>
#
# Distributed under the terms of the GNU General Public License (GPL)
Expand All @@ -10,9 +10,8 @@
#
# The full text of the GPL is available at:
#
# http://www.gnu.org/licenses/
#*****************************************************************************

# https://www.gnu.org/licenses/
# ****************************************************************************
from __future__ import absolute_import, division, print_function

from cysignals.signals cimport sig_on, sig_off
Expand Down Expand Up @@ -57,7 +56,7 @@ cdef make_ZZ_pX(ZZ_pX_c* x, ntl_ZZ_pContext_class ctx):

cdef class ntl_ZZ_pX(object):
r"""
The class \class{ZZ_pX} implements polynomial arithmetic modulo $p$.
The class \class{ZZ_pX} implements polynomial arithmetic modulo `p`.
Polynomial arithmetic is implemented using the FFT, combined with
the Chinese Remainder Theorem. A more detailed description of the
Expand Down Expand Up @@ -94,11 +93,10 @@ cdef class ntl_ZZ_pX(object):

if isinstance(v, ntl_ZZ_pX) and (<ntl_ZZ_pX>v).c is self.c:
self.x = (<ntl_ZZ_pX>v).x
elif isinstance(v, list) or isinstance(v, tuple):
for i from 0 <= i < len(v):
x = v[i]
elif isinstance(v, (list, tuple, range)):
for i, x in enumerate(v):
if not isinstance(x, ntl_ZZ_p):
cc = ntl_ZZ_p(x,self.c)
cc = ntl_ZZ_p(x, self.c)
else:
cc = x
ZZ_pX_SetCoeff(self.x, i, cc.x)
Expand Down

0 comments on commit 79d5bdf

Please sign in to comment.