[Python-checkins] bpo-44321: Adds `os.EX_OK` for Windows (GH-26559)

zooba webhook-mailer at python.org
Thu Jun 24 12:45:27 EDT 2021


https://github.com/python/cpython/commit/19459f8ce63cc7f905e3c1a55d09d4d10d245343
commit: 19459f8ce63cc7f905e3c1a55d09d4d10d245343
branch: main
author: Samuel Marks <807580+SamuelMarks at users.noreply.github.com>
committer: zooba <steve.dower at microsoft.com>
date: 2021-06-24T17:45:18+01:00
summary:

bpo-44321: Adds `os.EX_OK` for Windows (GH-26559)

files:
M Doc/library/os.rst
M Modules/posixmodule.c

diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 4b249ed92c358..d3ca8c0476d0c 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -3656,9 +3656,10 @@ written in Python, such as a mail server's external command delivery program.
 
 .. data:: EX_OK
 
-   Exit code that means no error occurred.
+   Exit code that means no error occurred. May be taken from the defined value of
+   ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero.
 
-   .. availability:: Unix.
+   .. availability:: Unix, Windows.
 
 
 .. data:: EX_USAGE
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 25ddc82cb893a..73e7e60fe63ff 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -23,6 +23,10 @@
 #  include <pathcch.h>
 #endif
 
+#if !defined(EX_OK) && defined(EXIT_SUCCESS)
+#define EX_OK EXIT_SUCCESS
+#endif
+
 #ifdef __VXWORKS__
 #  include "pycore_bitutils.h"    // _Py_popcount32()
 #endif



More information about the Python-checkins mailing list