Whole file
alecthomas/voluptuous
The author described this change as “Fix bug with Any validator and REMOVE_EXTRA (#524)”. It counts as a record because the check below fails on the code as it stood at a7a55f83b and passes on 4a9c8f8ef, with nothing else changed between the two runs.
Projectalecthomas/voluptuous
Fix saved2025-04-30
Sharing licenceBSD-3-Clause · COPYING
Change size+4 −2
What the code was meant to do, written into the code itself as a save note
Fix bug with Any validator and REMOVE_EXTRA (#524)
The change
| 364 | 364 | continue | |
| 365 | 365 | elif self.extra == ALLOW_EXTRA: | |
| 366 | 366 | out[key] = value | |
| 367 | + | elif self.extra == REMOVE_EXTRA: | |
| 368 | + | # ignore the key so it's removed from output | |
| 369 | + | continue | |
| 367 | 370 | elif error: | |
| 368 | 371 | errors.append(error) | |
| 369 | - | elif self.extra != REMOVE_EXTRA: | |
| 372 | + | else: | |
| 370 | 373 | errors.append(er.Invalid('extra keys not allowed', key_path)) | |
| 371 | - | # else REMOVE_EXTRA: ignore the key so it's removed from output | |
| 372 | 374 | ||
| 373 | 375 | # for any required keys left that weren't found and don't have defaults: | |
| 374 | 376 | for key in required_keys: |
The check that tells the two apart
fail→pass·voluptuous/tests/tests.py::test_any_with_extra_remove
Check file voluptuous/tests/tests.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 ita7a55f83b9fa7ba68b0669b3d78a61de703e0a16
Broken version dated2024-07-22
Modulevoluptuous.schema_builder
Units changedSchema
Fingerprint0c53d23bd8e3ff7e
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 alecthomas/voluptuous
- 2026-07-11Number
- 2026-07-04Number
- 2024-06-23Fix vol.Remove not removing keys that do not validate (#515)
- 2024-02-01fix: allow unsortable containers in In and NotIn validators (fixes #451) (#506)