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

Commit

Permalink
trac #15622: More informative exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanncohen committed Jan 3, 2014
1 parent 0f57805 commit 529f785
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sage/graphs/generic_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand Down

0 comments on commit 529f785

Please sign in to comment.