[pypy-commit] pypy py3.5: merge default into py3.5

mattip pypy.commits at gmail.com
Sun May 6 15:27:39 EDT 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.5
Changeset: r94479:2885e6b1619d
Date: 2018-05-06 22:26 +0300
http://bitbucket.org/pypy/pypy/changeset/2885e6b1619d/

Log:	merge default into py3.5

diff --git a/rpython/jit/metainterp/optimizeopt/info.py b/rpython/jit/metainterp/optimizeopt/info.py
--- a/rpython/jit/metainterp/optimizeopt/info.py
+++ b/rpython/jit/metainterp/optimizeopt/info.py
@@ -260,6 +260,12 @@
             # we don't know about this item
             return
         op = optimizer.get_box_replacement(self._fields[fielddescr.get_index()])
+        if op is None:
+            # XXX same bug as in serialize_opt:
+            # op should never be None, because that's an invariant violation in
+            # AbstractCachedEntry. But it still seems to happen when the info
+            # is attached to a Constant. At least we shouldn't crash.
+            return
         opnum = OpHelpers.getfield_for_descr(fielddescr)
         getfield_op = ResOperation(opnum, [structbox], descr=fielddescr)
         shortboxes.add_heap_op(op, getfield_op)
@@ -589,6 +595,7 @@
             return
         item = self._items[index]
         if item is not None:
+            # see comment in AbstractStructPtrInfo.produce_short_preamble_ops
             op = optimizer.get_box_replacement(item)
             opnum = OpHelpers.getarrayitem_for_descr(descr)
             getarrayitem_op = ResOperation(opnum, [structbox, ConstInt(index)],
diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py
--- a/rpython/rlib/rsocket.py
+++ b/rpython/rlib/rsocket.py
@@ -550,7 +550,7 @@
         self.family = family
         self.type = type
         self.proto = proto
-        self.timeout = defaults.timeout
+        self.settimeout(defaults.timeout)
 
     @staticmethod
     def empty_rsocket():
diff --git a/rpython/rlib/test/test_rsocket.py b/rpython/rlib/test/test_rsocket.py
--- a/rpython/rlib/test/test_rsocket.py
+++ b/rpython/rlib/test/test_rsocket.py
@@ -465,6 +465,15 @@
     s.connect(INETAddress('python.org', 80))
     s.close()
 
+def test_connect_with_default_timeout_fail():
+    rsocket.setdefaulttimeout(0.1)
+    s = RSocket()
+    rsocket.setdefaulttimeout(None)
+    assert s.gettimeout() == 0.1
+    with py.test.raises(SocketTimeout):
+        s.connect(INETAddress('172.30.172.30', 12345))
+    s.close()
+
 def test_getsetsockopt():
     import struct
     assert struct.calcsize("i") == rffi.sizeof(rffi.INT)


More information about the pypy-commit mailing list