Whole file
python-constraint/python-constraint
The author described this change as “[Fix #50] Fix support for using a Domain subclass (#51)”. It counts as a record because the check below fails on the code as it stood at ce0a6815a and passes on e23fe9852, with nothing else changed between the two runs.
Fix saved2019-04-10
Sharing licenceBSD-2-Clause · LICENSE
Change size+3 −3
What the code was meant to do, written into the code itself as a save note
[Fix #50] Fix support for using a Domain subclass (#51)
The change
| 146 | 146 | if variable in self._variables: | |
| 147 | 147 | msg = "Tried to insert duplicated variable %s" % repr(variable) | |
| 148 | 148 | raise ValueError(msg) | |
| 149 | - | if hasattr(domain, "__getitem__"): | |
| 149 | + | if isinstance(domain, Domain): | |
| 150 | + | domain = copy.deepcopy(domain) | |
| 151 | + | elif hasattr(domain, "__getitem__"): | |
| 150 | 152 | domain = Domain(domain) | |
| 151 | - | elif isinstance(domain, Domain): | |
| 152 | - | domain = copy.copy(domain) | |
| 153 | 153 | else: | |
| 154 | 154 | msg = "Domains must be instances of subclasses of the Domain class" | |
| 155 | 155 | raise TypeError(msg) |
The check that tells the two apart
fail→pass·tests/test_problem.py::test_addVariable_support_domain_subclasses
Check file tests/test_problem.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itce0a6815ae645ca0cc7beaefea149e069a603643
Broken version dated2019-03-01
Moduleconstraint.__init__
Units changedProblem
Fingerprintf5610260fb85a680
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.