summaryrefslogtreecommitdiff
path: root/jsonschema/exceptions.py
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2014-10-12 17:21:17 -0400
committerJulian Berman <Julian@GrayVines.com>2014-10-12 17:21:17 -0400
commitff426eb870ef31b05f4ee7a7ba0e35f975702559 (patch)
tree1cb617e8e9b301f46b33b8a108795b5f4c112254 /jsonschema/exceptions.py
parent642c802ca32042eb97bbefcb096dc1a040da7a22 (diff)
parent0a51b663dcd14f92bd9ef47c9a43a3dd240499db (diff)
downloadjsonschema-ff426eb870ef31b05f4ee7a7ba0e35f975702559.tar.gz
Merge remote-tracking branch 'immerrr/make-exceptions-picklable'
* immerrr/make-exceptions-picklable: Make exceptions picklable on Python 2.X
Diffstat (limited to 'jsonschema/exceptions.py')
-rw-r--r--jsonschema/exceptions.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/jsonschema/exceptions.py b/jsonschema/exceptions.py
index 46f1ce0..b93ec86 100644
--- a/jsonschema/exceptions.py
+++ b/jsonschema/exceptions.py
@@ -27,6 +27,10 @@ class _Error(Exception):
schema_path=(),
parent=None,
):
+ # Calling __init__ is important, because otherwise __reduce__ will
+ # return empty args tuple on Py2.7 and unpickling will fail because
+ # init requires at least one argument.
+ super(_Error, self).__init__(message)
self.message = message
self.path = self.relative_path = deque(path)
self.schema_path = self.relative_schema_path = deque(schema_path)