Commit 264b5dc6 authored by Jason R. Coombs's avatar Jason R. Coombs

Prevent infinite recursion when UnpickleableException occurs in a sandbox context. Fixes #440.

parent bf833168
...@@ -3,6 +3,15 @@ CHANGES ...@@ -3,6 +3,15 @@ CHANGES
======= =======
------
18.8.1
------
* Issue #440: Prevent infinite recursion when a SandboxViolation
or other UnpickleableException occurs in a sandbox context
with setuptools hidden. Fixes regression introduced in Setuptools
12.0.
---- ----
18.8 18.8
---- ----
......
...@@ -98,8 +98,8 @@ class UnpickleableException(Exception): ...@@ -98,8 +98,8 @@ class UnpickleableException(Exception):
""" """
An exception representing another Exception that could not be pickled. An exception representing another Exception that could not be pickled.
""" """
@classmethod @staticmethod
def dump(cls, type, exc): def dump(type, exc):
""" """
Always return a dumped (pickled) type and exc. If exc can't be pickled, Always return a dumped (pickled) type and exc. If exc can't be pickled,
wrap it in UnpickleableException first. wrap it in UnpickleableException first.
...@@ -107,6 +107,8 @@ class UnpickleableException(Exception): ...@@ -107,6 +107,8 @@ class UnpickleableException(Exception):
try: try:
return pickle.dumps(type), pickle.dumps(exc) return pickle.dumps(type), pickle.dumps(exc)
except Exception: except Exception:
# get UnpickleableException inside the sandbox
from setuptools.sandbox import UnpickleableException as cls
return cls.dump(cls, cls(repr(exc))) return cls.dump(cls, cls(repr(exc)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment