[Python-checkins] r79633 - in python/trunk: Doc/library/os.rst Doc/library/signal.rst Doc/library/subprocess.rst Lib/subprocess.py Lib/test/test_os.py Lib/test/win_console_handler.py Lib/unittest/test/test_break.py Modules/posixmodule.c Modules/signalmodule.c PC/_subprocess.c

Ezio Melotti ezio.melotti at gmail.com
Tue Apr 20 12:35:21 CEST 2010


On 03/04/2010 2.26, brian.curtin wrote:
> Author: brian.curtin
> Date: Sat Apr  3 01:26:06 2010
> New Revision: 79633
>
> Log:
> 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.
>
>
> Added:
>     python/trunk/Lib/test/win_console_handler.py
> Modified:
>     python/trunk/Doc/library/os.rst
>     python/trunk/Doc/library/signal.rst
>     python/trunk/Doc/library/subprocess.rst
>     python/trunk/Lib/subprocess.py
>     python/trunk/Lib/test/test_os.py
>     python/trunk/Lib/unittest/test/test_break.py
>     python/trunk/Modules/posixmodule.c
>     python/trunk/Modules/signalmodule.c
>     python/trunk/PC/_subprocess.c
>
> Modified: python/trunk/Doc/library/os.rst
> ==============================================================================
> --- python/trunk/Doc/library/os.rst	(original)
> +++ python/trunk/Doc/library/os.rst	Sat Apr  3 01:26:06 2010
> @@ -1719,7 +1719,14 @@
>
>      Send signal *sig* to the process *pid*.  Constants for the specific signals
>      available on the host platform are defined in the :mod:`signal` module.
> -   Availability: Unix.
> +
> +   Windows: The :data:`signal.CTRL_C_EVENT` and
> +   :data:`signal.CTRL_BREAK_EVENT` signals are special signals which can
> +   only be sent to console processes which share a common console window,
> +   e.g., some subprocesses. Any other value for *sig* will cause the process
> +   to be unconditionally killed by the TerminateProcess API, and the exit code
> +   will be set to *sig*. The Windows version of :func:`kill` additionally takes
> +   process handles to be killed.
>
>
>   .. function:: killpg(pgid, sig)
>
> Modified: python/trunk/Doc/library/signal.rst
> ==============================================================================
> --- python/trunk/Doc/library/signal.rst	(original)
> +++ python/trunk/Doc/library/signal.rst	Sat Apr  3 01:26:06 2010
> @@ -75,6 +75,20 @@
>      the system are defined by this module.
>
>
> +.. data:: CTRL_C_EVENT
> +
> +   The signal corresponding to the CTRL+C keystroke event.
> +
> +   Availability: Windows.
> +
> +
> +.. data:: CTRL_BREAK_EVENT
> +
> +   The signal corresponding to the CTRL+BREAK keystroke event.
> +
> +   Availability: Windows.
> +
> +
> [...]
>

Hi,
shouldn't these have a versionadded?

Best Regards,
Ezio Melotti


More information about the Python-checkins mailing list