Skip to content

Commit 78abec1

Browse files
committed
Add comment
1 parent 8d15ed5 commit 78abec1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

jsonpatch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,10 @@ def _item_removed(self, path, key, item):
802802
new_index = self.insert(new_op)
803803
if index is not None:
804804
op = index[2]
805+
# We can't rely on the op.key property type since PatchOperation casts
806+
# the .key property to int and this path wrongly ends up being taken
807+
# for numeric string dict keys while the intention is to only handle lists.
808+
# So we do an explicit check on the item affected by the op instead.
805809
added_item = op.pointer.to_last(self.dst_doc)[0]
806810
if type(added_item) == list:
807811
for v in self.iter_from(index):

0 commit comments

Comments
 (0)