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

Add os.get_blocking() and os.set_blocking() functions #66253

Closed
vstinner opened this issue Jul 23, 2014 · 9 comments
Closed

Add os.get_blocking() and os.set_blocking() functions #66253

vstinner opened this issue Jul 23, 2014 · 9 comments
Labels
type-feature A feature request or enhancement

Comments

@vstinner
Copy link
Member

vstinner commented Jul 23, 2014

BPO 22054
Nosy @pitrou, @vstinner, @4kir4
Files
  • os_blocking.patch
  • os_blocking-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 2014-07-29.20:39:06.035>
    created_at = <Date 2014-07-23.21:30:14.220>
    labels = ['type-feature']
    title = 'Add os.get_blocking() and os.set_blocking() functions'
    updated_at = <Date 2014-07-29.20:39:06.034>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2014-07-29.20:39:06.034>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-07-29.20:39:06.035>
    closer = 'vstinner'
    components = []
    creation = <Date 2014-07-23.21:30:14.220>
    creator = 'vstinner'
    dependencies = []
    files = ['36052', '36053']
    hgrepos = []
    issue_num = 22054
    keywords = ['patch']
    message_count = 9.0
    messages = ['223782', '223784', '224131', '224162', '224165', '224170', '224171', '224184', '224247']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'vstinner', 'neologix', 'akira', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue22054'
    versions = ['Python 3.5']

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 23, 2014

    Antoine suggested me to add these functions in the issue bpo-22042.

    Here is a patch to implement these functions and use them in various places.

    @vstinner vstinner added the type-feature A feature request or enhancement label Jul 23, 2014
    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 23, 2014

    Oops, test_asyncio was failing. Fixed patched.

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 27, 2014

    Can someone please review my patch?

    @4kir4
    Copy link
    Mannequin

    4kir4 mannequin commented Jul 28, 2014

    Maybe is_something() is a better name than get_something()
    if something is a boolean?

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 28, 2014

    Maybe is_something() is a better name than get_something()
    if something is a boolean?

    os and socket modules already use getxxx() / setxxx() names:

    • os.get_inheritable() / os.set_inheritable()
    • os.getuid() / os.setuid()
    • os.getgroups() / os.setgroups()
    • os.getxattr() os.setxattr()
    • socket.gettimeout() / socket.settimeout()
    • socket.get_inheritable() / socket.set_inheritable()
    • etc.

    There is only one "is" function: os.isatty(), but it does not have a "os.settty" method.

    @4kir4
    Copy link
    Mannequin

    4kir4 mannequin commented Jul 28, 2014

    os and socket modules already use getxxx() / setxxx() names:

    • os.get_inheritable() / os.set_inheritable()
    • os.getuid() / os.setuid()
    • os.getgroups() / os.setgroups()
    • os.getxattr() os.setxattr()
    • socket.gettimeout() / socket.settimeout()
    • socket.get_inheritable() / socket.set_inheritable()
    • etc.

    egid, euid, gid, groups, pgid, pgrp, priority, resgid, sid, uid, xatrr,
    hostname, timeout, sockopt are not boolean. Though
    get_inheritable() spoils the pot.

    Compare:

      if os.get_blocking(fd): # is it a bug? Does it return some mode bits?
         # Do I need stat.IS_BLK(os.get_blocking(fd)) here instead?

    And:

      if os.is_blocking(fd):
         # it is clear that fd is blocking

    There could be an argument that get_inheritable should be renamed to
    is_inheritable instead.

    @neologix
    Copy link
    Mannequin

    neologix mannequin commented Jul 28, 2014

    I agree with Akira, although it's probably too late now to rename.

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 28, 2014

    Guido van Rossum told me that he's ok for "get": "I'd go with get, since that seems the tradition in the os module."

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 29, 2014

    New changeset 8f0b8ddbb66b by Victor Stinner in branch 'default':
    Issue bpo-22054: Add os.get_blocking() and os.set_blocking() functions to get and
    http://hg.python.org/cpython/rev/8f0b8ddbb66b

    @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
    type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant