Whole file
mahmoud/boltons
The author described this change as “Fix copy.copy/copy.deepcopy collapsing OrderedMultiDict values”. It counts as a record because the check below fails on the code as it stood at bba729bf4 and passes on ebc7a8f77, with nothing else changed between the two runs.
Projectmahmoud/boltons
Fix saved2026-07-17
Sharing licenceBSD-2-Clause · LICENSE
Change size+8 −0
What the code was meant to do, written into the code itself as a save note
Fix copy.copy/copy.deepcopy collapsing OrderedMultiDict values
The change
| 180 | 180 | self.clear() | |
| 181 | 181 | self.update_extend(state) | |
| 182 | 182 | ||
| 183 | + | def __reduce__(self): | |
| 184 | + | # The default dict-subclass reduce includes a dictitems iterator | |
| 185 | + | # whose entries are reapplied via __setitem__ after __setstate__, | |
| 186 | + | # collapsing each key's multiple values down to a single value. | |
| 187 | + | # __getstate__/__setstate__ already round-trip the full (multi) state, | |
| 188 | + | # so omit dictitems by returning a plain (callable, args, state) tuple. | |
| 189 | + | return (self.__class__, (), self.__getstate__()) | |
| 190 | + | ||
| 183 | 191 | def _clear_ll(self): | |
| 184 | 192 | try: | |
| 185 | 193 | _map = self._map |
The check that tells the two apart
fail→pass·tests/test_dictutils.py::test_omd_copy_module
Check file tests/test_dictutils.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 itbba729bf4539afc993a6410bdf8074b28707004a
Broken version dated2026-07-17
Moduleboltons.dictutils
Units changedOrderedMultiDict
Fingerprint712d5154f43b7f57
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in mahmoud/boltons
- 2026-08-06Bits
- 2026-08-06JSONLIterator
- 2026-08-06tableutils: fix Table.to_text crashes on degenerate tables and headers
- 2026-07-18backoff_iter
- 2026-07-17singularize
- 2026-07-17fix(fileutils): accept os.PathLike in AtomicSaver