diff --git a/rq/job.py b/rq/job.py index 386e594..c82a197 100644 --- a/rq/job.py +++ b/rq/job.py @@ -1,6 +1,6 @@ import times from uuid import uuid4 -from pickle import loads, dumps +from cPickle import loads, dumps, UnpicklingError from .proxy import conn from .exceptions import UnpickleError, NoSuchJobError @@ -15,7 +15,7 @@ def unpickle(pickled_string): """ try: obj = loads(pickled_string) - except StandardError: + except (StandardError, UnpicklingError): raise UnpickleError('Could not unpickle.', pickled_string) return obj diff --git a/rq/worker.py b/rq/worker.py index a6bbd51..cb8c282 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -8,7 +8,7 @@ import procname import socket import signal import traceback -from pickle import dumps +from cPickle import dumps try: from logbook import Logger Logger = Logger # Does nothing except it shuts up pyflakes annoying error diff --git a/tests/test_job.py b/tests/test_job.py index c62c1d9..55e589e 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -2,7 +2,7 @@ import times from datetime import datetime from tests import RQTestCase from tests.helpers import strip_milliseconds -from pickle import loads +from cPickle import loads from rq.job import Job from rq.exceptions import NoSuchJobError, UnpickleError