diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-10-07 04:50:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-07 04:50:56 (GMT) |
commit | e39b511c2bfa98935e6ff81046d64d342fcff298 (patch) | |
tree | 0377c6cefc008f03daf3c943cfe4f48afdf123b9 /Modules | |
parent | d163d5976dbb07ed7bc157260ab29452f940b567 (diff) | |
download | cpython-e39b511c2bfa98935e6ff81046d64d342fcff298.zip cpython-e39b511c2bfa98935e6ff81046d64d342fcff298.tar.gz cpython-e39b511c2bfa98935e6ff81046d64d342fcff298.tar.bz2 |
fixes gh-96078: os.sched_yield release the GIL while calling sched_yield(2). (gh-97965)
(cherry picked from commit b9d2e8171696514e9226164005f7bf24bf69e66d)
Co-authored-by: Dong-hee Na <donghee.na@python.org>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/posixmodule.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 309982a..4bebbbd 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -7096,8 +7096,13 @@ static PyObject * os_sched_yield_impl(PyObject *module) /*[clinic end generated code: output=902323500f222cac input=e54d6f98189391d4]*/ { - if (sched_yield()) + int result; + Py_BEGIN_ALLOW_THREADS + result = sched_yield(); + Py_END_ALLOW_THREADS + if (result < 0) { return posix_error(); + } Py_RETURN_NONE; } |