Opened 2 years ago

Closed 2 years ago

#23472 closed defect (fixed)

The error message for splitting_field when name is None does not match that of NumberField

Reported by: geze Owned by:
Priority: trivial Milestone: sage-8.1
Component: number fields Keywords: NumberField, splitting_field, TypeError, sd87
Cc: Merged in:
Authors: Gerardo Zelaya Reviewers: Kevin Lui
Report Upstream: N/A Work issues:
Branch: 46e66c0 (Commits) Commit: 46e66c0eb9820bc291cf87e1499eb73af7810868
Dependencies: Stopgaps:

Description (last modified by klui)

When one computes:

sage: R.<x> = QQ[]
sage: f = x^2 - 2
sage: K = NumberField(f)

Error in lines 3-3
Traceback (most recent call last):
  File "/usr/local/sage/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in <module>
  File "/usr/local/sage/local/lib/python2.7/site-packages/sage/rings/number_field/number_field.py", line 524, in NumberField
    return NumberField_version2(polynomial=polynomial, name=name, check=check, embedding=embedding, latex_name=latex_name, assume_disc_small=assume_disc_small, maximize_at_primes=maximize_at_primes, structure=structure)
  File "sage/structure/factory.pyx", line 362, in sage.structure.factory.UniqueFactory.__call__ (/usr/local/sage/src/build/cythonized/sage/structure/factory.c:1856)
    key, kwds = self.create_key_and_extra_args(*args, **kwds)
  File "/usr/local/sage/local/lib/python2.7/site-packages/sage/rings/number_field/number_field.py", line 594, in create_key_and_extra_args
    raise TypeError("You must specify the name of the generator.")
TypeError: You must specify the name of the generator.

However when one computes:

sage: f.splitting_field()

Error in lines 3-3
Traceback (most recent call last):
  File "/usr/local/sage/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in <module>
  File "sage/rings/polynomial/polynomial_element.pyx", line 4181, in sage.rings.polynomial.polynomial_element.Polynomial.splitting_field (/usr/local/sage/src/build/cythonized/sage/rings/polynomial/polynomial_element.c:41810)
    def splitting_field(self, names, map=False, **kwds):
TypeError: splitting_field() takes at least 1 positional argument (0 given)

One needs to add the lines:

if name is None:
    raise TypeError("You must specify the name of the generator.")

Before the line:

name = normalize_names(1, name)

in the corresponding file.

Change History (13)

comment:1 Changed 2 years ago by geze

  • Branch set to u/geze/the_error_message_for_splitting_field_when_name_is_none_does_not_match_that_of_numberfield

comment:2 Changed 2 years ago by git

  • Commit set to 3229f40ffa8c542a8336b9ab78b42cce2664bda4

Branch pushed to git repo; I updated commit sha1. New commits:

3229f40add doc test

comment:3 Changed 2 years ago by git

  • Commit changed from 3229f40ffa8c542a8336b9ab78b42cce2664bda4 to 8d20d6b2dbdcdc19467dcd5366e9d77406dd9b11

Branch pushed to git repo; I updated commit sha1. New commits:

8d20d6bchange typos

comment:4 Changed 2 years ago by git

  • Commit changed from 8d20d6b2dbdcdc19467dcd5366e9d77406dd9b11 to 46e66c0eb9820bc291cf87e1499eb73af7810868

Branch pushed to git repo; I updated commit sha1. New commits:

46e66c0change type from name to names

comment:5 Changed 2 years ago by geze

  • Status changed from new to needs_review
  • Type changed from PLEASE CHANGE to defect

comment:6 Changed 2 years ago by klui

  • Description modified (diff)

comment:7 Changed 2 years ago by klui

  • Reviewers set to Kevin Lui
  • Status changed from needs_review to positive_review

Good change. It makes splitting field more consistent with number field.

comment:8 Changed 2 years ago by vbraun

  • Status changed from positive_review to needs_work

Author name is missing...

comment:9 Changed 2 years ago by geze

  • Authors set to geze

comment:10 Changed 2 years ago by vbraun

Author name should be your real name, not the trac username (will be listed in the release notes)

comment:11 Changed 2 years ago by vbraun

Also, please set back to positive review when you are done...

comment:12 Changed 2 years ago by geze

  • Authors changed from geze to Gerardo Zelaya
  • Status changed from needs_work to positive_review

comment:13 Changed 2 years ago by vbraun

  • Branch changed from u/geze/the_error_message_for_splitting_field_when_name_is_none_does_not_match_that_of_numberfield to 46e66c0eb9820bc291cf87e1499eb73af7810868
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.