Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'u/tmonteil/except_fix_branch' in 9.5.rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Jan 14, 2022
2 parents 3da1b22 + 9522357 commit de4faf6
Show file tree
Hide file tree
Showing 19 changed files with 615 additions and 722 deletions.
14 changes: 7 additions & 7 deletions src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,21 @@ def __classcall_private__(cls, dynamical_system, domain=None, ideal=None):
if not isinstance(dynamical_system, DynamicalSystem_affine):
try:
dynamical_system = DynamicalSystem_affine(dynamical_system)
except:
except (TypeError, ValueError):
raise TypeError('domain was affine Berkovich space, but dynamical_system did not ' + \
'convert to an affine dynamical system')
if isinstance(domain, Berkovich_Cp_Projective):
if not isinstance(dynamical_system, DynamicalSystem_projective):
try:
dynamical_system = DynamicalSystem_projective(dynamical_system)
except:
except (TypeError, ValueError):
raise TypeError('domain was projective Berkovich space, but dynamical_system did not convert ' + \
'to a projective dynamical system')

if not isinstance(dynamical_system, DynamicalSystem):
try:
dynamical_system = DynamicalSystem(dynamical_system)
except:
except (TypeError, ValueError):
raise TypeError('dynamical_system did not convert to a dynamical system')
morphism_domain = dynamical_system.domain()

Expand Down Expand Up @@ -803,8 +803,8 @@ def __call__(self, x, type_3_pole_check=True):
if not isinstance(x.parent(), Berkovich_Cp_Projective):
try:
x = self.domain()(x)
except:
raise TypeError('action of dynamical system not defined on %s' %x.parent())
except (TypeError, ValueError):
raise TypeError('action of dynamical system not defined on %s' % x.parent())
if x.parent().is_padic_base() != self.domain().is_padic_base():
raise ValueError('x was not backed by the same type of field as f')
if x.prime() != self.domain().prime():
Expand Down Expand Up @@ -893,7 +893,7 @@ def __call__(self, x, type_3_pole_check=True):
try:
factor_root_field = factor.root_field('a')
factor = factor.change_ring(factor_root_field)
except:
except (TypeError, ValueError):
raise NotImplementedError('cannot check if poles lie in type III disk')
else:
factor_root_field = factor.base_ring()
Expand Down Expand Up @@ -1078,7 +1078,7 @@ def __call__(self, x):
if not isinstance(x, Berkovich_Element_Cp_Affine):
try:
x = self.domain()(x)
except:
except (TypeError, ValueError):
raise ValueError('action of dynamical system not defined on %s' %x)
proj_system = self.homogenize(1)
return proj_system(x.as_projective_point()).as_affine_point()
4 changes: 3 additions & 1 deletion src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ from sage.symbolic.ring import SR
from sage.calculus.var import var
from sage.rings.fraction_field import is_FractionField
from sage.categories.function_fields import FunctionFields
from sage.libs.all import PariError
from math import sqrt


def _color_to_RGB(color):
"""
Convert a color to an RGB triple with values in the interval [0,255].
Expand Down Expand Up @@ -763,7 +765,7 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0,
df = f.derivative(z).univariate_polynomial()
critical_pts = df.roots(multiplicities=False)
constant_c = True
except:
except PariError:
constant_c = False

# If c is in the constant term of the polynomial, then the critical points
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2461,7 +2461,7 @@ def _test_dilation(self, tester=None, **options):
new_ring = None
try:
new_ring = self.base_ring().composite_fields()[0]
except:
except (KeyError, AttributeError, TypeError):
# This isn't about testing composite fields.
pass
if new_ring:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/geometry/polyhedron/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,7 @@ def generalized_permutahedron(self, coxeter_type, point=None, exact=True, regula
from sage.combinat.root_system.coxeter_group import CoxeterGroup
try:
W = CoxeterGroup(coxeter_type)
except:
except (TypeError, ValueError):
raise ValueError("cannot build a Coxeter group from {}".format(coxeter_type))
n = W.one().canonical_matrix().rank()
weights = W.fundamental_weights()
Expand Down
6 changes: 3 additions & 3 deletions src/sage/graphs/digraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3324,7 +3324,7 @@ def layout_acyclic_dummy(self, heights=None, rankdir='up', **options):
try:
l = sorted(levels[i])
levels[i] = l
except:
except TypeError:
continue
if rankdir=='down' or rankdir=='left':
levels.reverse()
Expand Down Expand Up @@ -3969,7 +3969,7 @@ def _rec_out_branchings(depth):
# 2) Pick an edge e outgoing from the source
try:
s, x, l = next(D.outgoing_edge_iterator(source))
except:
except StopIteration:
return
# 3) Find all out_branchings that do not contain e
# by first removing it
Expand Down Expand Up @@ -4186,7 +4186,7 @@ def _rec_in_branchings(depth):
# 2) Pick an edge e incoming to the source
try:
x, s, l = next(D.incoming_edge_iterator(source))
except:
except StopIteration:
return
# 3) Find all in_branchings that do not contain e
# by first removing it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def is_valid_tree_decomposition(G, T):
for X in T:
try:
_ = list(X)
except:
except TypeError:
raise ValueError("the vertices of T must be iterables")

# 1. The union of the bags equals V
Expand Down
6 changes: 3 additions & 3 deletions src/sage/interfaces/polymake.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def to_str(x):
try:
x = RDF(x)
return '{}'.format(x)
except:
except (TypeError, ValueError):
pass

raise NotImplementedError
Expand Down Expand Up @@ -1595,7 +1595,7 @@ def str_to_base_ring(s):
if r == '':
return matrix(base_ring)
return matrix(base_ring, [[str_to_base_ring(s) for s in t.split(' ')] for t in r.split('\n')])
except:
except Exception:
pass

if T1:
Expand Down Expand Up @@ -2114,7 +2114,7 @@ def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if
EXAMPLES::
sage: from sage.interfaces.polymake import polymake_expect as polymake
sage: from sage.interfaces.polymake import polymake_expect as polymake # optional - polymake_expect
sage: p = polymake.cube(3) # optional - polymake_expect # indirect doctest
Here we see that remarks printed by polymake are displayed if
Expand Down
Loading

0 comments on commit de4faf6

Please sign in to comment.