bpo-44219: Release the GIL during isatty syscalls (GH-28250) (GH-28255)

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.
(cherry picked from commit 06148b1870fceb1a21738761b8e1ac3bf654319b)

Co-authored-by: Vincent Michel <vxgmichel@gmail.com>
3 files changed