Ticket #8909: trac_8909_catch_exception.patch

File trac_8909_catch_exception.patch, 1020 bytes (added by SimonKing, 10 years ago)

Specify an exception to be caught

  • sage/rings/number_field/number_field.py

    # HG changeset patch
    # User Simon King <simon.king@nuigalway.ie>
    # Date 1278270514 -3600
    # Node ID 150ee471a85a3594cef96a011ce4d33b403c7527
    # Parent  8eb68f3f9de53cb34b2e8c2852165d5ac16eee30
    NumberField._element_constructor_: Specifying an exception to be caught.
    
    diff -r 8eb68f3f9de5 -r 150ee471a85a sage/rings/number_field/number_field.py
    a b  
    67646764                # it may be that a number field element's string representation
    67656765                # in GAP has an exclamation mark in it.
    67666766                return self(rational.Rational(s.replace('!','')))
    6767             except:
     6767            except TypeError:
    67686768                # There is no 'E(...)' in the string representation. But it may
    67696769                # be that 'E(...)' was overwritten in GAP. We can only hope that
    67706770                # by coincidence the name in GAP is the same as the name in self