]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #11657: Fix sending file descriptors over 255 over a multiprocessing Pipe.
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 23 Aug 2011 17:48:34 +0000 (19:48 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 23 Aug 2011 17:48:34 +0000 (19:48 +0200)
Also added some tests.

1  2 
Lib/test/regrtest.py
Lib/test/test_multiprocessing.py
Misc/NEWS
Modules/_multiprocessing/multiprocessing.c

Simple merge
index 405fbd525693b234b6fc268b58b5bf4e41c0dc23,6f1c6c44977ace62eb7fcedcc069b919c5d21cf7..7a7805d59f6881433014161b3105a373be0fe8bf
@@@ -71,24 -76,12 +76,29 @@@ HAVE_GETVALUE = not getattr(_multiproce
                              'HAVE_BROKEN_SEM_GETVALUE', False)
  
  WIN32 = (sys.platform == "win32")
 +if WIN32:
 +    from _subprocess import WaitForSingleObject, INFINITE, WAIT_OBJECT_0
 +
 +    def wait_for_handle(handle, timeout):
 +        if timeout is None or timeout < 0.0:
 +            timeout = INFINITE
 +        else:
 +            timeout = int(1000 * timeout)
 +        return WaitForSingleObject(handle, timeout) == WAIT_OBJECT_0
 +else:
 +    from select import select
 +    _select = util._eintr_retry(select)
 +
 +    def wait_for_handle(handle, timeout):
 +        if timeout is not None and timeout < 0.0:
 +            timeout = None
 +        return handle in _select([handle], [], [], timeout)[0]
  
+ try:
+     MAXFD = os.sysconf("SC_OPEN_MAX")
+ except:
+     MAXFD = 256
  #
  # Some tests require ctypes
  #
diff --cc Misc/NEWS
index b2d9e84b943bd40fafc53818366cf533172ca8f3,fca436c6fe354c7ea745e0213f366372756532d3..4b5a9a6d77835cf2b465911ce7e94c00af87966c
+++ b/Misc/NEWS
@@@ -268,32 -76,6 +268,35 @@@ Core and Builtin
  Library
  -------
  
++- Issue #11657: Fix sending file descriptors over 255 over a multiprocessing
++  Pipe.
++
 +- Issue #12811: tabnanny.check() now promptly closes checked files. Patch by
 +  Anthony Briggs.
 +
 +- Issue #6560: The sendmsg/recvmsg API is now exposed by the socket module
 +  when provided by the underlying platform, supporting processing of
 +  ancillary data in pure Python code. Patch by David Watson and Heiko Wundram.
 +
 +- Issue #12326: On Linux, sys.platform doesn't contain the major version
 +  anymore. It is now always 'linux', instead of 'linux2' or 'linux3' depending
 +  on the Linux version used to build Python.
 +
 +- Issue #12213: Fix a buffering bug with interleaved reads and writes that
 +  could appear on BufferedRandom streams.
 +
 +- Issue #12778: Reduce memory consumption when JSON-encoding a large
 +  container of many small objects.
 +
 +- Issue #12650: Fix a race condition where a subprocess.Popen could leak
 +  resources (FD/zombie) when killed at the wrong time.
 +
 +- Issue #12744: Fix inefficient representation of integers between 2**31 and
 +  2**63 on systems with a 64-bit C "long".
 +
 +- Issue #12646: Add an 'eof' attribute to zlib.Decompress, to make it easier to
 +  detect truncated input streams.
 +
  - Issue #11513: Fix exception handling ``tarfile.TarFile.gzopen()`` when
    the file cannot be opened.