This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: regrtest.py -j 2 doesn't work on Windows: remove close_fds=True on Windows
Type: behavior Stage: resolved
Components: Tests, Windows Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brian.curtin, flox, pitrou, tim.golden, vstinner
Priority: normal Keywords:

Created on 2010-07-31 09:51 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg112125 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-07-31 09:51
On Windows, subprocess doesn't support close_fds=True if stdin, stdout or stderr is redirected to a pipe.

The problem is in the work function: popen = Popen([sys.executable, '-E', '-m', 'test.regrtest', ...], ..., stdout=PIPE, stderr=PIPE, close_fds=True).
msg112147 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-07-31 12:20
Does it work ok if you remove close_fds? There is a reason it's better to close all handles :)
msg113572 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-08-10 23:42
Possible patch (checked to work in a Windows 7 VM):

Index: Lib/test/regrtest.py
===================================================================
--- Lib/test/regrtest.py	(révision 83938)
+++ Lib/test/regrtest.py	(copie de travail)
@@ -547,7 +547,8 @@
                     popen = Popen([sys.executable, '-E', '-m', 'test.regrtest',
                                    '--slaveargs', json.dumps(args_tuple)],
                                    stdout=PIPE, stderr=PIPE,
-                                   universal_newlines=True, close_fds=True)
+                                   universal_newlines=True,
+                                   close_fds=(os.name != 'nt'))
                     stdout, stderr = popen.communicate()
                     # Strip last refcount output line if it exists, since it
                     # comes from the shutdown of the interpreter in the subcommand.
msg114207 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2010-08-18 09:39
I can confirm that the patched regrtest runs ok on WinXP.
msg114275 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-08-18 20:45
Ok, I've committed the change in r84176 (py3k) and r84178 (2.7). Thank you!
msg114279 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-08-18 21:30
No, thank *you*, Antoine :-)
History
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53679
2010-08-18 21:30:46vstinnersetmessages: + msg114279
2010-08-18 20:45:44pitrousetstatus: open -> closed
resolution: fixed
messages: + msg114275

stage: patch review -> resolved
2010-08-18 09:39:32tim.goldensetmessages: + msg114207
2010-08-17 21:44:01pitrousetnosy: + tim.golden, brian.curtin
2010-08-10 23:42:36pitrousetmessages: + msg113572
stage: needs patch -> patch review
2010-07-31 12:20:38pitrousetnosy: + pitrou
messages: + msg112147
2010-07-31 09:53:57floxsetnosy: + flox
2010-07-31 09:53:52floxsettype: behavior
components: + Tests, Windows
stage: needs patch
2010-07-31 09:51:45vstinnercreate