One function
OneToOne in mahmoud/boltons
The author described this change as “fix OneToOne.update behavior with empty iterables”. It counts as a record because the check below fails on the code as it stood at 985df86bb and passes on 6cac49ce4, with nothing else changed between the two runs.
Projectmahmoud/boltons
Fix saved2023-11-02
Sharing licenceBSD-2-Clause · LICENSE
Change size+1 −0
What the code was meant to do, written into the code itself as a docstring
Implements a one-to-one mapping dictionary. In addition to inheriting from and behaving exactly like the builtin :class:`dict`, all values are automatically added as keys on a reverse mapping, available as the `inv` attribute. This arrangement keeps key and value namespaces distinct. Basic operations are intuitive: Overwrites happens in both directions: For a very similar project, with even more one-to-one functionality, check out `bidict <https://github.com/jab/bidict>`_.
The change
| 121 | 121 | return self[key] | |
| 122 | 122 | ||
| 123 | 123 | def update(self, dict_or_iterable, **kw): | |
| 124 | + | keys_vals = [] | |
| 124 | 125 | if isinstance(dict_or_iterable, dict): | |
| 125 | 126 | for val in dict_or_iterable.values(): | |
| 126 | 127 | hash(val) |
The check that tells the two apart
fail→pass·tests/test_dictutils.py::test_one_to_one
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 it985df86bbf511b244ce6acf7a9c3b8a0d09d0fb3
Broken version dated2023-11-01
Moduleboltons.dictutils
Units changedOneToOne
Fingerprintc77702065b99dcf9
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