summaryrefslogtreecommitdiff
path: root/jsonpatch.py
diff options
context:
space:
mode:
Diffstat (limited to 'jsonpatch.py')
-rw-r--r--jsonpatch.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/jsonpatch.py b/jsonpatch.py
index 49cca59..46649ff 100644
--- a/jsonpatch.py
+++ b/jsonpatch.py
@@ -449,8 +449,13 @@ class TestOperation(PatchOperation):
def apply(self, obj):
try:
subobj, part = self.locate(obj, self.location)
- except JsonPatchConflict, c:
- raise JsonPatchTestFailed(str(c))
+ except JsonPatchConflict:
+ exc_info = sys.exc_info()
+ exc = JsonPatchTestFailed(str(exc_info[1]))
+ if sys.version_info >= (3, 0):
+ raise exc.with_traceback(exc_info[2])
+ else:
+ raise exc
val = subobj[part]