[Python-Dev] [Python-checkins] cpython: Fix #14470. Remove w9xpopen per PEP 11. (original) (raw)

Andrew Svetlov andrew.svetlov at gmail.com
Mon Dec 24 09:36:52 CET 2012


You missed artifacts in ./PC/VC6 ./PC/VS7.1 ./PC/VS8.0 ./PC/VS9.0

On Mon, Dec 24, 2012 at 12:55 AM, brian.curtin <python-checkins at python.org> wrote:

http://hg.python.org/cpython/rev/c903e4f1121d changeset: 81005:c903e4f1121d parent: 81003:e3d0417d8266 user: Brian Curtin <brian at python.org> date: Sun Dec 23 16:53:21 2012 -0600 summary: Fix #14470. Remove w9xpopen per PEP 11.

As stated in PEP 11, 3.4 removes code on Windows platforms where COMSPEC points to command.com. The w9xpopen project in Visual Studio was added to support that case, and there was a special case in subprocess to cover that situation. This change removes the w9xpopen project from the Visual Studio solution and removes any references to the w9xpopen executable. files: Lib/subprocess.py | 32 -- PC/w9xpopen.c | 112 ------- PCbuild/pcbuild.sln | 2 - PCbuild/python.vcxproj | 6 +- PCbuild/w9xpopen.vcxproj | 287 ------------------- PCbuild/w9xpopen.vcxproj.filters | 13 - Tools/msi/msi.py | 2 - 7 files changed, 1 insertions(+), 453 deletions(-)

diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1029,23 +1029,6 @@ return Handle(h) - def findw9xpopen(self): - """Find and return absolut path to w9xpopen.exe""" - w9xpopen = os.path.join( - os.path.dirname(winapi.GetModuleFileName(0)), - "w9xpopen.exe") - if not os.path.exists(w9xpopen): - # Eeek - file-not-found - possibly an embedding - # situation - see if we can locate it in sys.execprefix - w9xpopen = os.path.join(os.path.dirname(sys.baseexecprefix), - "w9xpopen.exe") - if not os.path.exists(w9xpopen): - raise SubprocessError( - "Cannot locate w9xpopen.exe, which is needed for " - "Popen to work with your shell or platform.") - return w9xpopen - - def executechild(self, args, executable, preexecfn, closefds, passfds, cwd, env, startupinfo, creationflags, shell, @@ -1074,21 +1057,6 @@ startupinfo.wShowWindow = winapi.SWHIDE comspec = os.environ.get("COMSPEC", "cmd.exe") args = '{} /c "{}"'.format (comspec, args) - if (winapi.GetVersion() >= 0x80000000 or - os.path.basename(comspec).lower() == "command.com"): - # Win9x, or using command.com on NT. We need to - # use the w9xpopen intermediate program. For more - # information, see KB Q150956 - # (http://web.archive.org/web/20011105084002/http://support.microsoft.com/support/kb/articles/Q150/9/56.asp) - w9xpopen = self.findw9xpopen() - args = '"%s" %s' % (w9xpopen, args) - # Not passing CREATENEWCONSOLE has been known to - # cause random failures on win9x. Specifically a - # dialog: "Your program accessed mem currently in - # use at xxx" and a hopeful warning about the - # stability of your system. Cost is Ctrl+C won't - # kill children. - creationflags |= winapi.CREATENEWCONSOLE # Start the process try: diff --git a/PC/w9xpopen.c b/PC/w9xpopen.c deleted file mode 100644 --- a/PC/w9xpopen.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * w9xpopen.c - * - * Serves as an intermediate stub Win32 console application to - * avoid a hanging pipe when redirecting 16-bit console based - * programs (including MS-DOS console based programs and batch - * files) on Window 95 and Windows 98. - * - * This program is to be launched with redirected standard - * handles. It will launch the command line specified 16-bit - * console based application in the same console, forwarding - * its own redirected standard handles to the 16-bit child. - - * AKA solution to the problem described in KB: Q150956. - */ - -#define WIN32LEANANDMEAN -#include <windows.h> -#include <stdio.h> -#include <stdlib.h> /* for malloc and its friends */ - -const char *usage = -"This program is used by Python's os.popen function\n" -"to work around a limitation in Windows 95/98. It is\n" -"not designed to be used as a stand-alone program."; - -int main(int argc, char *argv[]) -{ - BOOL bRet; - STARTUPINFO si; - PROCESSINFORMATION pi; - DWORD exitcode=0; - sizet cmdlen = 0; - int i; - char *cmdline, *cmdlinefill; - - if (argc < 2) {_ _- if (GetFileType(GetStdHandle(STDINPUTHANDLE))==FILETYPECHAR)_ _- /* Attached to a console, and therefore not executed by Python_ _- Display a message box for the inquisitive user_ _- */_ _- MessageBox(NULL, usage, argv[0], MBOK);_ _- else {_ _- /* Eeek - executed by Python, but args are screwed!_ _- Write an error message to stdout so there is at_ _- least some clue for the end user when it appears_ _- in their output._ _- A message box would be hidden and blocks the app._ _- */_ _- fprintf(stdout, "Internal popen error - no args specified\n%s\n", usage);_ _- }_ _- return 1;_ _- }_ _- /* Build up the command-line from the args._ _- Args with a space are quoted, existing quotes are escaped._ _- To keep things simple calculating the buffer size, we assume_ _- every character is a quote - ie, we allocate double what we need_ _- in the worst case. As this is only double the command line passed_ _- to us, there is a good chance this is reasonably small, so the total_ _- allocation will almost always be < 512 bytes._ _- */_ _- for (i=1;i<argc;i++)_ _- cmdlen += strlen(argv[i])*2 + 3; /* one space, maybe 2 quotes */_ _- cmdline = cmdlinefill = (char *)malloc(cmdlen+1);_ _- if (cmdline == NULL)_ _- return -1;_ _- for (i=1;i<argc;i++) {_ _- const char *arglook;_ _- int bQuote = strchr(argv[i], ' ') != NULL;_ _- if (bQuote)_ _- *cmdlinefill++ = '"';_ _- /* escape quotes */_ _- for (arglook=argv[i];*arglook;arglook++) {_ _- if (*arglook=='"')_ _- *cmdlinefill++ = '\';_ _- *cmdlinefill++ = *arglook;_ _- }_ _- if (bQuote)_ _- *cmdlinefill++ = '"';_ _- *cmdlinefill++ = ' ';_ _- }_ _- *cmdlinefill = '\0';_ _-_ _- /* Make child process use this app's standard files. */_ _- ZeroMemory(&si, sizeof si);_ _- si.cb = sizeof si;_ _- si.dwFlags = STARTFUSESTDHANDLES;_ _- si.hStdInput = GetStdHandle(STDINPUTHANDLE);_ _- si.hStdOutput = GetStdHandle(STDOUTPUTHANDLE);_ _- si.hStdError = GetStdHandle(STDERRORHANDLE);_ _-_ _- bRet = CreateProcess(_ _- NULL, cmdline,_ _- NULL, NULL,_ _- TRUE, 0,_ _- NULL, NULL,_ _- &si, &pi_ _- );_ _-_ _- free(cmdline);_ _-_ _- if (bRet) {_ _- if (WaitForSingleObject(pi.hProcess, INFINITE) != WAITFAILED) {_ _- GetExitCodeProcess(pi.hProcess, &exitcode);_ _- }_ _- CloseHandle(pi.hProcess);_ _- CloseHandle(pi.hThread);_ _- return exitcode;_ _- }_ _-_ _- return 1;_ _-}_ _diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln_ _--- a/PCbuild/pcbuild.sln_ _+++ b/PCbuild/pcbuild.sln_ _@@ -14,8 +14,6 @@_ _EndProject_ _Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcxproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}"_ _EndProject_ _-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcxproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}"_ _-EndProject_ _Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makebuildinfo", "makebuildinfo.vcxproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}"_ _EndProject_ _Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcxproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}"_ _diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj_ _--- a/PCbuild/python.vcxproj_ _+++ b/PCbuild/python.vcxproj_ _@@ -357,12 +357,8 @@_ _{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} false - - {e9e0a1f6-0009-4e8c-b8f8-1b8f5d49a058} - false - - \ No newline at end of file + diff --git a/PCbuild/w9xpopen.vcxproj b/PCbuild/w9xpopen.vcxproj deleted file mode 100644 --- a/PCbuild/w9xpopen.vcxproj +++ /dev/null @@ -1,287 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - PGInstrument - Win32 - - - PGInstrument - x64 - - - PGUpdate - Win32 - - - PGUpdate - x64 - - - Release - Win32 - - - Release - x64 - - - - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} - w9xpopen - - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - NotSet - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10.0.40219.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - EnableFastChecks - MultiThreadedDebug - - - Console - - - - - X64 - - - Disabled - EnableFastChecks - MultiThreadedDebug - - - Console - - - - - MaxSpeed - OnlyExplicitInline - true - MultiThreaded - true - - - false - Console - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - MultiThreaded - true - - - false - Console - - - - - MaxSpeed - OnlyExplicitInline - true - MultiThreaded - true - - - false - Console - - - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - MultiThreaded - true - - - false - Console - - - MachineX64 - - - - - MaxSpeed - OnlyExplicitInline - true - MultiThreaded - true - - - false - Console - - - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - MultiThreaded - true - - - false - Console - - - MachineX64 - - - - - - - - - \ No newline at end of file diff --git a/PCbuild/w9xpopen.vcxproj.filters b/PCbuild/w9xpopen.vcxproj.filters deleted file mode 100644 --- a/PCbuild/w9xpopen.vcxproj.filters +++ /dev/null @@ -1,13 +0,0 @@ - - - - - {abc2dffd-3f2a-47bd-b89b-0314c99ef21e} - - - - - Source Files - - - \ No newline at end of file diff --git a/Tools/msi/msi.py b/Tools/msi/msi.py --- a/Tools/msi/msi.py +++ b/Tools/msi/msi.py @@ -956,8 +956,6 @@ # Add all executables, icons, text files into the TARGETDIR component root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir") defaultfeature.setcurrent() - if not msilib.Win64: - root.addfile("%s/w9xpopen.exe" % PCBUILD) root.addfile("README.txt", src="README") root.addfile("NEWS.txt", src="Misc/NEWS") generatelicense() -- Repository URL: http://hg.python.org/cpython


Python-checkins mailing list Python-checkins at python.org http://mail.python.org/mailman/listinfo/python-checkins

-- Thanks, Andrew Svetlov



More information about the Python-Dev mailing list