This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: select.devpoll objects have no close() method
Type: Stage: resolved
Components: Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jcea, neologix, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2013-08-20 22:20 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
devpoll_close.patch vstinner, 2013-08-21 10:23 review
devpoll_close-2.patch vstinner, 2013-08-21 18:19 review
Messages (10)
msg195721 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-20 22:20
select.epoll and select.kqueue objects have a close() method, but not select.poll objects, whereas all these objects store internally a file descriptor.

select.poll lacks also a fileno() method.

I added the fileno() method in my implementation of the PEP 446 (see issue #18571).
msg195723 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-20 22:21
See also issue #16853 "add a Selector to the select module".
msg195725 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-08-20 22:33
This all sounds fine to fix without waiting for anything else -- can you attach a patch here?
msg195748 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2013-08-21 07:05
Just to be explicit (there are typos in Victor's original messages): it's about select.devpoll, for Solaris-derivatives with /dev/poll, and not for select.poll, based on poll() syscall.
msg195757 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-21 09:25
"Just to be explicit (there are typos in Victor's original messages): it's about select.devpoll, for Solaris-derivatives with /dev/poll, and not for select.poll, based on poll() syscall."

Oops sorry, yes, I'm talking about select.devpoll, its structure has a "int fd_devpoll;" field:

typedef struct {
    PyObject_HEAD
    int fd_devpoll;
    int max_n_fds;
    int n_fds;
    struct pollfd *fds;
} devpollObject;
msg195765 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-21 10:23
"This all sounds fine to fix without waiting for anything else -- can you attach a patch here?"

I opened the issue as a reminder for me. Here is a patch.

 * Add close() and fileno() methods and a closed attribute (property) to devpoll object
 * Document closed attribute of epoll and kqueue objects
 * Add tests on closed object for devpoll, epoll and kqueue. There was no test for devpoll, epoll nor kqueue :-(

select.poll is still not tested. We should add much more tests, especially tests checking than a fd becomes ready for each implementation. We may develop these tests using #16853 ?

I ran test_select on Linux, so I only checked the epoll unit test.

The "closed" attribute of epoll and kqueue objects should also be documented in Python 2.7 and 3.3.
msg195771 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-21 10:58
poll, devpoll, epoll and kqueue are tested in test_poll.py, test_devpoll.py, test_epoll.py and test_kqueue.py test files.
msg195814 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-21 18:19
Updated patch: move tests to the right test files and test that close() can be called more than once.
msg195826 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-21 22:21
New changeset ccbe2132392b by Victor Stinner in branch 'default':
Close #18794: Add a fileno() method and a closed attribute to select.devpoll
http://hg.python.org/cpython/rev/ccbe2132392b
msg195827 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-21 22:21
Charles-François Natali and Guido van Rossum: thanks for your reviews ;-)
History
Date User Action Args
2022-04-11 14:57:49adminsetgithub: 62994
2013-08-21 22:21:47vstinnersetmessages: + msg195827
2013-08-21 22:21:04python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg195826

resolution: fixed
stage: needs patch -> resolved
2013-08-21 18:48:03gvanrossumsetnosy: - gvanrossum
2013-08-21 18:19:34vstinnersetfiles: + devpoll_close-2.patch

messages: + msg195814
2013-08-21 10:58:38serhiy.storchakasetmessages: + msg195771
2013-08-21 10:23:16vstinnersetfiles: + devpoll_close.patch
keywords: + patch
messages: + msg195765
2013-08-21 09:41:00serhiy.storchakasetnosy: + serhiy.storchaka

stage: needs patch
2013-08-21 09:25:55vstinnersetmessages: + msg195757
2013-08-21 07:05:54neologixsetmessages: + msg195748
2013-08-21 04:10:21jceasetnosy: + jcea
2013-08-20 22:33:53gvanrossumsetmessages: + msg195725
2013-08-20 22:21:50vstinnersetmessages: + msg195723
2013-08-20 22:20:01vstinnercreate