From 84601f41fd7923452d61bb442d0ec1a9765a6646 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 23 Jan 2019 12:44:08 +0000 Subject: [PATCH] issue #477: make CallError inherit from object for 2.4/2.5. Otherwise cPickle will not call __reduce__(). --- mitogen/core.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index 776699bd..d0ed0188 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -250,11 +250,14 @@ class Kwargs(dict): return (Kwargs, (dict(self),)) -class CallError(Error): - """Serializable :class:`Error` subclass raised when - :meth:`Context.call() ` fails. A copy of - the traceback from the external context is appended to the exception - message.""" +class CallError(Error, object): + """ + Serializable :class:`Error` subclass raised when :meth:`Context.call() + ` fails. A copy of the traceback from the + external context is appended to the exception message. + """ + # Derives from object to force <2.7 pickle to call reduce. This may have + # unintended consequences, Exceptions in 2.x are classic classes. def __init__(self, fmt=None, *args): if not isinstance(fmt, BaseException): Error.__init__(self, fmt, *args)