summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorVincent Michel <vxgmichel@gmail.com>2021-09-09 13:12:03 (GMT)
committerGitHub <noreply@github.com>2021-09-09 13:12:03 (GMT)
commit06148b1870fceb1a21738761b8e1ac3bf654319b (patch)
tree183f403c348be7ed36f8fc93ec63c32c46688e68 /Modules/posixmodule.c
parent04676b69466d2e6d2903f1c6879d2cb292721455 (diff)
downloadcpython-06148b1870fceb1a21738761b8e1ac3bf654319b.zip
cpython-06148b1870fceb1a21738761b8e1ac3bf654319b.tar.gz
cpython-06148b1870fceb1a21738761b8e1ac3bf654319b.tar.bz2
bpo-44219: Release the GIL during isatty syscalls (GH-28250)
Release the GIL while performing isatty() system calls on arbitrary file descriptors. In particular, this affects os.isatty(), os.device_encoding() and io.TextIOWrapper. By extension, io.open() in text mode is also affected.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 89659ae..609f10b 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -10066,9 +10066,11 @@ os_isatty_impl(PyObject *module, int fd)
/*[clinic end generated code: output=6a48c8b4e644ca00 input=08ce94aa1eaf7b5e]*/
{
int return_value;
+ Py_BEGIN_ALLOW_THREADS
_Py_BEGIN_SUPPRESS_IPH
return_value = isatty(fd);
_Py_END_SUPPRESS_IPH
+ Py_END_ALLOW_THREADS
return return_value;
}