summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorOren Milman <orenmn@gmail.com>2017-09-14 19:30:28 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-09-14 19:30:27 (GMT)
commit0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab (patch)
tree626fd137e6154d665e7b0fe8e17360ad78d2ef84 /Lib/test/test_subprocess.py
parentf350a268a7071ce7d7a5bb86a9b1229782d4963b (diff)
downloadcpython-0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab.zip
cpython-0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab.tar.gz
cpython-0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab.tar.bz2
bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (#3580)
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 10ef87b..00dc37b 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -2742,6 +2742,15 @@ class Win32ProcessTestCase(BaseTestCase):
stdout=subprocess.PIPE,
close_fds=True)
+ @support.cpython_only
+ def test_issue31471(self):
+ # There shouldn't be an assertion failure in Popen() in case the env
+ # argument has a bad keys() method.
+ class BadEnv(dict):
+ keys = None
+ with self.assertRaises(TypeError):
+ subprocess.Popen([sys.executable, "-c", "pass"], env=BadEnv())
+
def test_close_fds(self):
# close file descriptors
rc = subprocess.call([sys.executable, "-c",