For some reason on my FreeBSD system whenever I run python I am unable to access file descriptor 3 or 4. According to my system's fstat, there is a pipe there: lack python 36683 3* pipe cd5b2cc0 <-> cd99f9e0 0 rw lack python 36683 4* pipe cd99f9e0 <-> cd5b2cc0 0 rw But I did not open this pipe, nor can I figure out where it came from. I also cannot close this file descriptor or use it in any way - I recieve the error: >>> os.close(3) Traceback (most recent call last): File "", line 1, in ? OSError: [Errno 9] Bad file descriptor >>> There is some strange behaviour if I close one of the standard descriptors first: >>> os.close(2) >>> os.close(3) >>> os.close(4) >>> But despite the lack of error messages, the pipe from 3 to 4 is still open. I do not know why this happens. and am at a loss at how to access FD#3.
Logged In: YES user_id=185022 Update: This seems to be linked to "uthread" support. This pipe is opened in uthread_init.c around line 167, and should be closed by uthread_execve.c around line 59. For some reason the pipe is not being closed.
Logged In: YES user_id=21627 Neither uthread_init.c nor uthread_execve.c are part of the Python distribution. Why do you think you have found a bug in Python? It sounds more like a bug in FreeBSD to me.