Message256870
Марк, os.open added dir_fd support in 3.3, which is implemented on POSIX systems by calling openat. The dir_fd parameter is available for many os functions. This is discussed in section 1.5, Files and Directories [1].
It would be nice if we could support dir_fd on Windows as well, but we'd have to bypass the CRT and Windows API to use the native NT API instead, such as NtCreateFile [2]. The kernel has supported opening a file relative to a directory handle since it was release in 1993 (NT 3.1). All named kernel objects are referenced using an OBJECT_ATTRIBUTES [3] data structure. ObjectName -- a path with up to 32768 UTF-16 characters -- is relative to the RootDirectory handle if non-NULL. This is how paths relative to the process working directory are implemented, but changing the working directory isn't thread safe.
[1]: https://docs.python.org/3/library/os.html#files-and-directories
[2]: https://msdn.microsoft.com/en-us/library/ff566424
[3]: https://msdn.microsoft.com/en-us/library/ff557749 |
|
Date |
User |
Action |
Args |
2015-12-22 21:37:03 | eryksun | set | recipients:
+ eryksun, terry.reedy, amaury.forgeotdarc, pitrou, vstinner, nadeem.vawda, benjamin.peterson, ned.deily, eric.araujo, Arfrever, neologix, rosslagerwall, socketpair, python-dev |
2015-12-22 21:37:03 | eryksun | set | messageid: <1450820223.76.0.140974583234.issue12797@psf.upfronthosting.co.za> |
2015-12-22 21:37:03 | eryksun | link | issue12797 messages |
2015-12-22 21:37:03 | eryksun | create | |
|