Skip to content

Commit d0b0e3d

Browse files
gh-113536: Expose os.waitid on macOS (#113542)
* gh-113536: Expose `os.waitid` on macOS This API has been available on macOS for a long time, but was explicitly excluded due to unspecified problems with the API in ancient versions of macOS. * Document that the API is available on macOS starting in Python 3.13
1 parent 5f3cc90 commit d0b0e3d

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

Doc/library/os.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4986,11 +4986,11 @@ written in Python, such as a mail server's external command delivery program.
49864986

49874987
.. availability:: Unix, not Emscripten, not WASI.
49884988

4989-
.. note::
4990-
This function is not available on macOS.
4991-
49924989
.. versionadded:: 3.3
49934990

4991+
.. versionchanged:: 3.13
4992+
This function is now available on macOS as well.
4993+
49944994

49954995
.. function:: waitpid(pid, options, /)
49964996

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:func:`os.waitid` is now available on macOS

Modules/clinic/posixmodule.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ typedef struct {
10241024
PyObject *TerminalSizeType;
10251025
PyObject *TimesResultType;
10261026
PyObject *UnameResultType;
1027-
#if defined(HAVE_WAITID) && !defined(__APPLE__)
1027+
#if defined(HAVE_WAITID)
10281028
PyObject *WaitidResultType;
10291029
#endif
10301030
#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
@@ -2292,7 +2292,7 @@ static PyStructSequence_Desc statvfs_result_desc = {
22922292
10
22932293
};
22942294

2295-
#if defined(HAVE_WAITID) && !defined(__APPLE__)
2295+
#if defined(HAVE_WAITID)
22962296
PyDoc_STRVAR(waitid_result__doc__,
22972297
"waitid_result: Result from waitid.\n\n\
22982298
This object may be accessed either as a tuple of\n\
@@ -2367,7 +2367,7 @@ _posix_clear(PyObject *module)
23672367
Py_CLEAR(state->TerminalSizeType);
23682368
Py_CLEAR(state->TimesResultType);
23692369
Py_CLEAR(state->UnameResultType);
2370-
#if defined(HAVE_WAITID) && !defined(__APPLE__)
2370+
#if defined(HAVE_WAITID)
23712371
Py_CLEAR(state->WaitidResultType);
23722372
#endif
23732373
#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
@@ -2392,7 +2392,7 @@ _posix_traverse(PyObject *module, visitproc visit, void *arg)
23922392
Py_VISIT(state->TerminalSizeType);
23932393
Py_VISIT(state->TimesResultType);
23942394
Py_VISIT(state->UnameResultType);
2395-
#if defined(HAVE_WAITID) && !defined(__APPLE__)
2395+
#if defined(HAVE_WAITID)
23962396
Py_VISIT(state->WaitidResultType);
23972397
#endif
23982398
#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
@@ -9518,7 +9518,7 @@ os_wait4_impl(PyObject *module, pid_t pid, int options)
95189518
#endif /* HAVE_WAIT4 */
95199519

95209520

9521-
#if defined(HAVE_WAITID) && !defined(__APPLE__)
9521+
#if defined(HAVE_WAITID)
95229522
/*[clinic input]
95239523
os.waitid
95249524
@@ -9575,7 +9575,7 @@ os_waitid_impl(PyObject *module, idtype_t idtype, id_t id, int options)
95759575

95769576
return result;
95779577
}
9578-
#endif /* defined(HAVE_WAITID) && !defined(__APPLE__) */
9578+
#endif /* defined(HAVE_WAITID) */
95799579

95809580

95819581
#if defined(HAVE_WAITPID)
@@ -17309,7 +17309,7 @@ posixmodule_exec(PyObject *m)
1730917309
return -1;
1731017310
}
1731117311

17312-
#if defined(HAVE_WAITID) && !defined(__APPLE__)
17312+
#if defined(HAVE_WAITID)
1731317313
waitid_result_desc.name = MODNAME ".waitid_result";
1731417314
state->WaitidResultType = (PyObject *)PyStructSequence_NewType(&waitid_result_desc);
1731517315
if (PyModule_AddObjectRef(m, "waitid_result", state->WaitidResultType) < 0) {

0 commit comments

Comments
 (0)