Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E = EllipticCurve('10a1') gives a stupid traceback (rather than a smart one) #12565

Closed
williamstein opened this issue Feb 22, 2012 · 31 comments
Closed

Comments

@williamstein
Copy link
Contributor

I don't like this error:

sage: E = EllipticCurve('10a1')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/Users/wstein/sage/install/sage-5.0.beta2/devel/sage-git/sage/modular/modsym/padic_lseries/<ipython console> in <module>()

/Users/wstein/sage/install/sage-5.0.beta2/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/constructor.pyc in EllipticCurve(x, y, j)
    293         
    294     if isinstance(x, str):
--> 295         return ell_rational_field.EllipticCurve_rational_field(x)
    296         
    297     if rings.is_RingElement(x) and y is None:

/Users/wstein/sage/install/sage-5.0.beta2/local/lib/python2.7/site-packages/sage/schemes/elliptic_curves/ell_rational_field.pyc in __init__(self, ainvs, extra)
    197             label = ainvs
    198             X = sage.databases.cremona.CremonaDatabase()[label]
--> 199             EllipticCurve_number_field.__init__(self, Q, list(X.a_invariants()))
    200             self.__np = {}
    201             self.__gens = {}

AttributeError: 'NoneType' object has no attribute 'a_invariants'

I would expect something like:

ValueError: no known curve with Cremona label '10a1' 

Another bug. If you use Sage for a level outside the Cremona range and you're using a system-wide Sage install, this is the error you get, which is pretty scary looking:

sage: E = EllipticCurve('10050000s1')
Traceback (most recent call last):
  File "/usr/local/share/sage-4.8/local/bin/sage-list-packages", line 21, in <module>
    os.makedirs(SAGE_ROOT_TMP)
  File "/usr/local/share/sage-4.8/local/lib/python/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/share/sage-4.8/tmp'
Using SAGE Server http://www.sagemath.org//packages

Optional package list (shown above) appears to be currently not available or corrupted (network error?).
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/wstein/<ipython console> in <module>()

/usr/local/share/sage-4.8/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/constructor.pyc in EllipticCurve(x, y, j)
    293         
    294     if isinstance(x, str):
--> 295         return ell_rational_field.EllipticCurve_rational_field(x)
    296         
    297     if rings.is_RingElement(x) and y is None:

/usr/local/share/sage-4.8/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_rational_field.pyc in __init__(self, ainvs, extra)
    197             label = ainvs
    198             X = sage.databases.cremona.CremonaDatabase()[label]
--> 199             EllipticCurve_number_field.__init__(self, Q, list(X.a_invariants()))
    200             self.__np = {}
    201             self.__gens = {}

AttributeError: 'NoneType' object has no attribute 'a_invariants'

Apply patch at #12341

Apply attachment: trac_12565-rebase.patch

Depends on #12341

Component: elliptic curves

Author: R. Andrew Ohana

Reviewer: John Cremona

Merged: sage-5.5.beta2

Issue created by migration from https://trac.sagemath.org/ticket/12565

@JohnCremona
Copy link
Member

comment:1

That is really stupid. I'm sure it never used to do that --but why is there not a dictest for this construction on a failing string? I wonder if this came in with the new database implmentation. The error should surely be raised in the call to teh class contructor with the string, not just returning None.

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

comment:2

Replying to @JohnCremona:

I wonder if this came in with the new database implementation.

Yup, with 4.7.2 (pre database change)

sage: EllipticCurve('10a1')
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

/home/ohanar/sage-dev/sage-4.7.2-sage.math.washington.edu-x86_64-Linux/<ipython console> in <module>()

/home/ohanar/sage-dev/sage-4.7.2-sage.math.washington.edu-x86_64-Linux/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/constructor.pyc in EllipticCurve(x, y, j)
    293         
    294     if isinstance(x, str):
--> 295         return ell_rational_field.EllipticCurve_rational_field(x)
    296         
    297     if rings.is_RingElement(x) and y is None:

/home/ohanar/sage-dev/sage-4.7.2-sage.math.washington.edu-x86_64-Linux/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_rational_field.pyc in __init__(self, ainvs, extra)
    196         if isinstance(ainvs, str):
    197             label = ainvs
--> 198             X = sage.databases.cremona.CremonaDatabase()[label]
    199             EllipticCurve_number_field.__init__(self, Q, list(X.a_invariants()))
    200             self.__np = {}

/home/ohanar/sage-dev/sage-4.7.2-sage.math.washington.edu-x86_64-Linux/local/lib/python2.6/site-packages/sage/databases/cremona.pyc in __getitem__(self, N)
    453                 return sage.databases.db.Database.__getitem__(self, N)
    454             else:
--> 455                 return self.elliptic_curve(N)
    456         try:
    457             N = int(N)

/home/ohanar/sage-dev/sage-4.7.2-sage.math.washington.edu-x86_64-Linux/local/lib/python2.6/site-packages/sage/databases/cremona.pyc in elliptic_curve(self, label)
    693             else:
    694                 message = "There is no elliptic curve with label "+label+" in the currently available databases"
--> 695             raise RuntimeError, message
    696         
    697         F = elliptic.EllipticCurve(e[0])

RuntimeError: There is no elliptic curve with label 10a1 in the database (note: use lower case letters!)

I'll go see about fixing this now.

For the other bug, that looks like it might not be specific to the cremona database.

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

comment:3

ok, that first bug was really stupid. The error message was being created, but it was never being raised. This also gives the correct error for the other end of the spectrum, but it doesn't fix the scary permissions error. I'm going to see what that is about now.

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

Author: R. Andrew Ohana

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

comment:4

so #12341 fixes the other issue, please review these two tickets

@williamstein
Copy link
Contributor Author

comment:5

I think this error message is annoying:

RuntimeError: There is no elliptic curve with label 10a1 in the database (note: use lower case letters!) 

I can see putting " (note: use lower case letters!) " if the user input "10A1", but if they already input lower case letters, why add that remark!?

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

comment:6

ok, changed that by making it accept old cremona labels (and having the label parser actually throw errors if there is a problem with the label)

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

Dependencies: #11341

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

comment:7

dependency was added since otherwise this patch no longer applies cleanly

@williamstein
Copy link
Contributor Author

comment:8

Include an example that illustrates the following: "accept old cremona labels"

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

comment:9

Replying to @williamstein:

Include an example that illustrates the following: "accept old cremona labels"

Where? In the elliptic curve constructor, the database method, or both?

@williamstein
Copy link
Contributor Author

comment:10

In the elliptic curve constructor, the database method, or both?

In both, and use different examples in each case (it's your chance to be creative!)

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

Attachment: trac12565.patch.gz

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

comment:11

ok, hopefully there that satisfies all of your complaints :)

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

comment:12

oops, put the wrong ticket as the dependency

@ohanar
Copy link
Member

ohanar commented Feb 23, 2012

Changed dependencies from #11341 to #12341

@ohanar
Copy link
Member

ohanar commented Feb 24, 2012

comment:15

Replying to @JohnCremona:

I get an error applying the patch to 5.0.beta5, at line 677 in sage/databases/cremona.py with reject messsage

This patch was based off of #12341 which also touches this file, which is why I added it as a dependency. (The reason why it fails is due to the line following the one that generates the error message, it is changed in #12341)

@ohanar

This comment has been minimized.

@JohnCremona
Copy link
Member

comment:17

Replying to @ohanar:

Replying to @JohnCremona:

I get an error applying the patch to 5.0.beta5, at line 677 in sage/databases/cremona.py with reject messsage

This patch was based off of #12341 which also touches this file, which is why I added it as a dependency. (The reason why it fails is due to the line following the one that generates the error message, it is changed in #12341)

Sorry, my mistake -- I did not notice the dependency. I will get back to it.

@JohnCremona
Copy link
Member

comment:18

With #12341 this applies (to 5.0.beta5) and works fine.

@jdemeyer jdemeyer removed this from the sage-5.0 milestone Mar 7, 2012
@JohnCremona
Copy link
Member

Work Issues: needs rebase

@JohnCremona
Copy link
Member

Rebasing after #12341's rebase

@JohnCremona
Copy link
Member

comment:21

Attachment: trac_12565-rebase.patch.gz

I have rebased the patch so that it now works after the rebased #12341.

This was not quite trivial as a little extra coding was needed so that "Old Cremona labels" could be parsed properly using the regexp method.

I tested sage/databses/cremona.py and all in sage/schemes/elliptic_curves.

@JohnCremona

This comment has been minimized.

@JohnCremona
Copy link
Member

Changed work issues from needs rebase to none

@ohanar
Copy link
Member

ohanar commented Oct 11, 2012

comment:22

The regexp code looks good to me.

@JohnCremona
Copy link
Member

comment:24

To confirm: I checked that the rebased patch applies to 5.4.rc1+trac_12341.patch (after that was rebased), and that all tests in schemes/elliptic_curves pass (1) without database_ell_cremona installed, (2) with it installed, without "-optional database_cremona_ellcurve", (3) with it installed and with "-optional database_cremona_ellcurve".

The only failed test is the one in heegner.py which fails when the optional database is installed for reasons spelled out elsewhere and to be fixed in #13547.

@jdemeyer jdemeyer added this to the sage-5.5 milestone Nov 1, 2012
@jdemeyer jdemeyer removed the pending label Nov 1, 2012
@jdemeyer
Copy link

Merged: sage-5.5.beta2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants