[issue22054] Add os.get_blocking() and os.set_blocking() functions

Akira Li report at bugs.python.org
Mon Jul 28 16:52:46 CEST 2014


Akira Li added the comment:

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

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22054>
_______________________________________


More information about the Python-bugs-list mailing list