]> granicus.if.org Git - python/commitdiff
Issue #8498: In socket.accept(), allow to specify 0 as a backlog value in
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 10 May 2011 17:19:13 +0000 (19:19 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 10 May 2011 17:19:13 +0000 (19:19 +0200)
order to accept exactly one connection.  Patch by Daniel Evers.

1  2 
Doc/library/socket.rst
Lib/test/test_socket.py
Misc/ACKS
Misc/NEWS
Modules/socketmodule.c

Simple merge
index c811ec445cfdc09a7ae2c625123f576c1a1f298c,4100c34452c7fd0ff99898b79836e261b410d811..3efe1bbc0ca6657bedb28e28bb4e8fbfb853a8ef
@@@ -791,12 -788,13 +791,19 @@@ class GeneralModuleTests(unittest.TestC
              fp.close()
              self.assertEqual(repr(fp), "<_io.BufferedReader name=-1>")
  
 -    def testListenBacklog0(self):
 +    def test_pickle(self):
 +        sock = socket.socket()
 +        with sock:
 +            for protocol in range(pickle.HIGHEST_PROTOCOL + 1):
 +                self.assertRaises(TypeError, pickle.dumps, sock, protocol)
 +
++    def test_listen_backlog0(self):
+         srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+         srv.bind((HOST, 0))
+         # backlog = 0
+         srv.listen(0)
+         srv.close()
  
  @unittest.skipUnless(thread, 'Threading required for this test.')
  class BasicTCPTest(SocketConnectedTest):
diff --cc Misc/ACKS
index 297dccac1707ca8d2e083f7be3b310476a68b84b,399de8cba9a69856fe19878ee7314a32e93606a9..36778ff2db78676933c743fa9f6f38da320150a2
+++ b/Misc/ACKS
@@@ -270,7 -268,7 +270,8 @@@ Carey Evan
  Tim Everett
  Paul Everitt
  David Everly
+ Daniel Evers
 +Winston Ewert
  Greg Ewing
  Martijn Faassen
  Clovis Fabricio
diff --cc Misc/NEWS
index 2b0529e789760e3499c3fc6dc719d183d0e6b45a,ac9ac79da25c3c1804053dd3ed7c573f08a7ca99..6b9da84672e3966682e8a736eeff38c5bdd2f99d
+++ b/Misc/NEWS
@@@ -143,29 -86,11 +143,32 @@@ Core and Builtin
  Library
  -------
  
+ - Issue #8498: In socket.accept(), allow to specify 0 as a backlog value in
+   order to accept exactly one connection.  Patch by Daniel Evers.
 +- Issue #12011: signal.signal() and signal.siginterrupt() raise an OSError,
 +  instead of a RuntimeError: OSError has an errno attribute.
 +
 +- Issue #3709: a flush_headers method to BaseHTTPRequestHandler which manages
 +  the sending of headers to output stream and flushing the internal headers
 +  buffer. Patch contribution by Andrew Schaaf
 +
 +- Issue #11743: Rewrite multiprocessing connection classes in pure Python.
 +
  - Issue #11164: Stop trying to use _xmlplus in the xml module.
  
 +- Issue #11888: Add log2 function to math module. Patch written by Mark
 +  Dickinson.
 +
 +- Issue #12012: ssl.PROTOCOL_SSLv2 becomes optional.
 +
 +- Issue #8407: The signal handler writes the signal number as a single byte
 +  instead of a nul byte into the wakeup file descriptor. So it is possible to
 +  wait more than one signal and know which signals were raised.
 +
 +- Issue #8407: Add pthread_kill(), sigpending() and sigwait() functions to the
 +  signal module.
 +
  - Issue #11927: SMTP_SSL now uses port 465 by default as documented.  Patch
    by Kasun Herath.
  
Simple merge