summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2012-12-14 12:56:50 +0100
committerStefan Kögl <stefan@skoegl.net>2012-12-14 12:56:50 +0100
commit0e6772b3a300549e8a1030c13c59f0ee7b62dcaa (patch)
treeb95b4b665fe80224b781f16ed18c4a716b381147
parent7c7a1f50d4ee01aa243ec8d73e6dbc5436b9071e (diff)
downloadpython-json-patch-0e6772b3a300549e8a1030c13c59f0ee7b62dcaa.tar.gz
remove Python 2.5 compatability
-rw-r--r--.travis.yml1
-rw-r--r--jsonpatch.py23
-rw-r--r--requirements.txt1
3 files changed, 5 insertions, 20 deletions
diff --git a/.travis.yml b/.travis.yml
index 5b0216a..b692978 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,5 @@
language: python
python:
- - "2.5"
- "2.6"
- "2.7"
- "3.2"
diff --git a/jsonpatch.py b/jsonpatch.py
index a521bd0..c5eca85 100644
--- a/jsonpatch.py
+++ b/jsonpatch.py
@@ -43,10 +43,7 @@ __license__ = 'Modified BSD License'
import copy
import sys
-if sys.version_info < (2, 6):
- import simplejson as json
-else:
- import json
+import json
import jsonpointer
@@ -352,13 +349,8 @@ class RemoveOperation(PatchOperation):
subobj, part = self.pointer.to_last(obj)
try:
del subobj[part]
- except KeyError:
- exc_info = sys.exc_info()
- exc = JsonPatchConflict(str(exc_info[1]))
- if sys.version_info >= (3, 0):
- raise exc.with_traceback(exc_info[2])
- else:
- raise exc
+ except KeyError as ex:
+ raise JsonPatchConflict(str(ex))
class AddOperation(PatchOperation):
@@ -439,13 +431,8 @@ class TestOperation(PatchOperation):
else:
val = self.pointer.walk(subobj, part)
- except JsonPointerException:
- 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
+ except JsonPointerException as ex:
+ raise JsonPatchTestFailed(str(ex))
if 'value' in self.operation:
value = self.operation['value']
diff --git a/requirements.txt b/requirements.txt
index 9a473c7..fa2630e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1 @@
-simplejson #required for Python 2.5 compatability
jsonpointer>=0.5