mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-30065: Fixed arguments validation in _posixsubprocess.fork_exec(). (#1110)
This commit is contained in:
parent
a79f4c2195
commit
66bffd1663
5 changed files with 41 additions and 26 deletions
|
@ -2418,7 +2418,7 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
with self.assertRaises(TypeError):
|
||||
_posixsubprocess.fork_exec(
|
||||
args, exe_list,
|
||||
True, [], cwd, env_list,
|
||||
True, (), cwd, env_list,
|
||||
-1, -1, -1, -1,
|
||||
1, 2, 3, 4,
|
||||
True, True, func)
|
||||
|
@ -2430,6 +2430,16 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
def test_fork_exec_sorted_fd_sanity_check(self):
|
||||
# Issue #23564: sanity check the fork_exec() fds_to_keep sanity check.
|
||||
import _posixsubprocess
|
||||
class BadInt:
|
||||
first = True
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
def __int__(self):
|
||||
if self.first:
|
||||
self.first = False
|
||||
return self.value
|
||||
raise ValueError
|
||||
|
||||
gc_enabled = gc.isenabled()
|
||||
try:
|
||||
gc.enable()
|
||||
|
@ -2440,6 +2450,7 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
(18, 23, 42, 2**63), # Out of range.
|
||||
(5, 4), # Not sorted.
|
||||
(6, 7, 7, 8), # Duplicate.
|
||||
(BadInt(1), BadInt(2)),
|
||||
):
|
||||
with self.assertRaises(
|
||||
ValueError,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue