Skip to content

Commit ca895eb

Browse files
committed
reviewer feedback
1 parent 0c576d9 commit ca895eb

File tree

3 files changed

+20
-36
lines changed

3 files changed

+20
-36
lines changed

src/flint/types/acb_poly.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ cdef class acb_poly(flint_poly):
197197
return u
198198

199199
def __pos__(self):
200-
return self
200+
return self # ?
201201

202202
def __neg__(s):
203203
u = acb_poly.__new__(acb_poly)

src/flint/types/arb_poly.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ cdef class arb_poly(flint_poly):
194194
return u
195195

196196
def __pos__(self):
197-
return self
197+
return self # ?
198198

199199
def __neg__(s):
200200
u = arb_poly.__new__(arb_poly)

src/flint/types/fmpz.pyx

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -527,45 +527,29 @@ cdef class fmpz(flint_scalar):
527527
fmpz_clear(tval)
528528
return u
529529

530-
# This is the correct code when fmpz_or is fixed (in flint 3.0.0)
531-
532-
# def __or__(self, other):
533-
# cdef fmpz_struct tval[1]
534-
# cdef int ttype = FMPZ_UNKNOWN
535-
# ttype = fmpz_set_any_ref(tval, other)
536-
# if ttype == FMPZ_UNKNOWN:
537-
# return NotImplemented
538-
# u = fmpz.__new__(fmpz)
539-
# fmpz_or((<fmpz>u).val, self.val, tval)
540-
# if ttype == FMPZ_TMP:
541-
# fmpz_clear(tval)
542-
# return u
543-
544-
# def __ror__(self, other):
545-
# cdef fmpz_struct tval[1]
546-
# cdef int ttype = FMPZ_UNKNOWN
547-
# ttype = fmpz_set_any_ref(tval, other)
548-
# if ttype == FMPZ_UNKNOWN:
549-
# return NotImplemented
550-
# u = fmpz.__new__(fmpz)
551-
# fmpz_or((<fmpz>u).val, tval, self.val)
552-
# if ttype == FMPZ_TMP:
553-
# fmpz_clear(tval)
554-
# return u
555-
556530
def __or__(self, other):
557-
if typecheck(other, fmpz):
558-
other = int(other)
559-
if typecheck(other, int):
560-
return fmpz(int(self) | other)
561-
else:
531+
cdef fmpz_struct tval[1]
532+
cdef int ttype = FMPZ_UNKNOWN
533+
ttype = fmpz_set_any_ref(tval, other)
534+
if ttype == FMPZ_UNKNOWN:
562535
return NotImplemented
536+
u = fmpz.__new__(fmpz)
537+
fmpz_or((<fmpz>u).val, self.val, tval)
538+
if ttype == FMPZ_TMP:
539+
fmpz_clear(tval)
540+
return u
563541

564542
def __ror__(self, other):
565-
if typecheck(other, int):
566-
return fmpz(other | int(self))
567-
else:
543+
cdef fmpz_struct tval[1]
544+
cdef int ttype = FMPZ_UNKNOWN
545+
ttype = fmpz_set_any_ref(tval, other)
546+
if ttype == FMPZ_UNKNOWN:
568547
return NotImplemented
548+
u = fmpz.__new__(fmpz)
549+
fmpz_or((<fmpz>u).val, tval, self.val)
550+
if ttype == FMPZ_TMP:
551+
fmpz_clear(tval)
552+
return u
569553

570554
def __xor__(self, other):
571555
cdef fmpz_struct tval[1]

0 commit comments

Comments
 (0)