Whole file
jazzband/docopt-ng
The author described this change as “Fix repeated option matching across alternatives”. It counts as a record because the check below fails on the code as it stood at fab01f5f1 and passes on ca3bb1f2c, with nothing else changed between the two runs.
Projectjazzband/docopt-ng
Fix saved2026-07-18
Sharing licenceMIT · LICENSE-MIT
Change size+8 −1
What the code was meant to do, written into the code itself as a save note
Fix repeated option matching across alternatives
The change
| 314 | 314 | def single_match(self, left: list[_LeafPattern]) -> _SingleMatch: | |
| 315 | 315 | for n, pattern in enumerate(left): | |
| 316 | 316 | if self.name == pattern.name: | |
| 317 | - | return n, pattern | |
| 317 | + | value = ( | |
| 318 | + | pattern.value.copy() | |
| 319 | + | if isinstance(pattern.value, list) | |
| 320 | + | else pattern.value | |
| 321 | + | ) | |
| 322 | + | return n, _Option( | |
| 323 | + | pattern.short, pattern.longer, pattern.argcount, value | |
| 324 | + | ) | |
| 318 | 325 | return None, None | |
| 319 | 326 | ||
| 320 | 327 | @property |
The check that tells the two apart
fail→pass·tests/test_docopt.py::test_issue_60_repeated_options_across_usage_alternatives
Check file tests/test_docopt.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 itfab01f5f19c9c7ca30f05e79a06d79bd066b475a
Broken version dated2024-07-06
Moduledocopt.__init__
Units changed_Option
Fingerprint28a26963904e018a
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.