[pypy-commit] pypy py3.3: merge py3k

pjenvey noreply at buildbot.pypy.org
Sat Aug 23 01:32:01 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3.3
Changeset: r72972:818fa7069ba0
Date: 2014-08-22 15:55 -0700
http://bitbucket.org/pypy/pypy/changeset/818fa7069ba0/

Log:	merge py3k

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,17 +1,24 @@
+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
-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
 
 defaultevents = rpoll.POLLIN | rpoll.POLLOUT | rpoll.POLLPRI
 
+
 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 = {}
@@ -45,8 +52,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):
@@ -60,7 +66,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:
@@ -90,10 +96,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 = []
@@ -106,17 +108,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)
@@ -147,7 +149,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:
@@ -181,7 +184,7 @@
         if timeout < 0.0:
             raise oefmt(space.w_ValueError, "timeout must be non-negative")
 
-    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)
@@ -205,7 +208,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')
diff --git a/rpython/rlib/rarithmetic.py b/rpython/rlib/rarithmetic.py
--- a/rpython/rlib/rarithmetic.py
+++ b/rpython/rlib/rarithmetic.py
@@ -539,6 +539,7 @@
 
 SHRT_MIN = -2**(_get_bitsize('h') - 1)
 SHRT_MAX = 2**(_get_bitsize('h') - 1) - 1
+USHRT_MAX = 2**_get_bitsize('h') - 1
 INT_MIN = int(-2**(_get_bitsize('i') - 1))
 INT_MAX = int(2**(_get_bitsize('i') - 1) - 1)
 UINT_MAX = r_uint(2**_get_bitsize('i') - 1)


More information about the pypy-commit mailing list