Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jsonutil: fix handling of None in json patches
A null key in a JSON patch means "delete the existing key at this location", but the operation should be idempotent, and certainly if the key is missing, we shouldn't have a crash. Unfortunately, as a long-standing bug, we've been using .pop() without a default value for this, which will indeed crash if the original value is missing. It seems that nobody has ever attempted that, and we don't test for it either. Let's use the non-failing form of .pop() with a default value and add a test to make sure this is working: once for removing an existing attribute, and once for removing a non-existing attribute.
- Loading branch information