summaryrefslogtreecommitdiff
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-01-04 11:00:45 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2011-01-04 11:00:45 +0000
commitc3a51ecb8518540625034ff07f9d518e0f84e7ac (patch)
tree385ce77578dfe018983aefc822158a04c7709449 /Lib/test/test_socket.py
parent8848c7a37f929b471267bd893f91c3b818fafce0 (diff)
downloadcpython-git-c3a51ecb8518540625034ff07f9d518e0f84e7ac.tar.gz
Issue #10819: SocketIO.name property returns -1 when its closed, instead of
raising a ValueError, to fix repr().
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 4c8c7d666a..8f96fe48a3 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -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):