Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5f150a8

Browse filesBrowse files
committed
gh-96078: os.sched_yield release the GIL while calling sched_yield(2).
1 parent e63d7da commit 5f150a8
Copy full SHA for 5f150a8

File tree

2 files changed

+8
-1
lines changed
Filter options

2 files changed

+8
-1
lines changed
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:func:`os.sched_yield` now release the GIL while calling sched_yield(2).
2+
Patch by Dong-hee Na.

‎Modules/posixmodule.c

Copy file name to clipboardExpand all lines: Modules/posixmodule.c
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7071,8 +7071,13 @@ static PyObject *
70717071
os_sched_yield_impl(PyObject *module)
70727072
/*[clinic end generated code: output=902323500f222cac input=e54d6f98189391d4]*/
70737073
{
7074-
if (sched_yield())
7074+
int result;
7075+
Py_BEGIN_ALLOW_THREADS
7076+
result = sched_yield();
7077+
Py_END_ALLOW_THREADS
7078+
if (result < 0) {
70757079
return posix_error();
7080+
}
70767081
Py_RETURN_NONE;
70777082
}
70787083

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.