]> granicus.if.org Git - python/commitdiff
Merged revisions 73916 via svnmerge from
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Thu, 9 Jul 2009 22:44:11 +0000 (22:44 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Thu, 9 Jul 2009 22:44:11 +0000 (22:44 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73916 | amaury.forgeotdarc | 2009-07-10 00:37:22 +0200 (ven., 10 juil. 2009) | 5 lines

  #6416: Fix compilation of the select module on Windows, as well as test_subprocess:
  PIPE_BUF is not defined on Windows, and probably has no meaning there.

  Anyway the subprocess module uses another way to perform non-blocking reads (with a thread)
........

Doc/library/select.rst
Lib/subprocess.py
Lib/test/test_subprocess.py
Modules/selectmodule.c

index bffb9cba7581efb8c2d7e2082cd38126cfe53b06..eea442b5d7cb7e73624ca726d982e6061bbc5b5c 100644 (file)
@@ -99,7 +99,7 @@ The module defines the following:
    Files reported as ready for writing by :func:`select`, :func:`poll` or
    similar interfaces in this module are guaranteed to not block on a write
    of up to :const:`PIPE_BUF` bytes.
-   This value is guaranteed by POSIX to be at least 512.
+   This value is guaranteed by POSIX to be at least 512.  Availability: Unix.
 
    .. versionadded:: 2.7
 
index f7361e1559e5529bf986bed23e79592320a9a1d1..2e7864c77fd370f67936be8d333fd5fb02958c6e 100644 (file)
@@ -376,6 +376,12 @@ else:
     import fcntl
     import pickle
 
+    # When select or poll has indicated that the file is writable,
+    # we can write up to _PIPE_BUF bytes without risk of blocking.
+    # POSIX defines PIPE_BUF as >= 512.
+    _PIPE_BUF = getattr(select, 'PIPE_BUF', 512)
+
+
 __all__ = ["Popen", "PIPE", "STDOUT", "call", "check_call", "getstatusoutput",
            "getoutput", "check_output", "CalledProcessError"]
 
@@ -384,11 +390,6 @@ try:
 except:
     MAXFD = 256
 
-# When select or poll has indicated that the file is writable,
-# we can write up to _PIPE_BUF bytes without risk of blocking.
-# POSIX defines PIPE_BUF as >= 512.
-_PIPE_BUF = getattr(select, 'PIPE_BUF', 512)
-
 _active = []
 
 def _cleanup():
index f2a396cd10fbb87c7c12e7556492880e916fc14a..265859a21d9065ee2489f09df7109b879c87f531 100644 (file)
@@ -801,7 +801,7 @@ class CommandTests(unittest.TestCase):
 
 unit_tests = [ProcessTestCase, CommandTests]
 
-if subprocess._has_poll:
+if getattr(subprocess, '_has_poll', False):
     class ProcessTestCaseNoPoll(ProcessTestCase):
         def setUp(self):
             subprocess._has_poll = False
index 085537513b2c26949508f151f9270716aad86d01..d40e8b580ed1e16bc3a22e553c4dda903b68948d 100644 (file)
@@ -1764,7 +1764,9 @@ PyInit_select(void)
        Py_INCREF(SelectError);
        PyModule_AddObject(m, "error", SelectError);
 
+#ifdef PIPE_BUF
        PyModule_AddIntConstant(m, "PIPE_BUF", PIPE_BUF);
+#endif
 
 #if defined(HAVE_POLL)
 #ifdef __APPLE__