From 077c868ad7f1488eaf1afeb5eec196b32d6cfc5d Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Wed, 7 Aug 2024 19:09:00 +0100 Subject: [PATCH] Fix error messages from fmpq constructor --- src/flint/types/fmpq.pyx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/flint/types/fmpq.pyx b/src/flint/types/fmpq.pyx index d359080a..fd9399b0 100644 --- a/src/flint/types/fmpq.pyx +++ b/src/flint/types/fmpq.pyx @@ -84,25 +84,25 @@ cdef class fmpq(flint_scalar): p = fmpz(p) q = fmpz(1) else: - p = any_as_fmpq(p) - if p is NotImplemented: + p2 = any_as_fmpq(p) + if p2 is NotImplemented: raise TypeError("cannot create fmpq from object of type %s" % type(p)) - fmpq_set(self.val, (p).val) + fmpq_set(self.val, (p2).val) return else: raise TypeError("fmpq() takes at most 2 arguments (%d given)" % len(args)) - p = any_as_fmpz(p) - if p is NotImplemented: + p2 = any_as_fmpz(p) + if p2 is NotImplemented: raise TypeError("cannot create fmpq from object of type %s" % type(p)) - q = any_as_fmpz(q) - if q is NotImplemented: + q2 = any_as_fmpz(q) + if q2 is NotImplemented: raise TypeError("cannot create fmpq from object of type %s" % type(q)) - if fmpz_is_zero((q).val): + if fmpz_is_zero((q2).val): raise ZeroDivisionError("cannot create rational number with zero denominator") - fmpz_set(fmpq_numref(self.val), (p).val) - fmpz_set(fmpq_denref(self.val), (q).val) + fmpz_set(fmpq_numref(self.val), (p2).val) + fmpz_set(fmpq_denref(self.val), (q2).val) fmpq_canonicalise(self.val) def __richcmp__(s, t, int op):