Author: Matti Picus <[email protected]>
Branch:
Changeset: r94478:7fbd70c05558
Date: 2018-05-06 22:24 +0300
http://bitbucket.org/pypy/pypy/changeset/7fbd70c05558/
Log: merge socket_default_timeout_blockingness into default
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)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit