Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3946,8 +3946,10 @@ written in Python, such as a mail server's external command delivery program.


.. data:: CLD_EXITED
CLD_KILLED
Comment thread
corona10 marked this conversation as resolved.
CLD_DUMPED
CLD_TRAPPED
CLD_STOPPED
CLD_CONTINUED

These are the possible values for :attr:`si_code` in the result returned by
Expand All @@ -3957,6 +3959,9 @@ written in Python, such as a mail server's external command delivery program.

.. versionadded:: 3.3

.. versionchanged:: 3.9
Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values.


.. function:: waitpid(pid, options)

Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ that schedules a shutdown for the default executor that waits on the
:func:`asyncio.run` has been updated to use the new :term:`coroutine`.
(Contributed by Kyle Stanley in :issue:`34037`.)

os
__

Added :data:`~os.CLD_KILLED` and :data:`~os.CLD_STOPPED` for :attr:`si_code`.
(Contributed by Dong-hee Na in :issue:`38493`.)

threading
---------

Expand Down
10 changes: 10 additions & 0 deletions Lib/test/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,16 @@ def test_rename_dir_fd(self):
finally:
posix.close(f)

@unittest.skipUnless(hasattr(signal, 'SIGCHLD'), 'CLD_XXXX be placed in si_code for a SIGCHLD signal')
@unittest.skipUnless(hasattr(os, 'waitid_result'), "test needs os.waitid_result")
def test_cld_xxxx_constants(self):
os.CLD_EXITED
os.CLD_KILLED
os.CLD_DUMPED
os.CLD_TRAPPED
os.CLD_STOPPED
os.CLD_CONTINUED

@unittest.skipUnless(os.symlink in os.supports_dir_fd, "test needs dir_fd support in os.symlink()")
def test_symlink_dir_fd(self):
f = posix.open(posix.getcwd(), posix.O_RDONLY)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added :data:`~os.CLD_KILLED` and :data:`~os.CLD_STOPPED` for :attr:`si_code`.
Patch by Dong-hee Na.
6 changes: 6 additions & 0 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -14057,12 +14057,18 @@ all_ins(PyObject *m)
#ifdef CLD_EXITED
if (PyModule_AddIntMacro(m, CLD_EXITED)) return -1;
#endif
#ifdef CLD_KILLED
if (PyModule_AddIntMacro(m, CLD_KILLED)) return -1;
#endif
#ifdef CLD_DUMPED
if (PyModule_AddIntMacro(m, CLD_DUMPED)) return -1;
#endif
#ifdef CLD_TRAPPED
if (PyModule_AddIntMacro(m, CLD_TRAPPED)) return -1;
#endif
#ifdef CLD_STOPPED
if (PyModule_AddIntMacro(m, CLD_STOPPED)) return -1;
#endif
#ifdef CLD_CONTINUED
if (PyModule_AddIntMacro(m, CLD_CONTINUED)) return -1;
#endif
Expand Down