Issue #10819: SocketIO.name property returns -1 when its closed, instead of

raising a ValueError, to fix repr().
This commit is contained in:
Victor Stinner 2011-01-04 11:00:45 +00:00
parent 8848c7a37f
commit c3a51ecb85
3 changed files with 13 additions and 1 deletions

View file

@ -738,6 +738,12 @@ class GeneralModuleTests(unittest.TestCase):
f = None
support.gc_collect()
def test_name_closed_socketio(self):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
fp = sock.makefile("rb")
fp.close()
self.assertEqual(repr(fp), "<_io.BufferedReader name=-1>")
@unittest.skipUnless(thread, 'Threading required for this test.')
class BasicTCPTest(SocketConnectedTest):