Commit Graph

20 Commits

Author SHA1 Message Date
Tim Golden 431774f32a Issue #3210: Revert C module changes and apply patch from Hirokazu Yamamoto instead 2010-08-08 11:17:56 +00:00
Tim Golden 90374f5102 Issue #3210: Ensure stdio handles are closed if CreateProcess fails 2010-08-06 13:14:33 +00:00
Antoine Pitrou c83ea137d7 Untabify C files. Will watch buildbots. 2010-05-09 14:46:46 +00:00
Brian Curtin a2936cfa09 Fix #7838. Add docstrings and privatize _subprocess implementation details.
Since CREATE_NEW_* are used for the creation flags of a subprocess, they
were added to __all__. The rest of the previously exposed attributes are
now qualified by _subprocess.ATTR rather than importing *.
2010-04-24 15:40:11 +00:00
Brian Curtin e5aa886b44 Implement #1220212. Add os.kill support for Windows.
os.kill takes one of two newly added signals, CTRL_C_EVENT and
CTRL_BREAK_EVENT, or any integer value. The events are a special case
which work with subprocess console applications which implement a
special console control handler. Any other value but those two will
cause os.kill to use TerminateProcess, outright killing the process.

This change adds win_console_handler.py, which is a script to implement
SetConsoleCtrlHandler and applicable handler function, using ctypes.

subprocess also gets another attribute which is a necessary flag to
creationflags in Popen in order to send the CTRL events.
2010-04-02 23:26:06 +00:00
Hirokazu Yamamoto eacbbdfb73 Issue #5179: Fixed subprocess handle leak on failure on windows. 2009-03-03 22:18:14 +00:00
Gregory P. Smith b90f4e8730 fix issue3120 - don't truncate handles on 64-bit Windows.
This is still messy, realistically PC/_subprocess.c should never cast pointers
to python numbers and back at all.

I don't have a 64-bit windows build environment because microsoft apparently
thinks that should cost money.  Time to watch the buildbots.  It builds and
passes tests on 32-bit windows.
2008-07-20 00:22:08 +00:00
Gregory P. Smith dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Georg Brandl ad62489e47 Bug #1500293: fix memory leaks in _subprocess module. 2006-06-04 22:15:37 +00:00
Georg Brandl bf92f46572 Convert more modules to METH_VARARGS. 2006-05-29 21:58:42 +00:00
Tim Peters c9d78aa470 Years in the making.
objimpl.h, pymem.h:  Stop mapping PyMem_{Del, DEL} and PyMem_{Free, FREE}
to PyObject_{Free, FREE} in a release build.  They're aliases for the
system free() now.

_subprocess.c/sp_handle_dealloc():  Since the memory was originally
obtained via PyObject_NEW, it must be released via PyObject_FREE (or
_DEL).

pythonrun.c, tokenizer.c, parsermodule.c:  I lost count of the number of
PyObject vs PyMem mismatches in these -- it's like the specific
function called at each site was picked at random, sometimes even with
memory obtained via PyMem getting released via PyObject.  Changed most
to use PyObject uniformly, since the blobs allocated are predictably
small in most cases, and obmalloc is generally faster than system
mallocs then.

If extension modules in real life prove as sloppy as Python's front
end, we'll have to revert the objimpl.h + pymem.h part of this patch.
Note that no problems will show up in a debug build (all calls still go
thru obmalloc then). Problems will show up only in a release build, most
likely segfaults.
2006-03-26 23:27:58 +00:00
Neal Norwitz 1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Fredrik Lundh e515293567 added TerminateProcess support to _subprocess driver 2005-12-18 21:06:46 +00:00
Fredrik Lundh 63168a52f4 added PSF licensing blurbs to relevant files 2005-12-14 22:29:34 +00:00
Fredrik Lundh 3a49e92d7d r858@spiff: Fredrik | 2005-11-10 23:40:04 +0100
#1346547

 added basic error checking to the STARTUPINFO code
 in CreateProcess.
2005-11-12 10:15:14 +00:00
Fredrik Lundh bb4692b6f2 r849@spiff: Fredrik | 2005-11-09 10:00:04 +0100
fixed resource leak in _subprocess.CreateProcess when using
 explicit environments
2005-11-12 10:15:03 +00:00
Peter Astrand c1d6536d60 When using shell=True on Windows, don't display a shell window by default. Fixes #1057061. 2004-11-07 14:30:34 +00:00
Tim Peters f3250b0b0b Before this turns into an unreadable mess, follow PEP 7 by using
hard tab indents in C code.
2004-10-12 21:38:22 +00:00
Fredrik Lundh 5b3687df2e Added Peter Astrand's subprocess module. 2004-10-12 15:26:28 +00:00