Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-39099: add scandir.dirfd() #17664

Open
wants to merge 6 commits into
base: master
from
Open

Conversation

@giampaolo
Copy link
Contributor

giampaolo commented Dec 19, 2019

giampaolo added 2 commits Dec 19, 2019
Copy link
Contributor

ZackerySpytz left a comment

I see that the BPO issue has been closed, but I have some comments anyway. :)

fd = dirfd(self->dirp);
if (fd == -1)
return path_error(&self->path);
return Py_BuildValue("i", fd);

This comment has been minimized.

Copy link
@ZackerySpytz

ZackerySpytz Dec 22, 2019

Contributor

PyLong_FromLong(fd); could be used here.

PyErr_SetString(PyExc_ValueError, "I/O operation on closed directory");
return NULL;
}
fd = dirfd(self->dirp);

This comment has been minimized.

Copy link
@ZackerySpytz

ZackerySpytz Dec 22, 2019

Contributor

fd can be declared here.

@@ -169,6 +169,9 @@ Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and
:data:`os.P_PIDFD` (:issue:`38713`) for process management with file
descriptors.

Added :meth:`~os.scandir.dirfd` method.

This comment has been minimized.

Copy link
@ZackerySpytz

ZackerySpytz Dec 22, 2019

Contributor

The ~ will cause only dirfd to be displayed.

@@ -0,0 +1,2 @@
os.scandir() object has a new dirfd() method. (patch contributed by

This comment has been minimized.

Copy link
@ZackerySpytz

ZackerySpytz Dec 22, 2019

Contributor

Markup could be used here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.