[pypy-commit] pypy py3k: pep8, kill an invalid XXX comment
pjenvey
noreply at buildbot.pypy.org
Sat Aug 23 01:31:59 CEST 2014
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r72970:a4773e318ffe
Date: 2014-08-22 15:41 -0700
http://bitbucket.org/pypy/pypy/changeset/a4773e318ffe/
Log: pep8, kill an invalid XXX comment (grafted from
e8fac13444fa1ba5546f2c6af6d278b9b0a0770b)
diff --git a/pypy/module/select/interp_select.py b/pypy/module/select/interp_select.py
--- a/pypy/module/select/interp_select.py
+++ b/pypy/module/select/interp_select.py
@@ -1,21 +1,29 @@
-from pypy.interpreter.typedef import TypeDef
-from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
-from pypy.interpreter.error import OperationError, wrap_oserror, oefmt
-from rpython.rlib import rpoll
import errno
+from rpython.rlib import _rsocket_rffi as _c, rpoll
+from rpython.rtyper.lltypesystem import lltype, rffi
+
+from pypy.interpreter.baseobjspace import W_Root
+from pypy.interpreter.error import OperationError, oefmt, wrap_oserror
+from pypy.interpreter.gateway import WrappedDefault, interp2app, unwrap_spec
+from pypy.interpreter.typedef import TypeDef
+
defaultevents = rpoll.POLLIN | rpoll.POLLOUT | rpoll.POLLPRI
+
class Cache:
def __init__(self, space):
self.w_error = space.new_exception_class("select.error")
+
def poll(space):
"""Returns a polling object, which supports registering and
-unregistering file descriptors, and then polling them for I/O events."""
+ unregistering file descriptors, and then polling them for I/O
+ events.
+ """
return Poll()
+
class Poll(W_Root):
def __init__(self):
self.fddict = {}
@@ -39,8 +47,7 @@
try:
del self.fddict[fd]
except KeyError:
- raise OperationError(space.w_KeyError,
- space.wrap(fd)) # XXX should this maybe be w_fd?
+ raise OperationError(space.w_KeyError, space.wrap(fd))
@unwrap_spec(w_timeout=WrappedDefault(None))
def poll(self, space, w_timeout):
@@ -54,7 +61,7 @@
w_timeout = space.int(w_timeout)
except OperationError:
raise oefmt(space.w_TypeError,
- "timeout must be an integer or None")
+ "timeout must be an integer or None")
timeout = space.c_int_w(w_timeout)
if self.running:
@@ -85,10 +92,6 @@
# ____________________________________________________________
-from rpython.rlib import _rsocket_rffi as _c
-from rpython.rtyper.lltypesystem import lltype, rffi
-
-
def _build_fd_set(space, list_w, ll_list, nfds):
_c.FD_ZERO(ll_list)
fdlist = []
@@ -101,17 +104,17 @@
return fdlist, nfds
_build_fd_set._always_inline_ = True # get rid of the tuple result
+
def _unbuild_fd_set(space, list_w, fdlist, ll_list, reslist_w):
for i in range(len(fdlist)):
fd = fdlist[i]
if _c.FD_ISSET(fd, ll_list):
reslist_w.append(list_w[i])
+
def _call_select(space, iwtd_w, owtd_w, ewtd_w,
ll_inl, ll_outl, ll_errl, ll_timeval):
- fdlistin = None
- fdlistout = None
- fdlisterr = None
+ fdlistin = fdlistout = fdlisterr = None
nfds = -1
if ll_inl:
fdlistin, nfds = _build_fd_set(space, iwtd_w, ll_inl, nfds)
@@ -143,7 +146,8 @@
space.newlist(resout_w),
space.newlist(reserr_w)])
- at unwrap_spec(w_timeout = WrappedDefault(None))
+
+ at unwrap_spec(w_timeout=WrappedDefault(None))
def select(space, w_iwtd, w_owtd, w_ewtd, w_timeout):
"""Wait until one or more file descriptors are ready for some kind of I/O.
The first three arguments are sequences of file descriptors to be waited for:
@@ -175,7 +179,7 @@
else:
timeout = space.float_w(w_timeout)
- ll_inl = lltype.nullptr(_c.fd_set.TO)
+ ll_inl = lltype.nullptr(_c.fd_set.TO)
ll_outl = lltype.nullptr(_c.fd_set.TO)
ll_errl = lltype.nullptr(_c.fd_set.TO)
ll_timeval = lltype.nullptr(_c.timeval)
@@ -199,7 +203,11 @@
return _call_select(space, iwtd_w, owtd_w, ewtd_w,
ll_inl, ll_outl, ll_errl, ll_timeval)
finally:
- if ll_timeval: lltype.free(ll_timeval, flavor='raw')
- if ll_errl: lltype.free(ll_errl, flavor='raw')
- if ll_outl: lltype.free(ll_outl, flavor='raw')
- if ll_inl: lltype.free(ll_inl, flavor='raw')
+ if ll_timeval:
+ lltype.free(ll_timeval, flavor='raw')
+ if ll_errl:
+ lltype.free(ll_errl, flavor='raw')
+ if ll_outl:
+ lltype.free(ll_outl, flavor='raw')
+ if ll_inl:
+ lltype.free(ll_inl, flavor='raw')
More information about the pypy-commit
mailing list