diff options
author | Yury Selivanov <yury@magic.io> | 2016-10-18 20:03:52 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-10-18 20:03:52 (GMT) |
commit | fa22b29960b4e683f4e5d7e308f674df2620473c (patch) | |
tree | 582d62c899c21afc3331fc08ce629c7392a1da1c /Lib/test | |
parent | 33bb64fb307c46279197f4eac3d5cb1b8f764ccd (diff) | |
download | cpython-fa22b29960b4e683f4e5d7e308f674df2620473c.zip cpython-fa22b29960b4e683f4e5d7e308f674df2620473c.tar.gz cpython-fa22b29960b4e683f4e5d7e308f674df2620473c.tar.bz2 |
Issue #28471: Fix crash (GIL state related) in socket.setblocking
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_socket.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index c9add6c..0cf7bfe 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -4552,6 +4552,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): |