From: Martin Panter Date: Sat, 5 Dec 2015 04:16:45 +0000 (+0000) Subject: Issue #25764: Attempt to debug and skip OS X setrlimit() failure X-Git-Tag: v3.6.0a1~955 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da0f2a1f5250a36c6067e035dcc9064b00b20bf5;p=thirdparty%2FPython%2Fcpython.git Issue #25764: Attempt to debug and skip OS X setrlimit() failure --- diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 0448d643cf50..b68def50b39c 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1516,10 +1516,16 @@ class POSIXProcessTestCase(BaseTestCase): # The internal code did not preserve the previous exception when # re-enabling garbage collection try: - from resource import getrlimit, setrlimit, RLIMIT_NPROC + from resource import getrlimit, setrlimit, RLIMIT_NPROC, RLIM_INFINITY except ImportError as err: self.skipTest(err) # RLIMIT_NPROC is specific to Linux and BSD limits = getrlimit(RLIMIT_NPROC) + try: + setrlimit(RLIMIT_NPROC, limits) + except ValueError as err: + # Seems to happen on AMD64 Snow Leop and x86-64 Yosemite buildbots + print(f"Setting NPROC to {limits!r}: {err!r}, RLIM_INFINITY={RLIM_INFINITY!r}") + self.skipTest("Setting existing NPROC limit failed") [_, hard] = limits setrlimit(RLIMIT_NPROC, (0, hard)) self.addCleanup(setrlimit, RLIMIT_NPROC, limits)