From ca52f72bb9456785be3a3a6ec003628c81dc0058 Mon Sep 17 00:00:00 2001 From: Anselm Kruis Date: Sun, 9 Apr 2017 22:50:21 +0200 Subject: [PATCH] Issue #112: Prepare Stackless 3.5, fix a C-Python test suite bug This commit merges the fix from C-Python pull request https://github.com/python/cpython/pull/1066 (git commit 22e032a2e) for bpo-30028. Without this change $ ./python -m test.regrtest test_multiprocessing_fork fails. ($ ./python -m test.test_multiprocessing_fork is OK.) https://bitbucket.org/stackless-dev/stackless/issues/112 (grafted from bda8a9d487da7cfbe4357d5c4c7635e0de19c6af) --- Lib/test/support/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 7db96d916a7bb4..106dfbe241f1a4 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -902,10 +902,12 @@ def temp_dir(path=None, quiet=False): raise warnings.warn('tests may fail, unable to create temp dir: ' + path, RuntimeWarning, stacklevel=3) + if dir_created: + pid = os.getpid() try: yield path finally: - if dir_created: + if dir_created and pid == os.getpid(): shutil.rmtree(path) @contextlib.contextmanager