From 19459f8ce63cc7f905e3c1a55d09d4d10d245343 Mon Sep 17 00:00:00 2001 From: Samuel Marks <807580+SamuelMarks@users.noreply.github.com> Date: Fri, 25 Jun 2021 02:45:18 +1000 Subject: bpo-44321: Adds `os.EX_OK` for Windows (GH-26559) --- Doc/library/os.rst | 5 +++-- Modules/posixmodule.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 4b249ed..d3ca8c0 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 25ddc82..73e7e60 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -23,6 +23,10 @@ # include #endif +#if !defined(EX_OK) && defined(EXIT_SUCCESS) +#define EX_OK EXIT_SUCCESS +#endif + #ifdef __VXWORKS__ # include "pycore_bitutils.h" // _Py_popcount32() #endif -- cgit v0.12