Ticket #11310: 11310_auto.patch

File 11310_auto.patch, 107.0 KB (added by Jeroen Demeyer, 11 years ago)
  • doc/common/builder.py

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1340296066 -7200
    # Node ID 70fbebedf416c0d2831f2a5eee555a939054892c
    # Parent  343ee9f47e426764c063f5ec27c4e3764e95c457
    Replace "raise Exception" by "raise RuntimeError", replace "except:" by "except StandardError:"
    
    diff --git a/doc/common/builder.py b/doc/common/builder.py
    a b  
    391391        file = open(self.cache_filename(), 'rb')
    392392        try:
    393393            cache = cPickle.load(file)
    394         except:
     394        except StandardError:
    395395            logger.debug("Cache file '%s' is corrupted; ignoring it..."% filename)
    396396            cache = {}
    397397        else:
  • sage/algebras/group_algebra.py

    diff --git a/sage/algebras/group_algebra.py b/sage/algebras/group_algebra.py
    a b  
    222222                (self.base_ring().random_element(), self.group().random_element()),
    223223                (self.base_ring().random_element(), self.group().random_element()),
    224224                ]))
    225         except: # base ring or group might not implement .random_element()
     225        except StandardError: # base ring or group might not implement .random_element()
    226226            return self(self._formal_sum_module([ (self.base_ring().an_element(), self.group().an_element()) ]))
    227227
    228228    def __call__(self, x, check=True):
  • sage/algebras/iwahori_hecke_algebra.py

    diff --git a/sage/algebras/iwahori_hecke_algebra.py b/sage/algebras/iwahori_hecke_algebra.py
    a b  
    354354            # avoids accidental coercion into a field of fractions.
    355355            i1 = self._q1.__pow__(-1)
    356356            i2 = self._q2.__pow__(-1)
    357         except:
     357        except StandardError:
    358358            raise ValueError("%s and %s must be invertible."%(self._q1, self._q2))
    359359        return (-i1*i2)*self.algebra_generator(i)+(i1+i2)
    360360
  • sage/all.py

    diff --git a/sage/all.py b/sage/all.py
    a b  
    176176#try:
    177177#    import resource   # unix only...
    178178#    resource.setrlimit(resource.RLIMIT_AS, (-1,-1))
    179 #except:
     179#except StandardError:
    180180#    pass
    181181
    182182# very useful 2-letter shortcuts
  • sage/categories/examples/finite_enumerated_sets.py

    diff --git a/sage/categories/examples/finite_enumerated_sets.py b/sage/categories/examples/finite_enumerated_sets.py
    a b  
    191191        """
    192192        try:
    193193            return self.lift(x) in self.ambient()
    194         except:
     194        except StandardError:
    195195            return False
  • sage/categories/facade_sets.py

    diff --git a/sage/categories/facade_sets.py b/sage/categories/facade_sets.py
    a b  
    197197                for parent in self.facade_for():
    198198                    try:
    199199                        return parent(element)
    200                     except:
     200                    except StandardError:
    201201                        pass
    202202            raise ValueError, "Can't coerce `%s` in any parent `%s` is a facade for"%(element, self)
    203203
  • sage/categories/fields.py

    diff --git a/sage/categories/fields.py b/sage/categories/fields.py
    a b  
    9191        """
    9292        try:
    9393            return self._contains_helper(x) or is_Field(x)
    94         except:
     94        except StandardError:
    9595            return False
    9696
    9797    @lazy_class_attribute
  • sage/categories/functor.pyx

    diff --git a/sage/categories/functor.pyx b/sage/categories/functor.pyx
    a b  
    253253        """
    254254        try:
    255255            return self(f.domain()).hom(f, self(f.codomain()))
    256         except:
     256        except StandardError:
    257257            raise TypeError, 'unable to transform %s into a morphism in %s'%(f,self.codomain())
    258258
    259259    def _coerce_into_domain(self, x):
  • sage/categories/morphism.pyx

    diff --git a/sage/categories/morphism.pyx b/sage/categories/morphism.pyx
    a b  
    261261        """
    262262        try:
    263263            return self._function(x, *args, **kwds)
    264         except:
     264        except StandardError:
    265265            raise TypeError, "Underlying map %s does not accept additional arguments"%type(self._function)
    266266
    267267    cdef _extra_slots(self, _slots):
  • sage/coding/binary_code.pyx

    diff --git a/sage/coding/binary_code.pyx b/sage/coding/binary_code.pyx
    a b  
    15271527            self.nrows = <int> arg1
    15281528            self.nwords = 1 << self.nrows
    15291529            self.ncols = <int> arg2
    1530         except:
     1530        except StandardError:
    15311531            other = arg1
    15321532            self.nrows = other.nrows
    15331533            self.nwords = other.nwords
  • sage/combinat/crystals/tensor_product.py

    diff --git a/sage/combinat/crystals/tensor_product.py b/sage/combinat/crystals/tensor_product.py
    a b  
    967967        spin_shapes = tuple( tuple(shape) for shape in shapes )
    968968        try:
    969969            shapes = tuple( tuple(trunc(i) for i in shape) for shape in spin_shapes )
    970         except:
     970        except StandardError:
    971971            raise ValueError("shapes should all be partitions or half-integer partitions")
    972972        if spin_shapes == shapes:
    973973            return super(CrystalOfTableaux, cls).__classcall__(cls, cartan_type, shapes)
  • sage/combinat/designs/incidence_structures.py

    diff --git a/sage/combinat/designs/incidence_structures.py b/sage/combinat/designs/incidence_structures.py
    a b  
    134134                y = block[:]
    135135                y.sort()
    136136                bs.append(y)
    137             except:
     137            except StandardError:
    138138                bs.append(block)
    139139        bs.sort(cmp)
    140140        self.v = v
  • sage/combinat/integer_vectors_mod_permgroup.py

    diff --git a/sage/combinat/integer_vectors_mod_permgroup.py b/sage/combinat/integer_vectors_mod_permgroup.py
    a b  
    455455        """
    456456        try:
    457457            return self.is_canonical(self.element_class(self, list(v), check=False), check=False)
    458         except:
     458        except StandardError:
    459459            return False
    460460
    461461    def __call__(self, v, check=True):
     
    474474                return v
    475475            else:
    476476                raise ValueError, '%s shoud be a Python list of integer'%(v)
    477         except:
     477        except StandardError:
    478478            return self.element_class(self, list(v), check=check)
    479479
    480480    def orbit(self, v):
     
    505505            if v.parent() is self:
    506506                return orbit(self._sgs, v)
    507507            raise TypeError
    508         except:
     508        except StandardError:
    509509            return orbit(self._sgs, self.element_class(self, v, check=False))
    510510
    511511    def subset(self, sum=None, max_part=None):
     
    698698        """
    699699        try:
    700700            return (self(v)).parent() is self
    701         except:
     701        except StandardError:
    702702            return False
    703703
    704704    def __call__(self, v, check=True):
     
    720720                return v
    721721            else:
    722722                raise ValueError, '%s shoud be a Python list of integer'%(v)
    723         except:
     723        except StandardError:
    724724            return self.element_class(self, list(v), check=check)
    725725
    726726    def __iter__(self):
     
    936936        try:
    937937            if v.parent() is self:
    938938                return orbit(self._sgs, v)
    939         except:
     939        except StandardError:
    940940            return orbit(self._sgs, self.element_class(self, v, check=False))
    941941
    942942    class Element(ClonableIntArray):
  • sage/combinat/kazhdan_lusztig.py

    diff --git a/sage/combinat/kazhdan_lusztig.py b/sage/combinat/kazhdan_lusztig.py
    a b  
    129129        tr = floor((y.length()-x.length()+1)/2)
    130130        try:
    131131            ret = p.truncate(tr)
    132         except:
     132        except StandardError:
    133133            ret = laurent_polynomial_truncate(p, tr)
    134134        if self._trace:
    135135            print "    P(%s,%s)=%s"%(x, y, ret)
  • sage/combinat/permutation_cython.pyx

    diff --git a/sage/combinat/permutation_cython.pyx b/sage/combinat/permutation_cython.pyx
    a b  
    161161
    162162    try:
    163163        T = PyList_New(N-1)
    164     except:
     164    except StandardError:
    165165        sage_free(c)
    166166        raise MemoryError, "Failed to allocate memory in permutation_iterator_transposition_list"
    167167
  • sage/combinat/posets/poset_examples.py

    diff --git a/sage/combinat/posets/poset_examples.py b/sage/combinat/posets/poset_examples.py
    a b  
    357357            raise ValueError("number of elements must be non-negative, not {0}".format(n))
    358358        try:
    359359            p = float(p)
    360         except:
     360        except StandardError:
    361361            raise TypeError("probability must be a real number, not {0}".format(p))
    362362        if p < 0 or p> 1:
    363363            raise ValueError("probability must be between 0 and 1, not {0}".format(p))
  • sage/combinat/posets/posets.py

    diff --git a/sage/combinat/posets/posets.py b/sage/combinat/posets/posets.py
    a b  
    428428        # Compute a linear extension of the poset (a topological sort).
    429429        try:
    430430            lin_ext = D.topological_sort()
    431         except:
     431        except StandardError:
    432432            raise ValueError, "Hasse diagram contains cycles."
    433433
    434434    # Relabel using the linear_extension.
  • sage/combinat/root_system/root_system.py

    diff --git a/sage/combinat/root_system/root_system.py b/sage/combinat/root_system/root_system.py
    a b  
    263263            # still fails for CartanType G2xA1
    264264            try:
    265265                self.dual = RootSystem(self._cartan_type.dual(), as_dual_of=self);
    266             except:
     266            except StandardError:
    267267                pass
    268268        else:
    269269            self.dual_side = True
  • sage/combinat/root_system/weyl_group.py

    diff --git a/sage/combinat/root_system/weyl_group.py b/sage/combinat/root_system/weyl_group.py
    a b  
    286286                r = self.__call__(Matrix([self.domain().reflection(alp)(x).to_vector() for x in self.domain().basis()]))
    287287                ret[r] = alp
    288288            return Family(ret)
    289         except:
     289        except StandardError:
    290290            raise NotImplementedError, "reflections are only implemented for finite Weyl groups"
    291291
    292292    def gens(self):
  • sage/combinat/sf/classical.py

    diff --git a/sage/combinat/sf/classical.py b/sage/combinat/sf/classical.py
    a b  
    304304        else:
    305305            try:
    306306                return eclass(self, {sage.combinat.partition.Partition_class([]):R(x)})
    307             except:
     307            except StandardError:
    308308                raise TypeError, "do not know how to make x (= %s) an element of self"%(x)
    309309
    310310
  • sage/combinat/sf/sfa.py

    diff --git a/sage/combinat/sf/sfa.py b/sage/combinat/sf/sfa.py
    a b  
    381381            raise TypeError, "Argument R must be a commutative ring."
    382382        try:
    383383            z = R(Integer(1))
    384         except:
     384        except StandardError:
    385385            raise ValueError, "R must have a unit element"
    386386
    387387        if basis_name is not None:
  • sage/combinat/sloane_functions.py

    diff --git a/sage/combinat/sloane_functions.py b/sage/combinat/sloane_functions.py
    a b  
    366366            return self._small[n-1]
    367367        try:
    368368            return Integer(gap.gap.eval('NumberSmallGroups(%s)'%n))
    369         except:  # help, don't know what to do here? Jaap
     369        except StandardError:  # help, don't know what to do here? Jaap
    370370            print "Install database_gap first. See optional packages"
    371371
    372372
  • sage/combinat/species/series.py

    diff --git a/sage/combinat/species/series.py b/sage/combinat/species/series.py
    a b  
    5454            raise TypeError, "Argument R must be a ring."
    5555        try:
    5656            z = R(Integer(1))
    57         except:
     57        except StandardError:
    5858            raise ValueError, "R must have a unit element"
    5959
    6060        #Take care of the names
  • sage/combinat/species/stream.py

    diff --git a/sage/combinat/species/stream.py b/sage/combinat/species/stream.py
    a b  
    4444    while True:
    4545        try:
    4646            yield func(list)
    47         except:
     47        except StandardError:
    4848            break
    4949
    5050def Stream(x=None, const=None):
  • sage/combinat/tableau.py

    diff --git a/sage/combinat/tableau.py b/sage/combinat/tableau.py
    a b  
    12621262        if not isinstance(tab2, Tableau_class):
    12631263            try:
    12641264                tab2 = Tableau_class(tab2)
    1265             except:
     1265            except StandardError:
    12661266                raise TypeError, "tab2 must be a standard tableau"
    12671267
    12681268        if tab2.size() != n:
  • sage/combinat/words/alphabet.py

    diff --git a/sage/combinat/words/alphabet.py b/sage/combinat/words/alphabet.py
    a b  
    6565    else:
    6666        try:
    6767            return OrderedAlphabet_Finite(data)
    68         except:
     68        except StandardError:
    6969            raise TypeError, "cannot construct an alphabet from given data"
    7070
    7171OrderedAlphabet = Alphabet
     
    191191        """
    192192        try:
    193193            return a in self._alphabet
    194         except:
     194        except StandardError:
    195195            return False
    196196
    197197    def __le__(self, other):
  • sage/combinat/words/finite_word.py

    diff --git a/sage/combinat/words/finite_word.py b/sage/combinat/words/finite_word.py
    a b  
    249249            try:
    250250                other = self.parent()(other)
    251251                other.parent()._check(other, length=None)
    252             except:
     252            except StandardError:
    253253                try:
    254254                    self = other.parent()(self)
    255255                    self.parent()._check(self, length=None)
    256                 except:
     256                except StandardError:
    257257                    raise TypeError, "no coercion rule between %r and %r" % (self.parent(), other.parent())
    258258        return self, other
    259259
  • sage/combinat/words/morphism.py

    diff --git a/sage/combinat/words/morphism.py b/sage/combinat/words/morphism.py
    a b  
    398398        for key,val in data.iteritems():
    399399            try:
    400400                it = iter(val)
    401             except:
     401            except StandardError:
    402402                it = [val]
    403403            codom_alphabet.update(it)
    404404        return Words(sorted(codom_alphabet))
  • sage/crypto/classical.py

    diff --git a/sage/crypto/classical.py b/sage/crypto/classical.py
    a b  
    346346                return AffineCipher(self, key=(a,b))
    347347            else:
    348348                raise ValueError
    349         except:
     349        except StandardError:
    350350            raise ValueError("(a, b) = (%s, %s) is outside the range of acceptable values for a key of this affine cryptosystem." % (a, b))
    351351
    352352    def _repr_(self):
     
    11501150            return D(strip_encoding(S))
    11511151        try:
    11521152            return D.encoding(S)
    1153         except:
     1153        except StandardError:
    11541154            raise TypeError("Argument S = %s does not encode in the cipher domain" % S)
    11551155
    11561156    def inverse_key(self, a, b):
     
    12421242            aInv = inverse_mod(a, n)
    12431243            bInv = Mod(-b * aInv, n).lift()
    12441244            return (aInv, bInv)
    1245         except:
     1245        except StandardError:
    12461246            raise ValueError("(a, b) = (%s, %s) is outside the range of acceptable values for a key of this affine cipher." % (a, b))
    12471247
    12481248    def random_key(self):
     
    13931393        if isinstance(A, list):
    13941394            try:
    13951395                A = M(A)
    1396             except:
     1396            except StandardError:
    13971397                raise TypeError("A (= %s) must specify a square matrix of degree %s." % (A, m))
    13981398        return HillCipher(self, A)
    13991399
     
    15381538            return S(strip_encoding(M))
    15391539        try:
    15401540            return S.encoding(M)
    1541         except:
     1541        except StandardError:
    15421542            raise TypeError("Argument M = %s does not encode in the cipher domain" % M)
    15431543
    15441544    def deciphering(self, A, C):
     
    28462846            return D(strip_encoding(S))
    28472847        try:
    28482848            return D.encoding(S)
    2849         except:
     2849        except StandardError:
    28502850            raise TypeError("Argument S = %s does not encode in the cipher domain" % S)
    28512851
    28522852    def inverse_key(self, K):
     
    32033203            return S(strip_encoding(M))
    32043204        try:
    32053205            return S.encoding(M)
    3206         except:
     3206        except StandardError:
    32073207            raise TypeError("Argument M = %s does not encode in the cipher domain" % M)
    32083208
    32093209    def deciphering(self, K, C):
     
    33363336        if isinstance(K, list):
    33373337            try:
    33383338                K = G(K)
    3339             except:
     3339            except StandardError:
    33403340                raise TypeError("K (= %s) must specify a permutation." % K)
    33413341        if not isinstance(K, PermutationGroupElement) and K.parent() == G:
    33423342            raise TypeError("K (= %s) must be a permutation or list specifying a permutation." % K)
     
    34473447            return S(strip_encoding(M))
    34483448        try:
    34493449            return S.encoding(M)
    3450         except:
     3450        except StandardError:
    34513451            raise TypeError("Argument M = %s does not encode in the cipher domain" % M)
    34523452
    34533453    def deciphering(self, K, C):
     
    35833583        if isinstance(K, list):
    35843584            try:
    35853585                K = S(K)
    3586             except:
     3586            except StandardError:
    35873587                raise TypeError("K (= %s) must specify a string of length %s." % (K, m))
    35883588        if not len(K) == m:
    35893589            raise TypeError("K (= %s) must specify a string of length %s." % (K, m))
     
    36903690            return S(strip_encoding(M))
    36913691        try:
    36923692            return S.encoding(M)
    3693         except:
     3693        except StandardError:
    36943694            raise TypeError("Argument M = %s does not encode in the cipher domain" % M)
    36953695
    36963696    def deciphering(self, K, C):
  • sage/crypto/classical_cipher.py

    diff --git a/sage/crypto/classical_cipher.py b/sage/crypto/classical_cipher.py
    a b  
    230230        E = self.parent()
    231231        try:
    232232            B = E.inverse_key(self.key())
    233         except:
     233        except StandardError:
    234234            raise ValueError, "Argument\n\n%s\n\nmust be an invertible cipher." % self
    235235        return E(B)
    236236
  • sage/crypto/stream.py

    diff --git a/sage/crypto/stream.py b/sage/crypto/stream.py
    a b  
    9797        S = self.cipher_domain()
    9898        try:
    9999            return S.encoding(M)
    100         except:
     100        except StandardError:
    101101            raise TypeError, "Argument M = %s does not encode in the cipher domain" % M
    102102
    103103class ShrinkingGeneratorCryptosystem(SymmetricKeyCryptosystem):
     
    159159        S = self.cipher_domain()
    160160        try:
    161161            return S.encoding(M)
    162         except:
     162        except StandardError:
    163163            raise TypeError, "Argument M = %s does not encode in the cipher domain" % M
    164164
    165165def blum_blum_shub(length, seed=None, p=None, q=None,
  • sage/databases/conv.py

    diff --git a/sage/databases/conv.py b/sage/databases/conv.py
    a b  
    130130        print N
    131131        try:
    132132            newforms(N, recompute=recompute)
    133         except:
     133        except StandardError:
    134134            print "Error for N=",N
    135135   
  • sage/databases/sql_db.py

    diff --git a/sage/databases/sql_db.py b/sage/databases/sql_db.py
    a b  
    662662        try:
    663663            cur = self.__database__.__connection__.cursor()
    664664            cur.execute(self.__query_string__, self.__param_tuple__)
    665         except:
     665        except StandardError:
    666666            raise RuntimeError('Failure to fetch query.')
    667667
    668668        print _create_print_table(cur, [des[0] for des in cur.description], \
     
    12801280        try:
    12811281            cur = self.__connection__.cursor()
    12821282            cur.execute('SELECT * FROM ' + table_name)
    1283         except:
     1283        except StandardError:
    12841284            raise RuntimeError('Failure to fetch data.')
    12851285        print _create_print_table(cur, [des[0] for des in cur.description], \
    12861286                **kwds)
     
    20682068        try:
    20692069            cur = self.get_cursor()
    20702070            cur.execute(delete_statement, query.__param_tuple__)
    2071         except:
     2071        except StandardError:
    20722072            raise RuntimeError('Failure to complete delete. Check your data.')
    20732073
    20742074    def add_rows(self, table_name, rows, entry_order=None):
  • sage/ext/gen_interpreters.py

    diff --git a/sage/ext/gen_interpreters.py b/sage/ext/gen_interpreters.py
    a b  
    31003100{% if do_cleanup %}
    31013101        try:
    31023102{% print indent_lines(4, the_call) %}
    3103         except:
     3103        except StandardError:
    31043104{%   for ch in s.chunks %}
    31053105{%     if ch.needs_cleanup_on_error() %}
    31063106{%       print indent_lines(12, ch.handle_cleanup()) %}
     
    31213121{% if do_cleanup %}
    31223122        try:
    31233123{% print indent_lines(4, the_call_c) %}
    3124         except:
     3124        except StandardError:
    31253125{%   for ch in s.chunks %}
    31263126{%     if ch.needs_cleanup_on_error() %}
    31273127{%       print indent_lines(12, ch.handle_cleanup()) %}
     
    35323532                            , <PyObject*>self._domain
    35333533                            , self._code
    35343534                            )
    3535                     except:
     3535                    except StandardError:
    35363536                        for i in range(self._n_stack):
    35373537                            Py_CLEAR(self._stack[i])
    35383538                        raise
  • sage/functions/generalized.py

    diff --git a/sage/functions/generalized.py b/sage/functions/generalized.py
    a b  
    143143                    return None
    144144                else:
    145145                    return 0
    146         except:                     # x is symbolic
    147             pass   
     146        except StandardError:                     # x is symbolic
     147            pass
    148148        return None
    149149
    150150dirac_delta = FunctionDiracDelta()
     
    249249                    return 1
    250250                else:
    251251                    return 0
    252         except:                     # x is symbolic
    253             pass   
     252        except StandardError:                     # x is symbolic
     253            pass
    254254        return None
    255255
    256256    def _derivative_(self, x, diff_param=None):
     
    358358                    return 1
    359359                else:
    360360                    return 0
    361         except:                     # x is symbolic
    362             pass   
     361        except StandardError:                     # x is symbolic
     362            pass
    363363        return None
    364364
    365365    def _derivative_(self, x, diff_param=None):
     
    493493                    return ZZ(1)
    494494                else:
    495495                    return ZZ(-1)
    496         except:                     # x is symbolic
    497             pass   
     496        except StandardError:                     # x is symbolic
     497            pass
    498498        return None
    499499
    500500    def _derivative_(self, x, diff_param=None):
     
    598598                    return 0
    599599            else:
    600600                return 0            # x is complex
    601         except:                     # x is symbolic
    602             pass   
     601        except StandardError:                     # x is symbolic
     602            pass
    603603        return None
    604604
    605605    def _derivative_(self, *args, **kwds):
  • sage/functions/special.py

    diff --git a/sage/functions/special.py b/sage/functions/special.py
    a b  
    17381738        from sage.rings.real_mpfr import RR
    17391739        try:
    17401740            return RR(t).erfc()
    1741         except:
     1741        except StandardError:
    17421742            raise NotImplementedError
    17431743
    17441744
  • sage/graphs/base/c_graph.pyx

    diff --git a/sage/graphs/base/c_graph.pyx b/sage/graphs/base/c_graph.pyx
    a b  
    11681168        return vertex_ints[u]
    11691169    try:
    11701170        u_int = u
    1171     except:
     1171    except StandardError:
    11721172        return -1
    11731173    if u_int < 0 or u_int >= G.active_vertices.size or u_int in vertex_labels:
    11741174        return -1
     
    18251825        try:
    18261826            v = hash(verts)
    18271827            is_hashable = True
    1828         except:
     1828        except StandardError:
    18291829            pass
    18301830        if is_hashable and self.has_vertex(verts):
    18311831            return iter([verts])
  • sage/graphs/base/sparse_graph.pyx

    diff --git a/sage/graphs/base/sparse_graph.pyx b/sage/graphs/base/sparse_graph.pyx
    a b  
    16561656        for e in edges:
    16571657            try:
    16581658                u,v,l = e
    1659             except:
     1659            except StandardError:
    16601660                u,v = e
    16611661                l = None
    16621662            self.add_edge(u,v,l,directed)
  • sage/graphs/bipartite_graph.py

    diff --git a/sage/graphs/bipartite_graph.py b/sage/graphs/bipartite_graph.py
    a b  
    361361            Graph.__init__(self, data, *args, **kwds)
    362362            try:
    363363                self.left, self.right = self.bipartite_sets()
    364             except:
     364            except StandardError:
    365365                raise TypeError("Input graph is not bipartite!")
    366366        else:
    367367            import networkx
     
    384384            if not (hasattr(self, "left") and hasattr(self, "right")):
    385385                try:
    386386                    self.left, self.right = self.bipartite_sets()
    387                 except:
     387                except StandardError:
    388388                    raise TypeError("Input graph is not bipartite!")
    389389
    390390        # restore vertex partition checking
     
    670670        # vertex)
    671671        try:
    672672            self.left.remove(vertex)
    673         except:
     673        except StandardError:
    674674            try:
    675675                self.right.remove(vertex)
    676             except:
     676            except StandardError:
    677677                raise RuntimeError(
    678678                    "Vertex (%s) not found in partitions" % vertex)
    679679
     
    714714        for vertex in vertices:
    715715            try:
    716716                self.left.remove(vertex)
    717             except:
     717            except StandardError:
    718718                try:
    719719                    self.right.remove(vertex)
    720                 except:
     720                except StandardError:
    721721                    raise RuntimeError(
    722722                        "Vertex (%s) not found in partitions" % vertex)
    723723
     
    771771            if v is None:
    772772                try:
    773773                    u, v, label = u
    774                 except:
     774                except StandardError:
    775775                    u, v = u
    776776                    label = None
    777777        else:
     
    10221022            ...                   print "Load/save failed for code with edges:"
    10231023            ...                   print b.edges()
    10241024            ...                   break
    1025             ...           except:
     1025            ...           except StandardError:
    10261026            ...               print "Exception encountered for graph of order "+ str(order)
    10271027            ...               print "with edges: "
    10281028            ...               g.edges()
  • sage/graphs/digraph.py

    diff --git a/sage/graphs/digraph.py b/sage/graphs/digraph.py
    a b  
    622622                try:
    623623                    e = int(e)
    624624                    assert e >= 0
    625                 except:
     625                except StandardError:
    626626                    if weighted is False:
    627627                        raise ValueError("Non-weighted digraph's"+
    628628                        " adjacency matrix must have only nonnegative"+
  • sage/graphs/dot2tex_utils.py

    diff --git a/sage/graphs/dot2tex_utils.py b/sage/graphs/dot2tex_utils.py
    a b  
    2727        import dot2tex
    2828        # Test for this required feature from dot2tex 2.8.7
    2929        return dot2tex.dot2tex("graph {}", format = "positions") == {}
    30     except:
     30    except StandardError:
    3131        return False
    3232    return True
    3333
  • sage/graphs/generic_graph.py

    diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
    a b  
    838838                return self._backend._nxg.copy()
    839839            else:
    840840                return self._backend._nxg
    841         except:
     841        except StandardError:
    842842            import networkx
    843843            if self._directed and self.allows_multiple_edges():
    844844                class_type = networkx.MultiDiGraph
     
    75357535        """
    75367536        try:
    75377537            hash(vertex)
    7538         except:
     7538        except StandardError:
    75397539            return False
    75407540        return self._backend.has_vertex(vertex)
    75417541
     
    80978097            if v is None:
    80988098                try:
    80998099                    u, v, label = u
    8100                 except:
     8100                except StandardError:
    81018101                    try:
    81028102                        u, v = u
    8103                     except:
     8103                    except StandardError:
    81048104                        pass
    81058105        else:
    81068106            if v is None:
    81078107                try:
    81088108                    u, v = u
    8109                 except:
     8109                except StandardError:
    81108110                    pass
    81118111        if not self.allows_loops() and u==v:
    81128112            return
     
    83828382            if v is None:
    83838383                try:
    83848384                    u, v, label = u
    8385                 except:
     8385                except StandardError:
    83868386                    u, v = u
    83878387                    label = None
    83888388        self._backend.del_edge(u, v, label, self._directed)
     
    85608560            if v is None:
    85618561                try:
    85628562                    u, v, label = u
    8563                 except:
     8563                except StandardError:
    85648564                    u, v = u
    85658565                    label = None
    85668566        return self._backend.has_edge(u, v, label)
     
    1028810288            sage: for g in graphs(5):
    1028910289            ...     try:
    1029010290            ...         forget = g.is_chordal()
    10291             ...     except:
     10291            ...     except StandardError:
    1029210292            ...         print("Oh no.")
    1029310293   
    1029410294        REFERENCES:
     
    1136211362        e = self.eccentricity(with_labels=True)
    1136311363        try:
    1136411364            r = min(e.values())
    11365         except:
     11365        except StandardError:
    1136611366            return []
    1136711367        return [v for v in e if e[v]==r]
    1136811368   
     
    1169711697        e = self.eccentricity(with_labels=True)
    1169811698        try:
    1169911699            r = max(e.values())
    11700         except:
     11700        except StandardError:
    1170111701            return []
    1170211702        return [v for v in e if e[v]==r]
    1170311703
     
    1192011920                except AttributeError:
    1192111921                    try:
    1192211922                        L = networkx.bidirectional_dijkstra(self.networkx_graph(copy=False), u, v)[1]
    11923                     except:
     11923                    except StandardError:
    1192411924                        L = False
    1192511925            else:
    1192611926                L = networkx.dijkstra_path(self.networkx_graph(copy=False), u, v)
     
    1193411934            else:
    1193511935                try:
    1193611936                    L = networkx.single_source_shortest_path(self.networkx_graph(copy=False), u)[v]
    11937                 except:
     11937                except StandardError:
    1193811938                    L = False
    1193911939        if L:
    1194011940            return L
  • sage/graphs/graph.py

    diff --git a/sage/graphs/graph.py b/sage/graphs/graph.py
    a b  
    12041204                try:
    12051205                    e = int(e)
    12061206                    assert e >= 0
    1207                 except:
     1207                except StandardError:
    12081208                    if weighted is False:
    12091209                        raise ValueError("Non-weighted graph's"+
    12101210                        " adjacency matrix must have only nonnegative"+
     
    29562956
    29572957        try:
    29582958            p.solve(log=verbose)
    2959         except:
     2959        except StandardError:
    29602960            return None
    29612961
    29622962        classss=p.get_values(classss)
  • sage/graphs/graph_coloring.py

    diff --git a/sage/graphs/graph_coloring.py b/sage/graphs/graph_coloring.py
    a b  
    12511251
    12521252    except MIPSolverException:
    12531253        if k == (Integer(max(g.degree()))/2).ceil():
    1254             raise Exception("It looks like you have found a counterexample to a very old conjecture. Please do not loose it ! Please publish it, and send a post to sage-devel to warn us. I implore you ! Nathann Cohen ")
     1254            raise RuntimeError("It looks like you have found a counterexample to a very old conjecture. Please do not loose it ! Please publish it, and send a post to sage-devel to warn us. I implore you ! Nathann Cohen ")
    12551255        else:
    12561256            raise ValueError("This graph can not be colored with the given number of colors.")
    12571257
     
    14051405            except ValueError:
    14061406                k = k+1
    14071407
    1408         raise Exception("This should not happen. Please report a bug !")
     1408        raise RuntimeError("This should not happen. Please report a bug !")
    14091409
    14101410    elif k==0:
    14111411        k = max(g.degree())+2
     
    14561456
    14571457    except MIPSolverException:
    14581458        if k == max(g.degree()) + 2:
    1459             raise Exception("It looks like you have found a counterexample to a very old conjecture. Please do not loose it ! Please publish it, and send a post to sage-devel to warn us. I implore you ! Nathann Cohen ")
     1459            raise RuntimeError("It looks like you have found a counterexample to a very old conjecture. Please do not loose it ! Please publish it, and send a post to sage-devel to warn us. I implore you ! Nathann Cohen ")
    14601460        else:
    14611461            raise ValueError("This graph can not be colored with the given number of colors.")
    14621462
  • sage/graphs/graph_decompositions/rankwidth.pyx

    diff --git a/sage/graphs/graph_decompositions/rankwidth.pyx b/sage/graphs/graph_decompositions/rankwidth.pyx
    a b  
    185185    cdef int i
    186186
    187187    if sage_graph_to_matrix(G):
    188         raise Exception("There has been a mistake while converting the Sage "+
     188        raise RuntimeError("There has been a mistake while converting the Sage "+
    189189                        "graph to a C structure. The memory is probably "+
    190190                        "insufficient (2^(n+1) is a *LOT*).")
    191191
  • sage/graphs/graph_generators.py

    diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
    a b  
    69606960            N = networkx.random_regular_graph(d, n, seed=seed)
    69616961            if N is False: return False
    69626962            return graph.Graph(N, sparse=True)
    6963         except:
     6963        except StandardError:
    69646964            return False
    69656965
    69666966    def RandomShell(self, constructor, seed=None):
  • sage/graphs/graph_latex.py

    diff --git a/sage/graphs/graph_latex.py b/sage/graphs/graph_latex.py
    a b  
    11221122            elif name in color_options:
    11231123                try:
    11241124                    cc.to_rgb(value)
    1125                 except:
     1125                except StandardError:
    11261126                    raise ValueError('%s option needs to be a matplotlib color (always as a string), not %s' % (name, value))
    11271127            elif name in boolean_options and not type(value) == bool:
    11281128                raise ValueError('%s option must be True or False, not %s' % (name, value))
     
    11461146                    for key, c in value.items():
    11471147                        try:
    11481148                            cc.to_rgb(c)
    1149                         except:
     1149                        except StandardError:
    11501150                            raise ValueError('%s option for %s needs to be a matplotlib color (always as a string), not %s' % (name, key, c))
    11511151            elif name in positive_scalar_dicts:
    11521152                if not type(value) == dict:
  • sage/graphs/planarity.pyx

    diff --git a/sage/graphs/planarity.pyx b/sage/graphs/planarity.pyx
    a b  
    7070        ...           continue                                            # long time
    7171        ...       try:                                                    # long time
    7272        ...           _ = g.is_planar(set_embedding=True, set_pos=True)   # long time
    73         ...       except:                                                 # long time
     73        ...       except StandardError:                                   # long time
    7474        ...           print "There is something wrong here !"             # long time
    7575        ...           break                                               # long time
    7676    """
  • sage/graphs/schnyder.py

    diff --git a/sage/graphs/schnyder.py b/sage/graphs/schnyder.py
    a b  
    9393    for face in faces:
    9494        new_face = []
    9595        if len(face) < 3:
    96             raise Exception('Triangulate method created face %s with < 3 edges.'%face)
     96            raise RuntimeError('Triangulate method created face %s with < 3 edges.'%face)
    9797        if len(face) == 3:
    9898            continue # This face is already triangulated
    9999        elif len(face) == 4:  # In this special case just add diagonal edge to square
     
    190190    while g.order() > 3:
    191191        try:
    192192            v = contractible.pop()
    193         except:
    194             raise Exception('Contractible list is empty but graph still has %d vertices.  (Expected 3.)'%g.order())
     193        except StandardError:
     194            raise RuntimeError('Contractible list is empty but graph still has %d vertices.  (Expected 3.)'%g.order())
    195195
    196196            break
    197197        # going to contract v
     
    498498                r[i] -= q
    499499
    500500            if sum(r) != g.order() - 1:
    501                 raise Exception("Computing coordinates failed: vertex %s's coordinates sum to %s.  Expected %s"%(v,sum(r),g.order()-1))
     501                raise RuntimeError("Computing coordinates failed: vertex %s's coordinates sum to %s.  Expected %s"%(v,sum(r),g.order()-1))
    502502
    503503            coordinates[v] = r[:-1]
    504504
  • sage/groups/generic.py

    diff --git a/sage/groups/generic.py b/sage/groups/generic.py
    a b  
    553553        sage: def test():
    554554        ...       try:
    555555        ...            discrete_log_rho(I(123456),I(1),operation='+')
    556         ...       except:
     556        ...       except StandardError:
    557557        ...            print "FAILURE"
    558558        sage: test() # random failure
    559559        FAILURE
     
    782782        if operation in multiplication_names:
    783783            try:
    784784                ord = base.multiplicative_order()
    785             except:
     785            except StandardError:
    786786                ord = base.order()
    787787        elif operation in addition_names:
    788788            try:
    789789                ord = base.additive_order()
    790             except:
     790            except StandardError:
    791791                ord = base.order()
    792792        else:
    793793            try:
    794794                ord = base.order()
    795             except:
     795            except StandardError:
    796796                raise ValueError, "ord must be specified"
    797797    try:
    798798        from sage.rings.infinity import Infinity
     
    11461146        try:
    11471147            n = P.multiplicative_order()
    11481148            m = Q.multiplicative_order()
    1149         except:
     1149        except StandardError:
    11501150            n = P.order()
    11511151            m = Q.order()
    11521152    elif operation in addition_names:
     
    11541154        try:
    11551155            n = P.additive_order()
    11561156            m = Q.additive_order()
    1157         except:
     1157        except StandardError:
    11581158            n = P.order()
    11591159            m = Q.order()
    11601160    else:
  • sage/groups/perm_gps/permgroup.py

    diff --git a/sage/groups/perm_gps/permgroup.py b/sage/groups/perm_gps/permgroup.py
    a b  
    148148    """
    149149    try:
    150150        gap.eval('LoadPackage("hap")')
    151     except:
     151    except StandardError:
    152152        gap.eval('LoadPackage("hap")')
    153153
    154154def hap_decorator(f):
     
    722722        """
    723723        try:
    724724            item = self(item, check=True)
    725         except:
     725        except StandardError:
    726726            return False
    727727        return True
    728728
     
    16601660        """
    16611661        try:
    16621662            g = PermutationGroupElement(g)
    1663         except:
     1663        except StandardError:
    16641664            raise TypeError("{0} does not convert to a permutation group element".format(g))
    16651665        return PermutationGroup(gap_group=gap.ConjugateGroup(self, g))
    16661666
  • sage/gsl/ode.pyx

    diff --git a/sage/gsl/ode.pyx b/sage/gsl/ode.pyx
    a b  
    8484            dfdt[i]=jac_list[y_n][i]
    8585
    8686        return GSL_SUCCESS
    87     except:
     87    except StandardError:
    8888        return -1
    8989
    9090cdef int c_f(double t,double* y, double* dydt,void *params):
     
    106106        for i from 0<=i<y_n:
    107107            dydt[i]=dydt_list[i]
    108108        return GSL_SUCCESS
    109     except:
     109    except StandardError:
    110110        return -1
    111111
    112112
  • sage/gsl/probability_distribution.pyx

    diff --git a/sage/gsl/probability_distribution.pyx b/sage/gsl/probability_distribution.pyx
    a b  
    627627          for x in parameters:
    628628              try:
    629629                  float(x)
    630               except:
     630              except StandardError:
    631631                  raise TypeError, "Uniform distribution requires parameters coercible to float"
    632632          self.parameters = <double*>sage_malloc(sizeof(double)*2)
    633633          self.parameters[0] = parameters[0]
     
    635635        elif name == 'gaussian':
    636636            try:
    637637                float(parameters)
    638             except:
     638            except StandardError:
    639639                raise TypeError, "gaussian distribution requires parameter sigma coercible to float"
    640640            self.parameters = <double*>sage_malloc(sizeof(double))
    641641            self.parameters[0] = float(parameters)
     
    645645                raise TypeError, "pareto distribution has two parameters"
    646646            try:
    647647                map(float, parameters)
    648             except:
     648            except StandardError:
    649649                raise TypeError, "parameters must be coercible to float"
    650650            self.parameters = <double*>sage_malloc(sizeof(double)*2)
    651651            self.parameters[0] = float(parameters[0])
     
    655655            self.distribution_type = rayleigh
    656656            try:
    657657                float(parameters)
    658             except:
     658            except StandardError:
    659659                raise TypeError, "rayleigh distribution requires parameter sigma coercible to float"
    660660            self.parameters = <double*>sage_malloc(sizeof(double))
    661661            self.parameters[0] = float(parameters)
     
    666666            for x in parameters:
    667667                try:
    668668                    float(x)
    669                 except:
     669                except StandardError:
    670670                    raise TypeError, "Lognormal distribution requires real parameters"
    671671            self.parameters = <double*>sage_malloc(sizeof(double)*2)
    672672            self.parameters[0] = float(parameters[0])
     
    675675        elif name == 't':
    676676            try:
    677677                float(parameters)
    678             except:
     678            except StandardError:
    679679                raise TypeError, "parameter to t distribution must be coercible to float"
    680680            self.parameters = <double*>sage_malloc(sizeof(double))
    681681            self.parameters[0] = float(parameters)
     
    685685                raise TypeError, "F-distribution requires two real parameters"
    686686            try:
    687687                map(float, parameters)
    688             except:
     688            except StandardError:
    689689                raise TypeError, "F-distribution requires real parameters"
    690690            self.parameters = <double *>malloc(sizeof(double)*2)
    691691            self.parameters[0] = float(parameters[0])
     
    694694        elif name == 'chisquared':
    695695            try:
    696696                float(parameters)
    697             except:
     697            except StandardError:
    698698                raise TypeError, "parameters to t distribution must be coercible to float"
    699699            self.parameters = <double *>sage_malloc(sizeof(double))
    700700            self.parameters[0] = float(parameters)
     
    705705            for x in parameters:
    706706                try:
    707707                    float(x)
    708                 except:
     708                except StandardError:
    709709                    raise TypeError, "exponential power distribution requires real parameters"
    710710            self.parameters = <double*>sage_malloc(sizeof(double)*2)
    711711            self.parameters[0] = float(parameters[0])
     
    716716                raise TypeError, "weibull distribution requires two real parameters"
    717717            try:
    718718                map(float, parameters)
    719             except:
     719            except StandardError:
    720720                raise TypeError, "weibull distribution requires real parameters"
    721721            self.parameters = <double *>sage_malloc(sizeof(double)*2)
    722722            self.parameters[0] = float(parameters[0])
     
    727727                raise TypeError, "beta distribution requires two real parameters"
    728728            try:
    729729                map(float, parameters)
    730             except:
     730            except StandardError:
    731731                raise TypeError, "beta distribution requires real parameters"
    732732            self.parameters = <double *>sage_malloc(sizeof(double)*2)
    733733            self.parameters[0] = float(parameters[0])
  • sage/homology/chain_complex.py

    diff --git a/sage/homology/chain_complex.py b/sage/homology/chain_complex.py
    a b  
    403403
    404404        try:
    405405            deg = grading_group(degree)
    406         except:
     406        except StandardError:
    407407            raise ValueError, "The 'degree' does not appear to be an element of the grading group."
    408408        # check form of data
    409409        new_data = {}
  • sage/homology/simplicial_complex.py

    diff --git a/sage/homology/simplicial_complex.py b/sage/homology/simplicial_complex.py
    a b  
    806806            # build dictionary of generator names
    807807            try:
    808808                gen_dict[v] = 'x%s'%int(v)
    809             except:
     809            except StandardError:
    810810                gen_dict[v] = v
    811811        # build set of facets
    812812        good_faces = []
  • sage/interacts/debugger.py

    diff --git a/sage/interacts/debugger.py b/sage/interacts/debugger.py
    a b  
    116116        try:
    117117            code = compile(line + '\n', '<stdin>', 'single')
    118118            exec code in globals, locals
    119         except:
     119        except StandardError:
    120120            import sys
    121121            t, v = sys.exc_info()[:2]
    122122            if type(t) == type(''):
  • sage/interfaces/axiom.py

    diff --git a/sage/interfaces/axiom.py b/sage/interfaces/axiom.py
    a b  
    886886        try:
    887887            import sage.misc.sage_eval
    888888            return sage.misc.sage_eval.sage_eval(self.unparsed_input_form())
    889         except:
     889        except StandardError:
    890890            raise NotImplementedError
    891891
    892892
  • sage/interfaces/giac.py

    diff --git a/sage/interfaces/giac.py b/sage/interfaces/giac.py
    a b  
    10471047            try:
    10481048                from sage.symbolic.all import SR
    10491049                return SR(result)
    1050             except:
     1050            except StandardError:
    10511051                raise NotImplementedError, "Unable to parse Giac output: %s" % result
    10521052        else:
    10531053            return [entry.sage() for entry in self]
  • sage/interfaces/interface.py

    diff --git a/sage/interfaces/interface.py b/sage/interfaces/interface.py
    a b  
    734734        try:
    735735            if P.eval("%s %s %s"%(self.name(), P._greaterthan_symbol(), other.name())) == P._true_symbol():
    736736                return 1
    737         except:
     737        except StandardError:
    738738            pass
    739739
    740740        # everything is supposed to be comparable in Python, so we define
     
    847847        string = self._sage_repr()
    848848        try:
    849849            return sage.misc.sage_eval.sage_eval(string)
    850         except:
     850        except StandardError:
    851851            raise NotImplementedError, "Unable to parse output: %s" % string
    852852       
    853853
  • sage/interfaces/macaulay2.py

    diff --git a/sage/interfaces/macaulay2.py b/sage/interfaces/macaulay2.py
    a b  
    10971097        from sage.misc.sage_eval import sage_eval
    10981098        try:
    10991099            return sage_eval(repr_str)
    1100         except:
     1100        except StandardError:
    11011101            raise NotImplementedError, "cannot convert %s to a Sage object"%repr_str
    11021102     
    11031103
  • sage/interfaces/magma.py

    diff --git a/sage/interfaces/magma.py b/sage/interfaces/magma.py
    a b  
    10341034        else:
    10351035            try:
    10361036                self.eval('Append(~_sage_, 0);')
    1037             except:
     1037            except StandardError:
    10381038                # this exception could happen if the Magma process
    10391039                # was interrupted during startup / initialization.
    10401040                self.eval('_sage_ := [* 0 : i in [1..%s] *];'%self.__seq)
  • sage/interfaces/maple.py

    diff --git a/sage/interfaces/maple.py b/sage/interfaces/maple.py
    a b  
    703703        cmd = 'echo "interface(verboseproc=2): print(%s);" | maple -q'%s
    704704        src = os.popen(cmd).read()
    705705        if src.strip() == s:
    706             raise Exception, "no source code could be found"
     706            raise RuntimeError, "no source code could be found"
    707707        else:
    708708            return src
    709709
     
    11021102        try:
    11031103            from sage.symbolic.all import SR
    11041104            return SR(result)
    1105         except:
     1105        except StandardError:
    11061106            raise NotImplementedError, "Unable to parse Maple output: %s" % result
    11071107
    11081108# An instance
  • sage/interfaces/mathematica.py

    diff --git a/sage/interfaces/mathematica.py b/sage/interfaces/mathematica.py
    a b  
    799799        try:
    800800            return symbolic_expression_from_string(res, lsymbols,
    801801                accept_sequence=True)
    802         except:
     802        except StandardError:
    803803            raise NotImplementedError, "Unable to parse Mathematica \
    804804                output: %s" % res
    805805   
  • sage/interfaces/phc.py

    diff --git a/sage/interfaces/phc.py b/sage/interfaces/phc.py
    a b  
    220220        start_data += output_list[found_solutions] + '\n\n'
    221221        try:
    222222            var_number = int(output_list[found_solutions+1].split(' ')[1])
    223         except:
     223        except StandardError:
    224224            # bad error handling
    225225            var_number = int(output_list[found_solutions+2].split(' ')[1])
    226226        sol_count = 0
  • sage/interfaces/psage.py

    diff --git a/sage/interfaces/psage.py b/sage/interfaces/psage.py
    a b  
    115115            self.expect().expect(self._prompt)
    116116        try:
    117117            return Sage.eval(self, x, **kwds)
    118         except:
     118        except StandardError:
    119119            return "<<currently executing code>>"
    120120           
    121121
     
    125125        """
    126126        try:
    127127            return self.eval('print %s'%var)
    128         except:
     128        except StandardError:
    129129            return "<<currently executing code>>"
    130130
    131131    def set(self, var, value):
  • sage/interfaces/tests.py

    diff --git a/sage/interfaces/tests.py b/sage/interfaces/tests.py
    a b  
    4949                sys.stdout.flush()
    5050            v.append(s(t))
    5151        print '\nsuccess -- time = cpu: %s, wall: %s'%(cputime(t), walltime(w))
    52     except:
     52    except StandardError:
    5353        print "%s -- failed!"%s
    5454
    5555def manyvars_all(num=70000):
  • sage/libs/ntl/ntl_lzz_p.pyx

    diff --git a/sage/libs/ntl/ntl_lzz_p.pyx b/sage/libs/ntl/ntl_lzz_p.pyx
    a b  
    144144        else:
    145145            try:
    146146                modulus = int(modulus)
    147             except:
     147            except StandardError:
    148148                raise ValueError, "%s is not a valid modulus."%modulus           
    149149            self.c = <ntl_zz_pContext_class>ntl_zz_pContext(modulus)
    150150
  • sage/libs/ntl/ntl_lzz_pX.pyx

    diff --git a/sage/libs/ntl/ntl_lzz_pX.pyx b/sage/libs/ntl/ntl_lzz_pX.pyx
    a b  
    160160        else:
    161161            try:
    162162                modulus = int(modulus)
    163             except:
     163            except StandardError:
    164164                raise ValueError, "%s is not a valid modulus."%modulus           
    165165            self.c = <ntl_zz_pContext_class>ntl_zz_pContext(modulus)
    166166
  • sage/matrix/matrix2.pyx

    diff --git a/sage/matrix/matrix2.pyx b/sage/matrix/matrix2.pyx
    a b  
    78957895            raise NotImplementedError('QR decomposition is implemented over exact rings, try CDF for numerical results, not %s' % R)
    78967896        try:
    78977897            F = R.fraction_field()
    7898         except:
     7898        except StandardError:
    78997899            raise ValueError("QR decomposition needs a fraction field of %s" % R)
    79007900        m = self.nrows()
    79017901        n = self.ncols()
     
    92619261                JA, SA = A.jordan_form(transformation=True)
    92629262            else:
    92639263                JA = A.jordan_form(transformation=False)
    9264         except:
     9264        except StandardError:
    92659265            raise ValueError('unable to compute Jordan canonical form for a matrix')
    92669266        try:
    92679267            if transformation:
    92689268                JB, SB = B.jordan_form(transformation=True)
    92699269            else:
    92709270                JB = B.jordan_form(transformation=False)
    9271         except:
     9271        except StandardError:
    92729272            raise ValueError('unable to compute Jordan canonical form for a matrix')
    92739273        similar = (JA == JB)
    92749274        transform = None
     
    1028110281        if not R.is_field():
    1028210282            try:
    1028310283                F = R.fraction_field()
    10284             except:
     10284            except StandardError:
    1028510285                msg = 'base ring of the matrix needs a field of fractions, not {0}'
    1028610286                raise TypeError(msg.format(R))
    1028710287        else:
     
    1029410294            try:
    1029510295                abs(F.an_element())
    1029610296                pivot = 'partial'
    10297             except:
     10297            except StandardError:
    1029810298                if pivot == 'partial':
    1029910299                    msg = "cannot take absolute value of matrix entries, try 'pivot=nonzero'"
    1030010300                    raise TypeError(msg)
  • sage/matrix/matrix_double_dense.pyx

    diff --git a/sage/matrix/matrix_double_dense.pyx b/sage/matrix/matrix_double_dense.pyx
    a b  
    26742674        global numpy
    26752675        try:
    26762676            tol = float(tol)
    2677         except:
     2677        except StandardError:
    26782678            raise TypeError('tolerance must be a real number, not {0}'.format(tol))
    26792679        if tol <= 0:
    26802680            raise ValueError('tolerance must be positive, not {0}'.format(tol))
  • sage/matrix/operation_table.py

    diff --git a/sage/matrix/operation_table.py b/sage/matrix/operation_table.py
    a b  
    360360                    raise ValueError('%s is infinite' % S)
    361361            try:
    362362                elems = tuple(S)
    363             except:
     363            except StandardError:
    364364                raise ValueError('unable to determine elements of %s' % S)
    365365        else:
    366366            elems = []
     
    369369                    coerced = S(e)
    370370                    if not(coerced in elems):
    371371                        elems.append(coerced)
    372             except:
     372            except StandardError:
    373373                raise TypeError('unable to coerce %s into %s' % (e, S))
    374374        self._elts = elems
    375375        self._n = len(self._elts)
     
    411411                    row.append(self._elts.index(result))
    412412                except ValueError:  # list/index condition
    413413                    raise ValueError('%s%s%s=%s, and so the set is not closed' % (g, self._ascii_symbol, h, result))
    414                 except:
     414                except StandardError:
    415415                    raise TypeError('elements %s and %s of %s are incompatible with operation: %s' % (g,h,S,self._operation))
    416416            self._table.append(row)
    417417
  • sage/misc/explain_pickle.py

    diff --git a/sage/misc/explain_pickle.py b/sage/misc/explain_pickle.py
    a b  
    27042704    try:
    27052705        cpickle_res = unp.load()
    27062706        cpickle_ok = True
    2707     except:
     2707    except StandardError:
    27082708        cpickle_ok = False
    27092709
    27102710    current_repr = repr(current_res)
  • sage/misc/functional.py

    diff --git a/sage/misc/functional.py b/sage/misc/functional.py
    a b  
    106106                return y
    107107            else:
    108108                raise AttributeError, "The base ring of %s is not a field"%x
    109         except:
     109        except StandardError:
    110110            raise
    111111
    112112def basis(x):
  • sage/misc/getusage.py

    diff --git a/sage/misc/getusage.py b/sage/misc/getusage.py
    a b  
    157157        t = open(_proc_status)
    158158        v = t.read()
    159159        t.close()
    160     except:
     160    except StandardError:
    161161        return 0.0  # non-Linux?
    162162     # get VmKey line e.g. 'VmRSS:  9999  kB\n ...'
    163163    i = v.index(VmKey)
  • sage/misc/hg.py

    diff --git a/sage/misc/hg.py b/sage/misc/hg.py
    a b  
    264264        """
    265265        try:
    266266            tmp_branch_list = [s[5:]  for s in os.listdir(SAGE_ROOT + "/devel")  if s.startswith("sage-")]
    267         except:
     267        except StandardError:
    268268            raise RuntimeError, "Oops!  We had trouble...  Check that SAGE_ROOT gives the correct directory."
    269269
    270270        if print_flag:
  • sage/misc/interpreter.py

    diff --git a/sage/misc/interpreter.py b/sage/misc/interpreter.py
    a b  
    193193    if line[:6] == 'iload ':
    194194        try:
    195195            name = str(eval(line[6:]))
    196         except:
     196        except StandardError:
    197197            name = str(line[6:].strip())
    198198        try:
    199199            F = open(name)
  • sage/misc/latex.py

    diff --git a/sage/misc/latex.py b/sage/misc/latex.py
    a b  
    22552255                try:
    22562256                    if bv in CC:
    22572257                        s += "%s\cdot %s"%(coeff, b)
    2258                 except:
     2258                except StandardError:
    22592259                    s += "%s%s"%(coeff, b)
    22602260            first = False
    22612261        i += 1
  • sage/misc/log.py

    diff --git a/sage/misc/log.py b/sage/misc/log.py
    a b  
    254254        x = self._output[n]
    255255        try:
    256256            L = latex.latex(x)
    257         except:
     257        except StandardError:
    258258            L = "\\mbox{error TeXing object}"
    259259        single_png = os.path.join(self._images, '%s.png' % n)
    260260        try:
  • sage/misc/misc.py

    diff --git a/sage/misc/misc.py b/sage/misc/misc.py
    a b  
    16271627    # see trac #7398 for a discussion
    16281628    try:
    16291629        return it is iter(it)
    1630     except:
     1630    except StandardError:
    16311631        return False
    16321632
    16331633
  • sage/modular/arithgroup/congroup_pyx.pyx

    diff --git a/sage/modular/arithgroup/congroup_pyx.pyx b/sage/modular/arithgroup/congroup_pyx.pyx
    a b  
    302302#    print [type(lift_to_sl2z(c, d, level)) for c,d in crs]
    303303    try:
    304304        reps = [Matrix_integer_2x2(Mat2Z,lift_to_sl2z(c, d, level),False,True) for c,d in crs]
    305     except:
     305    except StandardError:
    306306        raise ArithmeticError, "Error lifting to SL2Z: level=%s crs=%s" % (level, crs)
    307307    ans = []
    308308    for i from 0 <= i < len(crs):
  • sage/modular/modform/element.py

    diff --git a/sage/modular/modform/element.py b/sage/modular/modform/element.py
    a b  
    248248        """
    249249        try:
    250250            self._ensure_is_compatible(other)
    251         except:
     251        except StandardError:
    252252            return self.parent().__cmp__(other.parent())
    253253        if self.element() == other.element():
    254254            return 0
     
    685685        """
    686686        try:
    687687            self._ensure_is_compatible(other)
    688         except:
     688        except StandardError:
    689689            return False
    690690        if isinstance(other, Newform):
    691691            if self.q_expansion(self.parent().sturm_bound()) == other.q_expansion(other.parent().sturm_bound()):
     
    714714        """
    715715        try:
    716716            self._ensure_is_compatible(other)
    717         except:
     717        except StandardError:
    718718            return self.parent().__cmp__(other.parent())
    719719        if isinstance(other, Newform):
    720720            if self.q_expansion(self.parent().sturm_bound()) == other.q_expansion(other.parent().sturm_bound()):
  • sage/modular/overconvergent/genus0.py

    diff --git a/sage/modular/overconvergent/genus0.py b/sage/modular/overconvergent/genus0.py
    a b  
    15891589        for i in xrange(self.gexp().prec()):
    15901590            if 12/ZZ(p - 1)*i*(r - s) - F(self.gexp()[i]).normalized_valuation() == self.r_ord(r):
    15911591                return i
    1592         raise Exception, "Can't get here"
     1592        raise RuntimeError, "Can't get here"
    15931593
    15941594    def valuation_plot(self, rmax = None):
    15951595        r"""
  • sage/modules/vector_double_dense.pyx

    diff --git a/sage/modules/vector_double_dense.pyx b/sage/modules/vector_double_dense.pyx
    a b  
    740740        else:
    741741            try:
    742742                p = RDF(p)
    743             except:
     743            except StandardError:
    744744                raise ValueError("vector norm 'p' must be +/- infinity or a real number, not %s" % p)
    745745        n = numpy.linalg.norm(self._vector_numpy, ord=p)
    746746        # p = 0 returns integer *count* of non-zero entries
  • sage/monoids/string_monoid_element.py

    diff --git a/sage/monoids/string_monoid_element.py b/sage/monoids/string_monoid_element.py
    a b  
    248248        """
    249249        try:
    250250            c = self._element_list[n]
    251         except:
     251        except StandardError:
    252252            raise IndexError("Argument n (= %s) is not a valid index." % n)
    253253        if not isinstance(c, list):
    254254            c = [c]
  • sage/numerical/backends/gurobi_backend.pyx

    diff --git a/sage/numerical/backends/gurobi_backend.pyx b/sage/numerical/backends/gurobi_backend.pyx
    a b  
    4747        check(self.env, error)
    4848
    4949        if env[0] == NULL:
    50             raise Exception("Could not initialize Gurobi environment")
     50            raise RuntimeError("Could not initialize Gurobi environment")
    5151
    5252        self.model = <GRBmodel **> sage_malloc(sizeof(GRBmodel *))
    5353
     
    5656        self.env = GRBgetenv (self.model[0])
    5757
    5858        if error:
    59             raise Exception("Could not initialize Gurobi model")
     59            raise RuntimeError("Could not initialize Gurobi model")
    6060
    6161        if maximization:
    6262            error = GRBsetintattr(self.model[0], "ModelSense", -1)
  • sage/plot/matrix_plot.py

    diff --git a/sage/plot/matrix_plot.py b/sage/plot/matrix_plot.py
    a b  
    456456            entries = list(mat._dict().items())
    457457            try:
    458458                data = np.asarray([d for _,d in entries], dtype=float)
    459             except:
     459            except StandardError:
    460460                raise ValueError, "can not convert entries to floating point numbers"
    461461            positions = np.asarray([[row for (row,col),_ in entries],
    462462                                    [col for (row,col),_ in entries]], dtype=int)
  • sage/plot/plot3d/implicit_surface.pyx

    diff --git a/sage/plot/plot3d/implicit_surface.pyx b/sage/plot/plot3d/implicit_surface.pyx
    a b  
    965965                gradient = (orig_f.diff(self.vars[0]),
    966966                            orig_f.diff(self.vars[1]),
    967967                            orig_f.diff(self.vars[2]))
    968             except:
     968            except StandardError:
    969969                # Would be nice to have more nuanced error handling here.
    970970
    971971                # If anything goes wrong, we'll just use central differencing.
  • sage/quadratic_forms/extras.py

    diff --git a/sage/quadratic_forms/extras.py b/sage/quadratic_forms/extras.py
    a b  
    6363            disc_sqrt = ZZ(sqrt(1+8*n))
    6464            a = ZZ( (ZZ(-1) + disc_sqrt) / ZZ(2) )
    6565            return a
    66         except:
     66        except StandardError:
    6767            return False
    6868   
    6969
  • sage/quadratic_forms/quadratic_form.py

    diff --git a/sage/quadratic_forms/quadratic_form.py b/sage/quadratic_forms/quadratic_form.py
    a b  
    424424        ## Verify the size of the matrix is an integer >= 0
    425425        try:
    426426            n = int(n)   
    427         except:
     427        except StandardError:
    428428            raise TypeError, "Oops! The size " + str(n) + " must be an integer."
    429429            if (n < 0):
    430430                raise TypeError, "Oops! The size " + str(n) + " must be a non-negative integer."
     
    624624        ## Set the entry
    625625        try:
    626626            self.__coeffs[i*self.__n - i*(i-1)/2 + j -i] = self.__base_ring(coeff)
    627         except:
     627        except StandardError:
    628628            raise RuntimeError, "Oops!  This coefficient can't be coerced to an element of the base ring for the quadratic form."
    629629
    630630
     
    752752#        """
    753753#        try:
    754754#            c = self.base_ring()(right)
    755 #        except:
     755#        except StandardError:
    756756#            raise TypeError, "Oh no! The multiplier cannot be coerced into the base ring of the quadratic form. =("
    757757#   
    758758#        return QuadraticForm(self.base_ring(), self.dim(), [c * self.__coeffs[i]  for i in range(len(self.__coeffs))])
     
    868868            if len(v) > 0:
    869869                try:
    870870                    x = self.base_ring()(v[0])
    871                 except:
     871                except StandardError:
    872872                    raise TypeError, "Oops!  Your vector is not coercible to the base ring of the quadratic form... =("
    873873   
    874874            ## Attempt to evaluate Q[v]
     
    932932                for i in range(n):
    933933                    for j in range(i, n):
    934934                        x = R(A[i,j])
    935             except:
     935            except StandardError:
    936936                return False
    937937
    938938        ## Test that the diagonal is even (if 1/2 isn't in R)
     
    10841084        flag = True
    10851085        try:
    10861086            self.Gram_matrix()
    1087         except:
     1087        except StandardError:
    10881088            flag = False
    10891089   
    10901090        return flag
     
    11561156        B = self.base_ring()
    11571157        try:
    11581158            R = PolynomialRing(self.base_ring(),names,n)
    1159         except:
     1159        except StandardError:
    11601160            raise ValueError, 'Can only create polynomial rings over commutative rings.'
    11611161        V = vector(R.gens())
    11621162        P = (V*M).dot_product(V)
  • sage/quadratic_forms/quadratic_form__automorphisms.py

    diff --git a/sage/quadratic_forms/quadratic_form__automorphisms.py b/sage/quadratic_forms/quadratic_form__automorphisms.py
    a b  
    5050                return deepcopy(self.__basis_of_short_vectors)
    5151            else:
    5252                return deepcopy(self.__basis_of_short_vectors)
    53     except:
     53    except StandardError:
    5454        pass
    5555
    5656
     
    413413    self.__number_of_automorphisms = self.number_of_automorphisms__souvigner()       
    414414    try:
    415415        self._external_initialization_list.remove('number_of_automorphisms')
    416     except:
     416    except StandardError:
    417417        pass  ## Do nothing if the removal fails, since it might not be in the list (causing an error)!
    418418    return self.__number_of_automorphisms
    419419
  • sage/quadratic_forms/quadratic_form__genus.py

    diff --git a/sage/quadratic_forms/quadratic_form__genus.py b/sage/quadratic_forms/quadratic_form__genus.py
    a b  
    6060    ## Return the result
    6161    try:
    6262        return Genus(self.Hessian_matrix())     
    63     except:
     63    except StandardError:
    6464        raise TypeError, "Oops!  There is a problem computing the genus symbols for this form."
    6565
    6666
     
    127127    try:
    128128        M = self.Hessian_matrix()
    129129        return LocalGenusSymbol(M, p)     
    130     except:
     130    except StandardError:
    131131        raise TypeError, "Oops!  There is a problem computing the local genus symbol at the prime " + str(p) + " for this form."
    132132
    133133
  • sage/quadratic_forms/quadratic_form__local_normal_form.py

    diff --git a/sage/quadratic_forms/quadratic_form__local_normal_form.py b/sage/quadratic_forms/quadratic_form__local_normal_form.py
    a b  
    354354            return copy.deepcopy(self.__jordan_blocks_by_scale_and_unimodular_dict[p])
    355355        else:
    356356            return self.__jordan_blocks_by_scale_and_unimodular_dict[p]
    357     except:
     357    except StandardError:
    358358        ## Initialize the global dictionary if it doesn't exist
    359359        if not hasattr(self, '__jordan_blocks_by_scale_and_unimodular_dict'):
    360360            self.__jordan_blocks_by_scale_and_unimodular_dict = {}
  • sage/quadratic_forms/quadratic_form__variable_substitutions.py

    diff --git a/sage/quadratic_forms/quadratic_form__variable_substitutions.py b/sage/quadratic_forms/quadratic_form__variable_substitutions.py
    a b  
    212212        # it doesn't work by scoping reasons.
    213213        Q = self.__class__(R, self.dim(), list2)
    214214        return Q
    215     except:
     215    except StandardError:
    216216        if (change_value_ring_flag == False):
    217217            raise TypeError, "Oops! We could not rescale the lattice in this way and preserve its defining ring."
    218218        else:
  • sage/quadratic_forms/random_quadraticform.py

    diff --git a/sage/quadratic_forms/random_quadraticform.py b/sage/quadratic_forms/random_quadraticform.py
    a b  
    107107            ## Check if condition c is satisfied
    108108            try:
    109109                bool_ans = Q.c()
    110             except:
     110            except StandardError:
    111111                bool_ans = c(Q)
    112112               
    113113            ## Create a new quadratic form if a condition fails
  • sage/rings/complex_mpc.pyx

    diff --git a/sage/rings/complex_mpc.pyx b/sage/rings/complex_mpc.pyx
    a b  
    15801580        else:
    15811581            try:
    15821582                p = (<MPComplexField_class>x._parent)(right)
    1583             except:
     1583            except StandardError:
    15841584                raise ValueError
    15851585            mpc_pow(z.value, x.value, p.value, (<MPComplexField_class>x._parent).__rnd)
    15861586
  • sage/rings/finite_rings/integer_mod.pyx

    diff --git a/sage/rings/finite_rings/integer_mod.pyx b/sage/rings/finite_rings/integer_mod.pyx
    a b  
    12261226            ...                   L = b.nth_root(e, all=True)
    12271227            ...                   if len(L) > 0:
    12281228            ...                       c = b.nth_root(e)
    1229             ...               except:
     1229            ...               except StandardError:
    12301230            ...                   L = [-1]
    12311231            ...               M = b._nth_root_naive(e)
    12321232            ...               if sorted(L) != M:
  • sage/rings/fraction_field_element.pyx

    diff --git a/sage/rings/fraction_field_element.pyx b/sage/rings/fraction_field_element.pyx
    a b  
    202202                try:
    203203                    num *= den.inverse_of_unit()
    204204                    den  = den.parent().one_element()
    205                 except:
     205                except StandardError:
    206206                    pass
    207207            self.__numerator   = num
    208208            self.__denominator = den
  • sage/rings/homset.py

    diff --git a/sage/rings/homset.py b/sage/rings/homset.py
    a b  
    5959        try:
    6060            if isinstance(x, morphism.RingHomomorphism_im_gens) and x.domain().fraction_field().has_coerce_map_from(self.domain()):
    6161                return morphism.RingHomomorphism_im_gens(self, x.im_gens())
    62         except:
     62        except StandardError:
    6363            pass
    6464        # Case 3: the homomorphism can be extended by coercion
    6565        try:
    6666            return x.extend_codomain(self.codomain()).extend_domain(self.domain())
    67         except:
     67        except StandardError:
    6868            pass
    6969        # Last resort, case 4: the homomorphism is induced from the base ring
    7070        if self.domain()==self.domain().base() or self.codomain()==self.codomain().base():
     
    7272        try:
    7373            x = self.domain().base().Hom(self.codomain().base())(x)
    7474            return morphism.RingHomomorphism_from_base(self, x)
    75         except:
     75        except StandardError:
    7676            raise TypeError
    7777
    7878    def __call__(self, im_gens, check=True):
  • sage/rings/integer.pyx

    diff --git a/sage/rings/integer.pyx b/sage/rings/integer.pyx
    a b  
    22142214        # upper is *greater* than the answer
    22152215        try:
    22162216            upper = rif_log.upper().ceiling()
    2217         except:
     2217        except StandardError:
    22182218            # ceiling is probably Infinity
    22192219            # I'm not sure what to do now
    22202220            upper = 0
  • sage/rings/morphism.pyx

    diff --git a/sage/rings/morphism.pyx b/sage/rings/morphism.pyx
    a b  
    13811381        P = self.codomain()
    13821382        try:
    13831383            return P(dict([(a, self.__underlying(b)) for a,b in x.dict().items()]))
    1384         except:
     1384        except StandardError:
    13851385            pass
    13861386        try:
    13871387            return P([self.__underlying(b) for b in x])
    1388         except:
     1388        except StandardError:
    13891389            pass
    13901390        try:
    13911391            return P(self.__underlying(x.numerator()))/P(self.__underlying(x.denominator()))
    1392         except:
     1392        except StandardError:
    13931393            raise TypeError, "invalid argument %s"%repr(x)
    13941394
    13951395cdef class RingHomomorphism_cover(RingHomomorphism):
  • sage/rings/number_field/morphism.py

    diff --git a/sage/rings/number_field/morphism.py b/sage/rings/number_field/morphism.py
    a b  
    300300        # try to get the cached transformation matrix and vector space isomorphisms if they exist
    301301        try:
    302302            M,LtoV,VtoK = self._transformation_data
    303         except:
     303        except StandardError:
    304304            # get the identifications of K and L with vector spaces over Q
    305305            V,VtoL,LtoV = self.codomain().absolute_vector_space()
    306306            V,VtoK,KtoV = self.domain().absolute_vector_space()
  • sage/rings/number_field/totallyreal_rel.py

    diff --git a/sage/rings/number_field/totallyreal_rel.py b/sage/rings/number_field/totallyreal_rel.py
    a b  
    602602                        for a0 in a0s:
    603603                            try:
    604604                                ind = self.amaxvals[0].remove(a0)
    605                             except:
     605                            except StandardError:
    606606                                True
    607607
    608608                    if verbose:
  • sage/rings/polynomial/groebner_fan.py

    diff --git a/sage/rings/polynomial/groebner_fan.py b/sage/rings/polynomial/groebner_fan.py
    a b  
    10561056                if vert > adj[0]:
    10571057                    try:
    10581058                        edges.append([tpoints[adj[0]],tpoints[vert]])
    1059                     except:
     1059                    except StandardError:
    10601060                        print adj
    10611061                        print 'tpoints: ' + str(tpoints)
    10621062                        print 'fpoints: ' + str(fpoints)
     
    11121112        for cone_data in cone_info:
    11131113            try:
    11141114                cone_lines = self._4d_to_3d(cone_data)
    1115             except:
     1115            except StandardError:
    11161116                print cone_data._rays
    11171117                raise RuntimeError
    11181118            for a_line in cone_lines:
  • sage/rings/polynomial/infinite_polynomial_element.py

    diff --git a/sage/rings/polynomial/infinite_polynomial_element.py b/sage/rings/polynomial/infinite_polynomial_element.py
    a b  
    335335        try:
    336336            from sage.misc.sage_eval import sage_eval
    337337            return sage_eval(repr(res), self.parent()._gens_dict)
    338         except:
     338        except StandardError:
    339339            return res
    340340
    341341    def _getAttributeNames(self):
     
    502502        # One may need a new parent for  self._p and x._p
    503503        try:
    504504            return InfinitePolynomial_sparse(self.parent(),self._p+x._p)
    505         except:
     505        except StandardError:
    506506            pass
    507507        ## We can now assume that self._p and x._p actually are polynomials,
    508508        ## hence, their parent is not simply the underlying ring.
     
    526526        """
    527527        try:
    528528            return InfinitePolynomial_sparse(self.parent(),self._p*x._p)
    529         except:
     529        except StandardError:
    530530            pass
    531531        ## We can now assume that self._p and x._p actually are polynomials,
    532532        ## hence, their parent is not just the underlying ring.
     
    604604        """
    605605        try:
    606606            return InfinitePolynomial_sparse(self.parent(),self._p-x._p)
    607         except:
     607        except StandardError:
    608608            pass
    609609        ## We can now assume that self._p and x._p actually are polynomials,
    610610        ## hence, their parent is not just the underlying ring.
     
    13181318        # But, to be on the safe side...
    13191319        try:
    13201320            self._p = self.parent()._P(self._p)
    1321         except:
     1321        except StandardError:
    13221322            pass
    13231323        try:
    13241324            x._p = x.parent()._P(x._p)
    1325         except:
     1325        except StandardError:
    13261326            pass
    13271327        return cmp(self._p,x._p)
    13281328
  • sage/rings/polynomial/infinite_polynomial_ring.py

    diff --git a/sage/rings/polynomial/infinite_polynomial_ring.py b/sage/rings/polynomial/infinite_polynomial_ring.py
    a b  
    449449        try:
    450450            if len(L)==2:
    451451                return self._D[L[0]][int(L[1])]
    452         except:
     452        except StandardError:
    453453            pass
    454454        raise KeyError, "%s is not a variable name"%k
    455455
     
    673673        try:
    674674            if not (hasattr(R,'is_ring') and R.is_ring() and hasattr(R,'is_commutative') and R.is_commutative()):
    675675                raise TypeError
    676         except:
     676        except StandardError:
    677677            raise TypeError, "The given 'base ring' (= %s) must be a commutative ring"%(R)
    678678
    679679        # now, the input is accepted
     
    866866            # We don't care about the orders. But base ring and generators
    867867            # of the pushout should remain the same as in self.
    868868            v = (P._names == self._names and P._base == self._base)
    869         except:
     869        except StandardError:
    870870            v = False
    871871        try:
    872872            self._coerce_cache[S] = v
    873         except:
     873        except StandardError:
    874874            pass
    875875        return v
    876876
     
    906906        # the string representation.
    907907        from sage.misc.sage_eval import sage_eval
    908908        if isinstance(x, basestring):
    909             try: 
     909            try:
    910910                return sage_eval(x, self.gens_dict())
    911             except:
     911            except StandardError:
    912912                raise ValueError, "Can't convert %s into an element of %s" % (x, self)
    913913
    914914        if hasattr(x, 'parent') and isinstance(x.parent(), InfinitePolynomialRing_sparse):
     
    931931            # remark: Conversion to self._P (if applicable)
    932932            # is done in InfinitePolynomial()
    933933            return InfinitePolynomial(self, x)
    934         except:
     934        except StandardError:
    935935            pass
    936936           
    937937        # By now, we can assume that x has a parent, because
     
    940940        # If it isn't a polynomial (duck typing: we need
    941941        # the variables attribute), we fall back to using strings
    942942        if not hasattr(x,'variables'):
    943             try: 
     943            try:
    944944                return sage_eval(repr(x), self.gens_dict())
    945             except:
     945            except StandardError:
    946946                raise ValueError, "Can't convert %s into an element of %s" % (x, self)
    947947
    948948        # direct conversion will only be used if the underlying polynomials are libsingular.
     
    10321032                # Hence, for being on the safe side, we coerce into a pushout ring:
    10331033                x = R(1)*x
    10341034                return InfinitePolynomial(self,x)
    1035             except:
     1035            except StandardError:
    10361036                # OK, last resort, to be on the safe side
    10371037                try:
    10381038                    return sage_eval(repr(x), self._gens_dict)
     
    10871087        # try to find the correct base ring in other ways:
    10881088        try:
    10891089            o = B.one_element()*R.one_element()
    1090         except:
     1090        except StandardError:
    10911091            raise TypeError, "We can't tensor with "+repr(R)
    10921092        return InfinitePolynomialRing(o.parent(), self._names, self._order, implementation='sparse')
    10931093       
     
    15871587        # try to find the correct base ring in other ways:
    15881588        try:
    15891589            o = B.one_element()*R.one_element()
    1590         except:
     1590        except StandardError:
    15911591            raise TypeError, "We can't tensor with "+repr(R)
    15921592        return InfinitePolynomialRing(o.parent(), self._names, self._order, implementation='dense')
    15931593
  • sage/rings/polynomial/pbori.pyx

    diff --git a/sage/rings/polynomial/pbori.pyx b/sage/rings/polynomial/pbori.pyx
    a b  
    944944
    945945        try:
    946946            i = int(other)
    947         except:
     947        except StandardError:
    948948            raise TypeError, "cannot convert %s to BooleanPolynomial"%(type(other))
    949949
    950950        i = i % 2
     
    46624662                if PY_TYPE_CHECK(x, BooleanPolynomial):
    46634663                   return result.lm()
    46644664                return result
    4665             except:
     4665            except StandardError:
    46664666                raise TypeError, "Cannot convert to Boolean Monomial %s"%(str(type(x)))
    46674667
    46684668cdef class VariableConstruct:
     
    77747774                if PY_TYPE_CHECK(arg, BooleanPolynomial):
    77757775                   return result.lm()
    77767776                return result
    7777             except:
     7777            except StandardError:
    77787778                raise TypeError, \
    77797779                    "Cannot %s convert to Boolean Monomial"%(str(type(arg)))
    77807780
  • sage/rings/polynomial/polynomial_ring.py

    diff --git a/sage/rings/polynomial/polynomial_ring.py b/sage/rings/polynomial/polynomial_ring.py
    a b  
    394394            self._singular_().set_ring()
    395395            try:
    396396                return x.sage_poly(self)
    397             except:
     397            except StandardError:
    398398                raise TypeError, "Unable to coerce singular object"
    399399        elif isinstance(x , str):
    400400            try:
  • sage/rings/polynomial/symmetric_ideal.py

    diff --git a/sage/rings/polynomial/symmetric_ideal.py b/sage/rings/polynomial/symmetric_ideal.py
    a b  
    247247        """
    248248        try:
    249249            return self.reduce(p) == 0
    250         except:
     250        except StandardError:
    251251            return False
    252252
    253253    def __mul__ (self, other):
     
    953953
    954954            try: # working around one libsingular bug and one libsingular oddity
    955955                DenseIdeal = [CommonR(P._p) if ((CommonR is P._p.parent()) or CommonR.ngens()!=P._p.parent().ngens()) else CommonR(repr(P._p))  for P in OUT.gens()]*CommonR
    956             except:
     956            except StandardError:
    957957                if report != None:
    958958                    print "working around a libsingular bug"
    959959                DenseIdeal = [repr(P._p) for P in OUT.gens()]*CommonR
  • sage/rings/polynomial/term_order.py

    diff --git a/sage/rings/polynomial/term_order.py b/sage/rings/polynomial/term_order.py
    a b  
    622622                if not isinstance(name, (tuple,list)):
    623623                    name = name.list() # name may be a matrix
    624624                name = tuple(name)
    625             except:
     625            except StandardError:
    626626                raise TypeError, "%s is not a valid term order"%(name,)
    627627
    628628        self._blocks = tuple()
     
    640640                if not isinstance(t, TermOrder):
    641641                    try:
    642642                        t = TermOrder(t,force=True)
    643                     except:
     643                    except StandardError:
    644644                        raise TypeError
    645645                if t.name() == 'block':
    646646                    blocks = blocks + list(t.blocks())
     
    16841684        if not isinstance(other, TermOrder):
    16851685            try:
    16861686                other = TermOrder(other, force=True)
    1687             except:
     1687            except StandardError:
    16881688                return False
    16891689
    16901690        return (self._name == other._name       # note that length is not considered.
  • sage/rings/polynomial/toy_variety.py

    diff --git a/sage/rings/polynomial/toy_variety.py b/sage/rings/polynomial/toy_variety.py
    a b  
    7171  else:
    7272    try:
    7373      G = B.gens()
    74     except:
     74    except StandardError:
    7575      raise TypeError, "is_triangular wants as input an ideal, or a list of polynomials\n"
    7676  vars = G[0].parent().gens()
    7777  n = len(G)
     
    262262  else:
    263263    try:
    264264      G = B.gens()
    265     except:
     265    except StandardError:
    266266      raise TypeError, "triangular_factorization wants as input an ideal, or a list of polynomials\n"
    267267  # easy cases
    268268  if len(G)==0:
     
    331331  else:
    332332    try:
    333333      G = B.gens()
    334     except:
     334    except StandardError:
    335335      raise TypeError, "elim_pol wants as input an ideal or a list of polynomials"
    336336 
    337337  # setup -- main algorithm
  • sage/rings/rational.pyx

    diff --git a/sage/rings/rational.pyx b/sage/rings/rational.pyx
    a b  
    22872287            except AttributeError:
    22882288                try:
    22892289                    return type(n)(self)**n
    2290                 except:
     2290                except StandardError:
    22912291                    raise TypeError, "exponent (=%s) must be an integer.\nCoerce your numbers to real or complex numbers first."%n
    22922292
    22932293        except OverflowError:
  • sage/rings/real_lazy.pyx

    diff --git a/sage/rings/real_lazy.pyx b/sage/rings/real_lazy.pyx
    a b  
    718718        """
    719719        try:
    720720            return self.eval(complex)
    721         except:
     721        except StandardError:
    722722            from complex_field import ComplexField
    723723            return complex(self.eval(ComplexField(53)))
    724724       
  • sage/rings/residue_field.pyx

    diff --git a/sage/rings/residue_field.pyx b/sage/rings/residue_field.pyx
    a b  
    855855
    856856        try:
    857857            return self._F(self._to_vs(x) * self._PBinv)
    858         except: pass
     858        except StandardError: pass
    859859
    860860        # Now we do have to work harder...below this point we handle
    861861        # cases which failed before trac 1951 was fixed.
  • sage/schemes/elliptic_curves/ell_field.py

    diff --git a/sage/schemes/elliptic_curves/ell_field.py b/sage/schemes/elliptic_curves/ell_field.py
    a b  
    657657                    jbase = g.preimage(j)
    658658                    f = g
    659659                    break
    660                 except:
     660                except StandardError:
    661661                    pass
    662662            if f == None:
    663663                return None
    664664        else:
    665665            try:
    666666                jbase = f.preimage(j)
    667             except:
     667            except StandardError:
    668668                return None
    669669        E = EllipticCurve(j=jbase)
    670670        E2 = EllipticCurve(self.base_field(), [f(a) for a in E.a_invariants()])
     
    692692        if Etwist.is_isomorphic(self):
    693693            try:
    694694                Eout = EllipticCurve(K, [f.preimage(a) for a in Etwist.a_invariants()])
    695             except:
     695            except StandardError:
    696696                return None
    697697            else:
    698698                return Eout
  • sage/schemes/elliptic_curves/ell_finite_field.py

    diff --git a/sage/schemes/elliptic_curves/ell_finite_field.py b/sage/schemes/elliptic_curves/ell_finite_field.py
    a b  
    14171417            N=self._order
    14181418            if debug:
    14191419                print "Group order already known to be ",N
    1420         except:
     1420        except StandardError:
    14211421            if (q<50):
    14221422                if debug:
    14231423                    print "Computing group order naively"
  • sage/schemes/elliptic_curves/ell_point.py

    diff --git a/sage/schemes/elliptic_curves/ell_point.py b/sage/schemes/elliptic_curves/ell_point.py
    a b  
    32113211        if ord==None: ord=self.order()
    32123212        try:
    32133213            return generic.discrete_log(Q,self,ord,operation='+')
    3214         except:
     3214        except StandardError:
    32153215            raise ValueError, "ECDLog problem has no solution"
    32163216
    32173217
     
    32853285                plist = M.prime_divisors()
    32863286                E._prime_factors_of_order = plist
    32873287            N = generic.order_from_multiple(self,M,plist,operation='+')
    3288         except:
     3288        except StandardError:
    32893289            if K.is_prime_field():
    32903290                M = E.cardinality() # computed and cached
    32913291                plist = M.prime_divisors()
  • sage/schemes/elliptic_curves/ell_tate_curve.py

    diff --git a/sage/schemes/elliptic_curves/ell_tate_curve.py b/sage/schemes/elliptic_curves/ell_tate_curve.py
    a b  
    498498        yy = t + s * C**2 * P[0] + C**3 * P[1]
    499499        try:
    500500            Pq = Eq([xx,yy])
    501         except:
     501        except StandardError:
    502502            raise RuntimeError, "Bug : Point %s does not lie on the curve "%[xx,yy]
    503503
    504504        tt = -xx/yy
  • sage/schemes/elliptic_curves/gal_reps.py

    diff --git a/sage/schemes/elliptic_curves/gal_reps.py b/sage/schemes/elliptic_curves/gal_reps.py
    a b  
    11501150            misc.verbose("field of degree %s.  try to compute galois group"%(d),2)
    11511151            try:
    11521152                G = K.galois_group()
    1153             except:
     1153            except StandardError:
    11541154                self.__image_type[p] = "The image is a group of order %s."%d
    11551155                return self.__image_type[p]
    11561156
  • sage/schemes/generic/rational_point.py

    diff --git a/sage/schemes/generic/rational_point.py b/sage/schemes/generic/rational_point.py
    a b  
    368368    for c in cartesian_product_iterator([F]*n):
    369369        try:
    370370            pts.append(X(c))
    371         except:
     371        except StandardError:
    372372            pass
    373373    pts.sort()
    374374    return pts
  • sage/server/notebook/cell.py

    diff --git a/sage/server/notebook/cell.py b/sage/server/notebook/cell.py
    a b  
    19191919            except OSError:
    19201920                try:
    19211921                    shutil.rmtree(F)
    1922                 except:
     1922                except StandardError:
    19231923                    pass
    19241924               
    19251925    def version(self):
  • sage/server/notebook/compress/JavaScriptCompressor.py

    diff --git a/sage/server/notebook/compress/JavaScriptCompressor.py b/sage/server/notebook/compress/JavaScriptCompressor.py
    a b  
    212212                key = 0
    213213                try:
    214214                        key = self.__container.index(str)
    215                 except:
     215                except StandardError:
    216216                        key = len(self.__container)
    217217                        self.__container.append(str)
    218218                return key
  • sage/server/notebook/interact.py

    diff --git a/sage/server/notebook/interact.py b/sage/server/notebook/interact.py
    a b  
    22692269        ...     try:
    22702270        ...         x = A\v
    22712271        ...         html('$$%s %s = %s$$'%(latex(A), latex(x), latex(v)))
    2272         ...     except:
     2272        ...     except StandardError:
    22732273        ...         html('There is no solution to $$%s x=%s$$'%(latex(A), latex(v)))
    22742274        <html>...
    22752275
     
    25212521                try:
    25222522                    x = m\v
    25232523                    html('$$%s %s = %s$$'%(latex(m), latex(x), latex(v)))
    2524                 except:
     2524                except StandardError:
    25252525                    html('There is no solution to $$%s x=%s$$'%(latex(m), latex(v)))
    25262526
    25272527        EXAMPLES::
  • sage/server/notebook/notebook.py

    diff --git a/sage/server/notebook/notebook.py b/sage/server/notebook/notebook.py
    a b  
    20712071    if os.path.exists(dir):
    20722072        try:
    20732073            nb = load(sobj, compress=False)
    2074         except:
     2074        except StandardError:
    20752075            backup = '%s/backups/'%dir
    20762076            if os.path.exists(backup):
    20772077                print "****************************************************************"
  • sage/server/notebook/sage_email.py

    diff --git a/sage/server/notebook/sage_email.py b/sage/server/notebook/sage_email.py
    a b  
    103103   
    104104    try:
    105105        pid = os.fork()
    106     except:
     106    except StandardError:
    107107        print "Fork not possible -- the email command is not supported on this platform."
    108108        return
    109109
  • sage/server/notebook/twist.py

    diff --git a/sage/server/notebook/twist.py b/sage/server/notebook/twist.py
    a b  
    24622462
    24632463    #child_login = RedirectLogin()
    24642464
    2465     # userchild_* is like Twisted's child_, etc. except:
     2465    # userchild_* is like Twisted's child_, etc. except StandardError:
    24662466    #  (1) it also sets the username in the __init__ method, and
    24672467    #  (2) it calls the constructor for the object, i.e., it is
    24682468    #      a class rather than an object.
  • sage/server/notebook/user.py

    diff --git a/sage/server/notebook/user.py b/sage/server/notebook/user.py
    a b  
    5757            if os.path.exists(history_file):
    5858                try:
    5959                    self.history = cPickle.load(open(history_file))
    60                 except:
     60                except StandardError:
    6161                    print "Error loading history for user %s"%self.__username
    6262                    self.history = []
    6363            else:
  • sage/server/notebook/worksheet.py

    diff --git a/sage/server/notebook/worksheet.py b/sage/server/notebook/worksheet.py
    a b  
    19951995                #print "Saving ", self.directory() 
    19961996                self.save()  # make sure the worksheet.txt file is up to date.
    19971997                del d['_Worksheet__cells']
    1998             except:
     1998            except StandardError:
    19991999                # It is important to catch all exceptions.  If
    20002000                # *anything* goes wrong here we must catch it or the
    20012001                # whole notebook sobj could get messed up,
     
    27192719           
    27202720        try:
    27212721            os.kill(pid, 9)
    2722         except:
     2722        except StandardError:
    27232723            pass
    27242724
    27252725        del self.__sage
     
    33523352                try:
    33533353                    cell = completions[r + l*c]
    33543354                    row.append(cell)
    3355                 except:
     3355                except StandardError:
    33563356                    pass
    33573357            rows.append(row)
    33583358        return format_completions_as_html(id, rows)
     
    41154115            a, b = v.strip().split('=')
    41164116            try:
    41174117                b = eval(b)
    4118             except:
     4118            except StandardError:
    41194119                pass
    41204120            w.append([a, b])
    41214121    except ValueError:
  • sage/server/support.py

    diff --git a/sage/server/support.py b/sage/server/support.py
    a b  
    274274    try:
    275275        try:
    276276            return obj._sage_src_()
    277         except:
     277        except StandardError:
    278278            pass
    279279        newline = "\n\n"  # blank line to start new paragraph
    280280        indent = "    "   # indent source code to mark it as a code block
  • sage/structure/category_object.pyx

    diff --git a/sage/structure/category_object.pyx b/sage/structure/category_object.pyx
    a b  
    7373                    return Algebras(obj._base)
    7474                else:
    7575                    return Rings()
    76     except:
     76    except StandardError:
    7777        pass
    7878    from sage.structure.parent import Parent
    7979    #if isinstance(obj, Parent):
  • sage/structure/coerce.pyx

    diff --git a/sage/structure/coerce.pyx b/sage/structure/coerce.pyx
    a b  
    641641            pass
    642642        try:
    643643            ret = parent_c(~parent.one_element())
    644         except:
     644        except StandardError:
    645645            self._record_exception()
    646646            ret = parent_c(~parent.an_element())
    647647        self._division_parents.set(parent, None, None, ret)
     
    927927        if is_Integer(x) and not x and not PY_TYPE_CHECK_EXACT(yp, type):
    928928            try:
    929929                return yp(0), y
    930             except:
     930            except StandardError:
    931931                self._record_exception()
    932932
    933933        if is_Integer(y) and not y and not PY_TYPE_CHECK_EXACT(xp, type):
    934934            try:
    935935                return x, xp(0)
    936             except:
     936            except StandardError:
    937937                self._record_exception()
    938938               
    939939        raise TypeError, "no common canonical parent for objects with parents: '%s' and '%s'"%(xp, yp)
     
    11691169                if coerce_S is None:
    11701170                    raise TypeError, "No coercion from %s to pushout %s" % (S, Z)
    11711171                return coerce_R, coerce_S
    1172             except:
     1172            except StandardError:
    11731173                self._record_exception()
    11741174
    11751175        return None
  • sage/structure/coerce_maps.pyx

    diff --git a/sage/structure/coerce_maps.pyx b/sage/structure/coerce_maps.pyx
    a b  
    3434    cpdef Element _call_(self, x):
    3535        try:
    3636            return self._codomain._element_constructor(self._codomain, x)
    37         except:
     37        except StandardError:
    3838            if print_warnings:
    3939                print type(self._codomain), self._codomain
    4040                print type(self._codomain._element_constructor), self._codomain._element_constructor
     
    5353                    return self._codomain._element_constructor(self._codomain, x, *args)
    5454                else:
    5555                    return self._codomain._element_constructor(self._codomain, x, *args, **kwds)
    56         except:
     56        except StandardError:
    5757            if print_warnings:
    5858                print type(self._codomain), self._codomain
    5959                print type(self._codomain._element_constructor), self._codomain._element_constructor
     
    7575    cpdef Element _call_(self, x):
    7676        try:
    7777            return self._codomain._element_constructor(x)
    78         except:
     78        except StandardError:
    7979            if print_warnings:
    8080                print type(self._codomain), self._codomain
    8181                print type(self._codomain._element_constructor), self._codomain._element_constructor
     
    9393                    return self._codomain._element_constructor(x, *args)
    9494                else:
    9595                    return self._codomain._element_constructor(x, *args, **kwds)
    96         except:
     96        except StandardError:
    9797            if print_warnings:
    9898                print type(self._codomain), self._codomain
    9999                print type(self._codomain._element_constructor), self._codomain._element_constructor
     
    261261                y = self._func(self._codomain, x)
    262262            else:
    263263                y = self._func(x)
    264         except:
     264        except StandardError:
    265265            if print_warnings:
    266266                print self._func
    267267                print self._codomain
     
    297297                y = self._func(self._codomain, x, *args, **kwds)
    298298            else:
    299299                y = self._func(x, *args, **kwds)
    300         except:
     300        except StandardError:
    301301            if print_warnings:
    302302                print self._func
    303303                print self._codomain
  • sage/structure/element.pyx

    diff --git a/sage/structure/element.pyx b/sage/structure/element.pyx
    a b  
    33563356                    return a.parent().one()
    33573357                except AttributeError:
    33583358                    return type(a)(1)
    3359             except:
     3359            except StandardError:
    33603360                return 1 #oops, the one sucks
    33613361        else:
    33623362            return one
  • sage/structure/factorization.py

    diff --git a/sage/structure/factorization.py b/sage/structure/factorization.py
    a b  
    420420            return cmp(type(self), type(other))
    421421        try:
    422422            return cmp(self.value(), other.value())
    423         except:
     423        except StandardError:
    424424            c = cmp(self.__unit, other.__unit)
    425425            if c: return c
    426426            return list.__cmp__(self, other)
     
    583583        """
    584584        try:
    585585            return self.universe().is_commutative()
    586         except:
     586        except StandardError:
    587587            # This is not the mathematically correct default, but agrees with
    588588            # history -- we've always assumed factored things commute
    589589            return True
  • sage/structure/parent.pyx

    diff --git a/sage/structure/parent.pyx b/sage/structure/parent.pyx
    a b  
    12581258            if is_Integer(x) and not x:
    12591259                try:
    12601260                    return self(0)
    1261                 except:
     1261                except StandardError:
    12621262                    _record_exception()
    12631263            raise TypeError("no canonical coercion from %s to %s" % (parent_c(x), self))
    12641264        else:
     
    26432643            return super(Parent, self)._an_element_()
    26442644        except EmptySetError:
    26452645            raise
    2646         except:
     2646        except StandardError:
    26472647            _record_exception()
    26482648            pass
    26492649
    26502650        try:
    26512651            return self.gen(0)
    2652         except:
     2652        except StandardError:
    26532653            _record_exception()
    26542654            pass
    26552655           
    26562656        try:
    26572657            return self.gen()
    2658         except:
     2658        except StandardError:
    26592659            _record_exception()
    26602660            pass
    26612661
  • sage/structure/parent_old.pyx

    diff --git a/sage/structure/parent_old.pyx b/sage/structure/parent_old.pyx
    a b  
    362362        check_old_coerce(self)
    363363        try:
    364364            return self.gen(0)
    365         except:
     365        except StandardError:
    366366            pass
    367367           
    368368        try:
    369369            return self.gen()
    370         except:
     370        except StandardError:
    371371            pass
    372372           
    373373        from sage.rings.infinity import infinity
  • sage/structure/sage_object.pyx

    diff --git a/sage/structure/sage_object.pyx b/sage/structure/sage_object.pyx
    a b  
    367367            except NotImplementedError:
    368368                # It would be best to make sure that this NotImplementedError was triggered by AbstractMethod
    369369                tester.fail("Not implemented method: %s"%name)
    370             except:
     370            except StandardError:
    371371                pass
    372372
    373373    def _test_pickling(self, **options):
     
    433433        else:
    434434            try:
    435435                s = self._interface_init_(I)
    436             except:
     436            except StandardError:
    437437                raise NotImplementedError, "coercion of object %s to %s not implemented:\n%s\n%s"%\
    438438                  (repr(self), I)
    439439        X = I(s)
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    32293229            else:
    32303230                B=[A[0],SR(A[1])]
    32313231            B.append(Integer(A[len(A)-1]))
    3232         except:
     3232        except StandardError:
    32333233            raise NotImplementedError, "Wrong arguments passed to taylor. See taylor? for more details."
    32343234        l = self._maxima_().taylor(B)
    32353235        return self.parent()(l)
     
    82828282                from sage.symbolic.relation import solve_ineq
    82838283                try:
    82848284                    return(solve_ineq(self)) # trying solve_ineq_univar
    8285                 except:
     8285                except StandardError:
    82868286                    pass
    82878287                try:
    82888288                    return(solve_ineq([self])) # trying solve_ineq_fourier
    8289                 except:
     8289                except StandardError:
    82908290                    raise NotImplementedError, "solving only implemented for equalities and few special inequalities, see solve_ineq"
    82918291            ex = self
    82928292        else:
     
    83588358                    s = m.to_poly_solve(x)
    83598359                    T = string_to_list_of_solutions(repr(s))
    83608360                    X = [t[0] for t in T]
    8361                 except: # if that gives an error, stick with no solutions
     8361                except StandardError: # if that gives an error, stick with no solutions
    83628362                    X = []
    83638363
    83648364            for eq in X:
  • sage/symbolic/function.pyx

    diff --git a/sage/symbolic/function.pyx b/sage/symbolic/function.pyx
    a b  
    416416                    else:
    417417                        try:
    418418                            nargs[i] = SR.coerce(carg)
    419                         except:
     419                        except StandardError:
    420420                            raise TypeError, "cannot coerce arguments: %s"%(err)
    421421                args = nargs
    422422        else: # coerce == False
  • sage/symbolic/pynac.pyx

    diff --git a/sage/symbolic/pynac.pyx b/sage/symbolic/pynac.pyx
    a b  
    922922cdef public bint py_is_even(object x) except +:
    923923    try:
    924924        return not(x%2)
    925     except:
     925    except StandardError:
    926926        try:
    927927            return not(ZZ(x)%2)
    928         except:
     928        except StandardError:
    929929            pass
    930930    return 0
    931931
     
    968968cdef public bint py_is_prime(object n) except +:
    969969    try:
    970970        return n.is_prime()
    971     except:  # yes, I'm doing this on purpose.
     971    except StandardError:  # yes, I'm doing this on purpose.
    972972        pass
    973973    try:
    974974        return sage.rings.arith.is_prime(n)
    975     except:
     975    except StandardError:
    976976        pass
    977977    return False
    978978
  • sage/symbolic/relation.py

    diff --git a/sage/symbolic/relation.py b/sage/symbolic/relation.py
    a b  
    423423            if repr( f() ).strip() == "0":
    424424                return True
    425425                break
    426         except:
     426        except StandardError:
    427427            pass
    428428    return False
    429429
     
    690690
    691691    try:
    692692        s = m.solve(variables)
    693     except: # if Maxima gave an error, try its to_poly_solve
     693    except StandardError: # if Maxima gave an error, try its to_poly_solve
    694694        try:
    695695            s = m.to_poly_solve(variables)
    696696        except TypeError, mess: # if that gives an error, raise an error.
     
    702702    if len(s)==0: # if Maxima's solve gave no solutions, try its to_poly_solve
    703703        try:
    704704            s = m.to_poly_solve(variables)
    705         except: # if that gives an error, stick with no solutions
     705        except StandardError: # if that gives an error, stick with no solutions
    706706            s = []
    707707
    708708    if len(s)==0: # if to_poly_solve gave no solutions, try use_grobner
    709709        try:
    710710            s = m.to_poly_solve(variables,'use_grobner=true')
    711         except: # if that gives an error, stick with no solutions
     711        except StandardError: # if that gives an error, stick with no solutions
    712712            s = []
    713713
    714714    sol_list = string_to_list_of_solutions(repr(s))
  • setup.py

    diff --git a/setup.py b/setup.py
    a b  
    823823    ##     f = open(CYTHON_DEPS_FILE)
    824824    ##     deps = pickle.load(open(CYTHON_DEPS_FILE))
    825825    ##     f.close()
    826     ## except:
     826    ## except StandardError:
    827827    ##     deps = DependencyTree()
    828828    deps = DependencyTree()
    829829    queue = compile_command_list(ext_modules, deps)