From 529f7850c111c19522a8f18f9ce829e1e3a5b769 Mon Sep 17 00:00:00 2001 From: Nathann Cohen Date: Fri, 3 Jan 2014 09:29:03 +0100 Subject: [PATCH] trac #15622: More informative exception message --- src/sage/graphs/generic_graph.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 9d071cb3467..13a5ae9f265 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -16401,7 +16401,7 @@ def relabel(self, perm=None, inplace=True, return_map=False, check_input = True, sage: Graph(graphs.PetersenGraph(), immutable=True).relabel({}) Traceback (most recent call last): ... - ValueError: Thou shalt not relabel an immutable graph + ValueError: To relabel an immutable graph use inplace=False """ from sage.groups.perm_gps.permgroup_element import PermutationGroupElement @@ -16420,6 +16420,9 @@ def relabel(self, perm=None, inplace=True, return_map=False, check_input = True, else: return G + if getattr(self, "_immutable", False): + raise ValueError("To relabel an immutable graph use inplace=False") + # If perm is not a dictionary, we build one ! if perm is None: