Hi, I have a new question for my PEP 446 (inheritance of file descriptors). os.get/set_inheritable(handle) has strange behaviour on Windows, and so I would like to add new os.get/set_handle_inheritable() functions to avoid it. The problem is that a socket would require a different function depending on the OS: os.get/set_handle_inheritable() on Windows, os.get/set_inheritable() on UNIX. Should I add a portable helper to the socket module (socket.get/set_inheritable)? Or add 2 methods to the socket class? Now the details. I have an issue with sockets and the PEP 446. On Windows, my implementation of the os.set_inheritable(fd: int, inheritable: bool) function tries to guess if fd is a file descriptor or a handle. The reason is that the fileno() method of a socket returns a file descriptor on UNIX, whereas it returns a handle on Windows. It is convinient to have a os.set_interiable() function which accepts both types. The issue is that os.get_inheritable() does the same guess and it has a strange behaviour. Calling os.get_inheritable() with integers in the range(20) has a border effect: open(filename) creates a file descriptor 10, whereas it creates a file descriptor 3 if get_inheritable() was not called (why 10 and not 3?). To avoid the border effect, it's better to not guess if the parameter is a file descriptor or a Windows handle, and a new two new functions: os.get_handle_inheritable() and os.set_handle_inheritable(). Victor
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4