Skip to content

Commit 4443d32

Browse files
committed
Make move operation with from == path a no-op
1 parent a33021b commit 4443d32

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
@@ -484,6 +484,10 @@ def apply(self, obj):
484484
except (KeyError, IndexError) as ex:
485485
raise JsonPatchConflict(str(ex))
486486

487+
# If source and target are equal, this is a no-op
488+
if self.pointer == from_ptr:
489+
return obj
490+
487491
if isinstance(subobj, MutableMapping) and \
488492
self.pointer.contains(from_ptr):
489493
raise JsonPatchConflict('Cannot move values into its own children')

0 commit comments

Comments
 (0)