diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2019-10-21 16:01:05 +0900 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-10-21 10:01:05 +0300 |
commit | 2eba6ad7bf3a5beeed54209a0107be8e1ac77767 (patch) | |
tree | c48beb385ccecbbaec8a892ea9972a795fda09c9 | |
parent | a9ed91e6c2f0f1a9960b1382321918448228a801 (diff) | |
download | cpython-git-2eba6ad7bf3a5beeed54209a0107be8e1ac77767.tar.gz |
bpo-38493: Add os.CLD_KILLED and os.CLD_STOPPED. (GH-16821)
-rw-r--r-- | Doc/library/os.rst | 5 | ||||
-rw-r--r-- | Doc/whatsnew/3.9.rst | 6 | ||||
-rw-r--r-- | Lib/test/test_posix.py | 10 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-10-16-19-56-51.bpo-38493.86ExWB.rst | 2 | ||||
-rw-r--r-- | Modules/posixmodule.c | 6 |
5 files changed, 29 insertions, 0 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst index fe9531b170..8e9d9e6f03 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -3946,8 +3946,10 @@ written in Python, such as a mail server's external command delivery program. .. data:: CLD_EXITED + CLD_KILLED CLD_DUMPED CLD_TRAPPED + CLD_STOPPED CLD_CONTINUED These are the possible values for :attr:`si_code` in the result returned by @@ -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) diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 6b4abc0567..f203930fd1 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -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 --------- diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 9bdd2848af..17e4ded2e2 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1226,6 +1226,16 @@ class PosixTester(unittest.TestCase): 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) diff --git a/Misc/NEWS.d/next/Library/2019-10-16-19-56-51.bpo-38493.86ExWB.rst b/Misc/NEWS.d/next/Library/2019-10-16-19-56-51.bpo-38493.86ExWB.rst new file mode 100644 index 0000000000..1a4bef65d4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-10-16-19-56-51.bpo-38493.86ExWB.rst @@ -0,0 +1,2 @@ +Added :data:`~os.CLD_KILLED` and :data:`~os.CLD_STOPPED` for :attr:`si_code`. +Patch by Dong-hee Na. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 686497090f..dcd90d3a51 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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 |