summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2015-12-05 02:03:42 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2015-12-05 02:03:42 (GMT)
commit6a77c2d978277fc9597baaa6ff612666332bfdca (patch)
tree7b3501d6c3ca0f34d9c076828aa29184f2e89d98 /Lib/test/test_subprocess.py
parentccddbb186bcaec77f52a8c37d8b3f56de4b871dd (diff)
parentafdd51343cafbc02443fa6f7a2166af951a67c64 (diff)
downloadcpython-6a77c2d978277fc9597baaa6ff612666332bfdca.zip
cpython-6a77c2d978277fc9597baaa6ff612666332bfdca.tar.gz
cpython-6a77c2d978277fc9597baaa6ff612666332bfdca.tar.bz2
Issue #25764: Merge subprocess fix from 3.4 into 3.5
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index e06beed..0448d64 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -1512,6 +1512,22 @@ class POSIXProcessTestCase(BaseTestCase):
if not enabled:
gc.disable()
+ def test_preexec_fork_failure(self):
+ # The internal code did not preserve the previous exception when
+ # re-enabling garbage collection
+ try:
+ from resource import getrlimit, setrlimit, RLIMIT_NPROC
+ except ImportError as err:
+ self.skipTest(err) # RLIMIT_NPROC is specific to Linux and BSD
+ limits = getrlimit(RLIMIT_NPROC)
+ [_, hard] = limits
+ setrlimit(RLIMIT_NPROC, (0, hard))
+ self.addCleanup(setrlimit, RLIMIT_NPROC, limits)
+ # Forking should raise EAGAIN, translated to BlockingIOError
+ with self.assertRaises(BlockingIOError):
+ subprocess.call([sys.executable, '-c', ''],
+ preexec_fn=lambda: None)
+
def test_args_string(self):
# args is a string
fd, fname = tempfile.mkstemp()