3 ms·
Hmm. I just ran out of file descriptors on a little personal project of mine just a few days ago. I kept calling pty.openpty() and I forgot to close them. My p
by graton 6y ago
Hmm. I just ran out of file descriptors on a little personal project of mine just a few days ago.
I kept calling pty.openpty() and I forgot to close them. My program was calling it three times (stdout, stderr, stdin) every 10 seconds :(
I ended up writing a context manager for it and now it works well. Unfortunately contextlib.closing() wouldn't work as pty.openpty() returns two objects.