summaryrefslogtreecommitdiff
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-18 16:04:40 -0400
committerYury Selivanov <yury@magic.io>2016-10-18 16:04:40 -0400
commit193a360570b63110dd11d059297dc0d18b57b95b (patch)
treefcff5c129cf821090641fbcf784ef39aefa1690d /Lib/test/test_socket.py
parent62cca920db113494df5183c4aad1227c6cd89c60 (diff)
parentfa22b29960b4e683f4e5d7e308f674df2620473c (diff)
downloadcpython-git-193a360570b63110dd11d059297dc0d18b57b95b.tar.gz
Merge 3.6 (issue #28471)
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index fcadd5b72a..01d0bb9eac 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -4562,6 +4562,18 @@ class TestExceptions(unittest.TestCase):
self.assertTrue(issubclass(socket.gaierror, OSError))
self.assertTrue(issubclass(socket.timeout, OSError))
+ def test_setblocking_invalidfd(self):
+ # Regression test for issue #28471
+
+ sock0 = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
+ sock = socket.socket(
+ socket.AF_INET, socket.SOCK_STREAM, 0, sock0.fileno())
+ sock0.close()
+
+ with self.assertRaises(OSError):
+ sock.setblocking(False)
+
+
@unittest.skipUnless(sys.platform == 'linux', 'Linux specific test')
class TestLinuxAbstractNamespace(unittest.TestCase):