summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Hilliard <jonathan.hilliard@hpe.com>2020-01-28 15:06:11 -0600
committerJonathan Hilliard <jonathan.hilliard@hpe.com>2020-01-28 15:06:11 -0600
commitc1fce712bea25d2fb33b843ccc8f4cd0fca7361d (patch)
treee3bdd57ff74a4ad11b1b1e773b9c4ba964d45e8d
parent97e18f38e03961c8984969214bdc082c2a4560e4 (diff)
downloadpython-json-patch-c1fce712bea25d2fb33b843ccc8f4cd0fca7361d.tar.gz
Added comment.
-rw-r--r--jsonpatch.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/jsonpatch.py b/jsonpatch.py
index 5454f56..83a04a5 100644
--- a/jsonpatch.py
+++ b/jsonpatch.py
@@ -825,6 +825,13 @@ class DiffBuilder(object):
isinstance(dst, MutableSequence):
self._compare_lists(_path_join(path, key), src, dst)
+ # To ensure we catch changes to JSON, we can't rely on a simple
+ # src == dst, or it would not recognize the difference between
+ # 1 and True, among other things. Using json.dumps is the most
+ # fool-proof way to ensure we catch type changes that matter to JSON
+ # and ignore those that don't. The performance of this could be
+ # improved by doing more direct type checks, but we'd need to be
+ # careful to accept type changes that don't matter when JSONified.
elif json.dumps(src) == json.dumps(dst):
return