Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#26892 closed defect (fixed)

Better error message for converting non-constant polynomial

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-8.6
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Jeroen Demeyer Reviewers: Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: cc975e5 (Commits, GitHub, GitLab) Commit: cc975e55c106795e490c8c9af12ee54ab04acd83
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

This should have a better error message:

sage: R.<x,y> = QQ[]
sage: int(x)
TypeError                                 Traceback (most recent call last)
<ipython-input-7-acaae37f5ab0> in <module>()
----> 1 int(x)

/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial.pyx in sage.rings.polynomial.multi_polynomial.MPolynomial.__int__ (build/cythonized/sage/rings/polynomial/multi_polynomial.c:4326)()
     63             return int(self.constant_coefficient())
     64         else:
---> 65             raise TypeError
     67     def __long__(self):


Apart from this, the conversion to ZZ and QQ is changed to not rely on strings (there is no reason for that!).

Change History (7)

comment:1 Changed 4 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Description modified (diff)

comment:2 Changed 4 years ago by jdemeyer

  • Branch set to u/jdemeyer/better_error_message_for_converting_non_constant_polynomial

comment:3 Changed 4 years ago by git

  • Commit set to cc975e55c106795e490c8c9af12ee54ab04acd83

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

cc975e5Better error messages for converting non-constant polynomial

comment:4 Changed 4 years ago by jdemeyer

  • Status changed from new to needs_review

comment:5 Changed 4 years ago by mmezzarobba

  • Reviewers set to Marc Mezzarobba
  • Status changed from needs_review to positive_review

comment:6 Changed 4 years ago by vbraun

  • Branch changed from u/jdemeyer/better_error_message_for_converting_non_constant_polynomial to cc975e55c106795e490c8c9af12ee54ab04acd83
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:7 Changed 4 years ago by embray

  • Milestone changed from sage-8.5 to sage-8.6

This tickets were closed as fixed after the Sage 8.5 release.

Note: See TracTickets for help on using tickets.