Message 78433 - Python tracker (original) (raw)
Developers may think that the file descriptor is closed when the integer object gets out of scope.
I'm not concerned about that. When they use os.open, they will typically understand what a file handle is, and how it relates to
I propose the addition of opendir() for the purpose of the at() functions. The opendir function should return a wrapper object around the DIR pointer returned by opendir(). A function fileno() exposed the file descriptor of the DIR pointer via dirfd().
-1. This is exactly the second-guessing kind of thing that the POSIX module should avoid. openat(2) doesn't expect DIR objects, and neither should posix.openat.
If desired, a layer can be added on top of this that makes it more "safe", e.g. in the os module; such a layer should then try to make it cross-platform before trying to make it safe.