On Wed, 11 Nov 2026 07:10:49 -0800, Andy Valencia wrote:
> Credit where credit is due, while doing some regression testing of > CPython on the Mac, one of the tests bombed with an EXC_GUARD. Turns > out they have "guarded" file descriptors, and if you touch them your > program dies. The CPython test had a "sweep all the FD's and close > them" loop, and when it touched the protected one--boom. > > This felt very UNIX-y to me, even though I hadn't encountered such a > thing before. I felt like there must be some folks deep inside Apple > who still have a feel for such things.
Do you mean, the program crashed because it was trying to close an invalid file descriptor? On Linux, there is a way a process can tell which of its file descriptors are valid or not (/proc/self/fd); is there not such a mechanism on macOS?