summaryrefslogtreecommitdiff
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2007-03-28 03:45:20 +0000
committerFacundo Batista <facundobatista@gmail.com>2007-03-28 03:45:20 +0000
commit1fe9f968a21843175c3cbd6adf632aa95d2f2bef (patch)
tree85658d73283cf4945e086b3b43224265667908c9 /Lib/test/test_socket.py
parentb20c500251949028d38b32112e864da3cd074be0 (diff)
downloadcpython-git-1fe9f968a21843175c3cbd6adf632aa95d2f2bef.tar.gz
Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 5be3dc3b5e..24d1a5dd3d 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -597,6 +597,13 @@ class BasicUDPTest(ThreadedUDPSocketTest):
def _testRecvFrom(self):
self.cli.sendto(MSG, 0, (HOST, PORT))
+ def testRecvFromNegative(self):
+ # Negative lengths passed to recvfrom should give ValueError.
+ self.assertRaises(ValueError, self.serv.recvfrom, -1)
+
+ def _testRecvFromNegative(self):
+ self.cli.sendto(MSG, 0, (HOST, PORT))
+
class TCPCloserTest(ThreadedTCPSocketTest):
def testClose(self):