diff options
author | Dong-hee Na <donghee.na@python.org> | 2022-10-06 22:57:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-06 22:57:37 (GMT) |
commit | b9d2e8171696514e9226164005f7bf24bf69e66d (patch) | |
tree | ed9ff8889f5327600d46a614b8bd41b5cde4e891 /Modules/posixmodule.c | |
parent | e1c4d56fdde28728c37de855edbb463fa0d7f95d (diff) | |
download | cpython-b9d2e8171696514e9226164005f7bf24bf69e66d.zip cpython-b9d2e8171696514e9226164005f7bf24bf69e66d.tar.gz cpython-b9d2e8171696514e9226164005f7bf24bf69e66d.tar.bz2 |
fixes gh-96078: os.sched_yield release the GIL while calling sched_yield(2). (gh-97965)
Diffstat (limited to 'Modules/posixmodule.c')
-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 cbdc259..a72d577 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -7075,8 +7075,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; } |