From a627cf9a72f8fca78b0520b72a5b44a0bbea9b8c Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 13 Dec 2015 10:05:24 -0500 Subject: Add test capturing infinite recursion. Ref #440. --- setuptools/tests/test_sandbox.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'setuptools/tests/test_sandbox.py') diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 6e1e9e1c..624954df 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -100,3 +100,13 @@ class TestExceptionSaver: saved_exc.resume() assert str(caught.value) == "CantPickleThis('detail',)" + + def test_unpickleable_exception_when_hiding_setuptools(self): + """ + As revealed in #440, an infinite recursion can occur if an unpickleable + exception while setuptools is hidden. Ensure this doesn't happen. + """ + sandbox = setuptools.sandbox + with sandbox.save_modules(): + sandbox.hide_setuptools() + raise sandbox.SandboxViolation('test') -- cgit v1.2.3