Skip to content

Commit

Permalink
fix: bug when changing variable names (#63)
Browse files Browse the repository at this point in the history
Only update the _variables_to_constriants_mapping dict when new_name !=
old_name
  • Loading branch information
KristianJensen authored Jan 31, 2017
1 parent 1b2a085 commit 02a3300
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion optlang/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def name(self):
def name(self, value):
old_name = getattr(self, 'name', None)
self._name = value
if getattr(self, 'problem', None) is not None:
if getattr(self, 'problem', None) is not None and value != old_name:
self.problem.variables.update_key(old_name)
self.problem._variables_to_constraints_mapping[value] = self.problem._variables_to_constraints_mapping[old_name]
del self.problem._variables_to_constraints_mapping[old_name]
Expand Down

0 comments on commit 02a3300

Please sign in to comment.