We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38b6ce1 commit 52f8847Copy full SHA for 52f8847
src/flint/types/fq_default.pyx
@@ -347,14 +347,12 @@ cdef class fq_default_ctx:
347
return 0
348
349
# For nmod we can convert by taking it as an int
350
- # Ignores the modulus of nmod
351
- if typecheck(obj, nmod):
+ if typecheck(obj, nmod) and self.prime() == obj.modulus():
352
fq_default_set_ui(fq_ele, <ulong>(<nmod>obj).val, self.val)
353
354
355
# For fmpz_mod we can also convert directly
356
- # Assumes that the modulus of the ring matches the context
357
- if typecheck(obj, fmpz_mod):
+ if typecheck(obj, fmpz_mod) and self.prime() == (<fmpz_mod>obj).ctx.modulus():
358
fq_default_set_fmpz(fq_ele, (<fmpz_mod>obj).val, self.val)
359
360
0 commit comments