mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #15842: the SocketIO.{readable,writable,seekable} methods now raise ValueError when the file-like object is closed.
Patch by Alessandro Moura.
This commit is contained in:
commit
9b1c84b586
3 changed files with 28 additions and 2 deletions
|
@ -1245,6 +1245,17 @@ class GeneralModuleTests(unittest.TestCase):
|
|||
fp.close()
|
||||
self.assertEqual(repr(fp), "<_io.BufferedReader name=-1>")
|
||||
|
||||
def test_unusable_closed_socketio(self):
|
||||
with socket.socket() as sock:
|
||||
fp = sock.makefile("rb", buffering=0)
|
||||
self.assertTrue(fp.readable())
|
||||
self.assertFalse(fp.writable())
|
||||
self.assertFalse(fp.seekable())
|
||||
fp.close()
|
||||
self.assertRaises(ValueError, fp.readable)
|
||||
self.assertRaises(ValueError, fp.writable)
|
||||
self.assertRaises(ValueError, fp.seekable)
|
||||
|
||||
def test_pickle(self):
|
||||
sock = socket.socket()
|
||||
with sock:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue