New submission from Matthias Urlichs <matth...@urlichs.de>:
Opening a file calls `isatty` which calls an ioctl with the GIL held. GDB: ``` #0 __GI___tcgetattr (fd=18, termios_p=termios_p@entry=0x7f618a5df920) at ../sysdeps/unix/sysv/linux/tcgetattr.c:38 #1 0x00007f618bd1ca0c in __isatty (fd=<optimized out>) at ../sysdeps/posix/isatty.c:27 #2 0x000000000062b746 in _Py_device_encoding (fd=<optimized out>) at ../Python/fileutils.c:62 #3 0x000000000060bf90 in _io_TextIOWrapper___init___impl (write_through=0, line_buffering=0, newline=0x0, errors='strict', encoding=<optimized out>, buffer=<_io.BufferedWriter at remote 0x7f618986aeb0>, self=0x7f618985a860) at ../Modules/_io/textio.c:1149 ... ``` Please don't do that. In my case, the file in question is implemented as a FUSE mount which is served by the same process (different thread of course). Thus holding the GIL at this point causes a rather interesting deadlock. Tested with 3.9. ---------- components: Interpreter Core messages: 394208 nosy: smurfix priority: normal severity: normal status: open title: Opening a file holds the GIL when it calls "isatty()" type: crash versions: Python 3.10, Python 3.11, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44219> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com