[issue39099] scandir.dirfd() method

2019-12-19 Thread Eryk Sun
Eryk Sun added the comment: > I am not sure if it's possible to also support Windows. For reference, FindFirstFileW doesn't support handle-relative names, and neither does CreateFileW. At a lower level in Windows NT, NtCreateFile has always supported handle-relative names, but CPython

[issue39099] scandir.dirfd() method

2019-12-19 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Good point, I didn't consider that. I suppose you're right. =) Closing. -- stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue39099] scandir.dirfd() method

2019-12-19 Thread Benjamin Peterson
Benjamin Peterson added the comment: Why not just os.open the directory yourself and pass it to os.scandir? -- nosy: +benjamin.peterson ___ Python tracker ___

[issue39099] scandir.dirfd() method

2019-12-19 Thread Giampaolo Rodola'
Change by Giampaolo Rodola' : -- keywords: +patch pull_requests: +17131 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17664 ___ Python tracker

[issue39099] scandir.dirfd() method

2019-12-19 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola' : PR in attachment adds a new dirfd() method to the scandir() object (POSIX only). This can be be passed to os.* functions supporting the "dir_fd" parameter, and avoid opening a new fd as in: >>> dirfd = os.open("basename", os.O_RDONLY, dir_fd=topfd)