Bug 1688393. Adds a control of negative values in
socket.recvfrom, which caused an ugly crash.
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 5be3dc3..24d1a5d 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -597,6 +597,13 @@
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):