Opened 7 years ago

Closed 7 years ago

#18915 closed defect (fixed)

Finite field extension fails if modulus is of type int

Reported by: dlucas Owned by:
Priority: major Milestone: sage-6.9
Component: finite rings Keywords:
Cc: Merged in:
Authors: David Lucas Reviewers: Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: 60429e5 (Commits, GitHub, GitLab) Commit: 60429e5803cedfa6d50656828d08894364f7cd81
Dependencies: Stopgaps:

Status badges

Description

I noticed the following:

sage: F = GF(2)
sage: F.extension(int(3), 'a')
Traceback (most recent call last)
...
UndoundLocalError: local variable 'E' referenced before assignment

and

sage: F = GF(2 ** 4, 'a')
sage: F.extension(int(3), 'aa')
Traceback (most recent call last)
...
TypeError: polynomial (=3) must be a polynomial.

while

sage: F.extension(Integer(3), 'aa')
Finite Field in aa of size 2^12

works fine.

This is due to the isinstance calls which check only if modulus is of type Integer on the dedicated check instead of checking for int type as well.

Change History (4)

comment:1 Changed 7 years ago by dlucas

  • Branch set to u/dlucas/int_bug_extension

comment:2 Changed 7 years ago by dlucas

  • Commit set to 60429e5803cedfa6d50656828d08894364f7cd81
  • Status changed from new to needs_review

New commits:

60429e5Fixed bug when passing the modulus as a Python int

comment:3 Changed 7 years ago by vdelecroix

  • Authors set to David Lucas
  • Milestone changed from sage-6.8 to sage-6.9
  • Reviewers set to Vincent Delecroix
  • Status changed from needs_review to positive_review

Hello David,

Please fill the Authors field with your full name when you do a ticket.

Otherwise, it is good go!

Vincent

comment:4 Changed 7 years ago by vbraun

  • Branch changed from u/dlucas/int_bug_extension to 60429e5803cedfa6d50656828d08894364f7cd81
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.