Skip to content

Commit 0a51b66

Browse files
committed
Make exceptions picklable on Python 2.X
1 parent 4baff21 commit 0a51b66

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

jsonschema/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def __init__(
2727
schema_path=(),
2828
parent=None,
2929
):
30+
# Calling __init__ is important, because otherwise __reduce__ will
31+
# return empty args tuple on Py2.7 and unpickling will fail because
32+
# init requires at least one argument.
33+
super(_Error, self).__init__(message)
3034
self.message = message
3135
self.path = self.relative_path = deque(path)
3236
self.schema_path = self.relative_schema_path = deque(schema_path)

0 commit comments

Comments
 (0)