From 445ad997ab7fd5ad8dd77250bb17c82ad40c1f1f Mon Sep 17 00:00:00 2001 From: Brian Curtin Date: Sun, 23 Dec 2012 16:53:21 -0600 Subject: [PATCH] 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. --- 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 insertion(+), 453 deletions(-) delete mode 100644 PC/w9xpopen.c delete mode 100644 PCbuild/w9xpopen.vcxproj delete mode 100644 PCbuild/w9xpopen.vcxproj.filters diff --git a/Lib/subprocess.py b/Lib/subprocess.py index b042d26e06e..0c60be122da 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1029,23 +1029,6 @@ class Popen(object): return Handle(h) - def _find_w9xpopen(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.exec_prefix - w9xpopen = os.path.join(os.path.dirname(sys.base_exec_prefix), - "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 _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, @@ -1074,21 +1057,6 @@ class Popen(object): startupinfo.wShowWindow = _winapi.SW_HIDE 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._find_w9xpopen() - args = '"%s" %s' % (w9xpopen, args) - # Not passing CREATE_NEW_CONSOLE 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.CREATE_NEW_CONSOLE # Start the process try: diff --git a/PC/w9xpopen.c b/PC/w9xpopen.c deleted file mode 100644 index b3978dd42d9..00000000000 --- 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 WIN32_LEAN_AND_MEAN -#include -#include -#include /* 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; - PROCESS_INFORMATION pi; - DWORD exit_code=0; - size_t cmdlen = 0; - int i; - char *cmdline, *cmdlinefill; - - if (argc < 2) { - if (GetFileType(GetStdHandle(STD_INPUT_HANDLE))==FILE_TYPE_CHAR) - /* Attached to a console, and therefore not executed by Python - Display a message box for the inquisitive user - */ - MessageBox(NULL, usage, argv[0], MB_OK); - 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{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 index d1afe22c9b3..00000000000 --- 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>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 index dec67add2d9..00000000000 --- 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 index cd1c60be09d..fca43e22b9e 100644 --- a/Tools/msi/msi.py +++ b/Tools/msi/msi.py @@ -956,8 +956,6 @@ def add_files(db): # Add all executables, icons, text files into the TARGETDIR component root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir") default_feature.set_current() - if not msilib.Win64: - root.add_file("%s/w9xpopen.exe" % PCBUILD) root.add_file("README.txt", src="README") root.add_file("NEWS.txt", src="Misc/NEWS") generate_license()