Skip to content

Commit

Permalink
pythongh-113536: Expose os.waitid on macOS
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ronaldoussoren committed Dec 28, 2023
1 parent f7c5a7a commit 0f0547f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`os.waitid` is now available on macOS
6 changes: 3 additions & 3 deletions Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ typedef struct {
PyObject *TerminalSizeType;
PyObject *TimesResultType;
PyObject *UnameResultType;
#if defined(HAVE_WAITID) && !defined(__APPLE__)
#if defined(HAVE_WAITID)
PyObject *WaitidResultType;
#endif
#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
Expand Down Expand Up @@ -2291,7 +2291,7 @@ static PyStructSequence_Desc statvfs_result_desc = {
10
};

#if defined(HAVE_WAITID) && !defined(__APPLE__)
#if defined(HAVE_WAITID)
PyDoc_STRVAR(waitid_result__doc__,
"waitid_result: Result from waitid.\n\n\
This object may be accessed either as a tuple of\n\
Expand Down Expand Up @@ -2366,7 +2366,7 @@ _posix_clear(PyObject *module)
Py_CLEAR(state->TerminalSizeType);
Py_CLEAR(state->TimesResultType);
Py_CLEAR(state->UnameResultType);
#if defined(HAVE_WAITID) && !defined(__APPLE__)
#if defined(HAVE_WAITID)
Py_CLEAR(state->WaitidResultType);
#endif
#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
Expand All @@ -2391,7 +2391,7 @@ _posix_traverse(PyObject *module, visitproc visit, void *arg)
Py_VISIT(state->TerminalSizeType);
Py_VISIT(state->TimesResultType);
Py_VISIT(state->UnameResultType);
#if defined(HAVE_WAITID) && !defined(__APPLE__)
#if defined(HAVE_WAITID)
Py_VISIT(state->WaitidResultType);
#endif
#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
Expand Down Expand Up @@ -9517,7 +9517,7 @@ os_wait4_impl(PyObject *module, pid_t pid, int options)
#endif /* HAVE_WAIT4 */


#if defined(HAVE_WAITID) && !defined(__APPLE__)
#if defined(HAVE_WAITID)
/*[clinic input]
os.waitid
Expand Down Expand Up @@ -9574,7 +9574,7 @@ os_waitid_impl(PyObject *module, idtype_t idtype, id_t id, int options)

return result;
}
#endif /* defined(HAVE_WAITID) && !defined(__APPLE__) */
#endif /* defined(HAVE_WAITID) */


#if defined(HAVE_WAITPID)
Expand Down Expand Up @@ -17308,7 +17308,7 @@ posixmodule_exec(PyObject *m)
return -1;
}

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

0 comments on commit 0f0547f

Please sign in to comment.