diff options
author | Ryan Marvin <marvinryan@ymail.com> | 2021-02-18 18:25:25 +0300 |
---|---|---|
committer | Ryan Marvin <marvinryan@ymail.com> | 2021-02-18 18:25:25 +0300 |
commit | 78abec1651c4c3166d0eda4f9c0e43e00df57494 (patch) | |
tree | b476f1112728c1c6b96e8c7a8c525df6cabec6c6 | |
parent | 8d15ed5740027d5c0f295f82b347d963c77b8c5e (diff) | |
download | python-json-patch-78abec1651c4c3166d0eda4f9c0e43e00df57494.tar.gz |
Add comment
-rw-r--r-- | jsonpatch.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/jsonpatch.py b/jsonpatch.py index 14341d7..7b895b7 100644 --- a/jsonpatch.py +++ b/jsonpatch.py @@ -802,6 +802,10 @@ class DiffBuilder(object): new_index = self.insert(new_op) if index is not None: op = index[2] + # We can't rely on the op.key property type since PatchOperation casts + # the .key property to int and this path wrongly ends up being taken + # for numeric string dict keys while the intention is to only handle lists. + # So we do an explicit check on the item affected by the op instead. added_item = op.pointer.to_last(self.dst_doc)[0] if type(added_item) == list: for v in self.iter_from(index): |