diff options
| author | Alexander Shorin <kxepal@gmail.com> | 2012-10-05 00:04:34 +0400 |
|---|---|---|
| committer | Alexander Shorin <kxepal@gmail.com> | 2012-10-05 00:04:34 +0400 |
| commit | 2d67adef906b687bd4b3982416adeab13354d6c5 (patch) | |
| tree | 048958093476e510de8dd08702bd998b358406a7 /jsonpatch.py | |
| parent | 183c97af356a1cf7a4ac2b83dd2a44ff00718670 (diff) | |
| download | python-json-patch-2d67adef906b687bd4b3982416adeab13354d6c5.tar.gz | |
Fix compatibility with Python 3.x
Diffstat (limited to 'jsonpatch.py')
| -rw-r--r-- | jsonpatch.py | 9 |
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] |
