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

select.devpoll objects have no close() method #62994

Closed
vstinner opened this issue Aug 20, 2013 · 10 comments
Closed

select.devpoll objects have no close() method #62994

vstinner opened this issue Aug 20, 2013 · 10 comments

Comments

@vstinner
Copy link
Member

vstinner commented Aug 20, 2013

BPO 18794
Nosy @jcea, @vstinner, @serhiy-storchaka
Files
  • devpoll_close.patch
  • devpoll_close-2.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2013-08-21.22:21:04.894>
    created_at = <Date 2013-08-20.22:20:01.375>
    labels = []
    title = 'select.devpoll objects have no close() method'
    updated_at = <Date 2013-08-21.22:21:47.582>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2013-08-21.22:21:47.582>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-08-21.22:21:04.894>
    closer = 'python-dev'
    components = []
    creation = <Date 2013-08-20.22:20:01.375>
    creator = 'vstinner'
    dependencies = []
    files = ['31397', '31404']
    hgrepos = []
    issue_num = 18794
    keywords = ['patch']
    message_count = 10.0
    messages = ['195721', '195723', '195725', '195748', '195757', '195765', '195771', '195814', '195826', '195827']
    nosy_count = 5.0
    nosy_names = ['jcea', 'vstinner', 'neologix', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue18794'
    versions = ['Python 3.4']

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 20, 2013

    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 bpo-18571).

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 20, 2013

    See also issue bpo-16853 "add a Selector to the select module".

    @gvanrossum
    Copy link
    Member

    gvanrossum commented Aug 20, 2013

    This all sounds fine to fix without waiting for anything else -- can you attach a patch here?

    @neologix
    Copy link
    Mannequin

    neologix mannequin commented Aug 21, 2013

    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.

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 21, 2013

    "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;

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 21, 2013

    "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 bpo-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.

    @serhiy-storchaka
    Copy link
    Member

    serhiy-storchaka commented Aug 21, 2013

    poll, devpoll, epoll and kqueue are tested in test_poll.py, test_devpoll.py, test_epoll.py and test_kqueue.py test files.

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 21, 2013

    Updated patch: move tests to the right test files and test that close() can be called more than once.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 21, 2013

    New changeset ccbe2132392b by Victor Stinner in branch 'default':
    Close bpo-18794: Add a fileno() method and a closed attribute to select.devpoll
    http://hg.python.org/cpython/rev/ccbe2132392b

    @python-dev python-dev mannequin closed this as completed Aug 21, 2013
    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 21, 2013

    Charles-François Natali and Guido van Rossum: thanks for your reviews ;-)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants