Skip to content

Commit 077c868

Browse files
committed
Fix error messages from fmpq constructor
1 parent eeec806 commit 077c868

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/flint/types/fmpq.pyx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,25 @@ cdef class fmpq(flint_scalar):
8484
p = fmpz(p)
8585
q = fmpz(1)
8686
else:
87-
p = any_as_fmpq(p)
88-
if p is NotImplemented:
87+
p2 = any_as_fmpq(p)
88+
if p2 is NotImplemented:
8989
raise TypeError("cannot create fmpq from object of type %s" % type(p))
90-
fmpq_set(self.val, (<fmpq>p).val)
90+
fmpq_set(self.val, (<fmpq>p2).val)
9191
return
9292
else:
9393
raise TypeError("fmpq() takes at most 2 arguments (%d given)" % len(args))
9494

95-
p = any_as_fmpz(p)
96-
if p is NotImplemented:
95+
p2 = any_as_fmpz(p)
96+
if p2 is NotImplemented:
9797
raise TypeError("cannot create fmpq from object of type %s" % type(p))
98-
q = any_as_fmpz(q)
99-
if q is NotImplemented:
98+
q2 = any_as_fmpz(q)
99+
if q2 is NotImplemented:
100100
raise TypeError("cannot create fmpq from object of type %s" % type(q))
101-
if fmpz_is_zero((<fmpz>q).val):
101+
if fmpz_is_zero((<fmpz>q2).val):
102102
raise ZeroDivisionError("cannot create rational number with zero denominator")
103103

104-
fmpz_set(fmpq_numref(self.val), (<fmpz>p).val)
105-
fmpz_set(fmpq_denref(self.val), (<fmpz>q).val)
104+
fmpz_set(fmpq_numref(self.val), (<fmpz>p2).val)
105+
fmpz_set(fmpq_denref(self.val), (<fmpz>q2).val)
106106
fmpq_canonicalise(self.val)
107107

108108
def __richcmp__(s, t, int op):

0 commit comments

Comments
 (0)