This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients neologix, pitrou, vstinner
Date 2011-05-27.16:02:24
SpamBayes Score 3.9492838e-07
Marked as misclassified No
Message-id <1306512145.22.0.117115529403.issue12196@psf.upfronthosting.co.za>
In-reply-to
Content
+# A constant likely larger than the underlying OS pipe buffer size.
+# Windows limit seems to be around 512B, and most Unix kernels have a 64K pipe
+# buffer size: take 1MB to be sure.
+PIPE_MAX_SIZE = 1024 * 1024

Hum, I am not sure that the comment is correct. If I understood correctly the usage of this constant: write PIPE_MAX_SIZE into a blocking pipe must block because PIPE_MAX_SIZE is greater than the size of the pipe buffer. I don't know what happen if you write PIPE_MAX_SIZE into a nonblocking pipe: the beginning of the buffer is written and write() returns something lesser than PIPE_MAX_SIZE?

You may specify that if you should greater or equal to os.fpathconf(fd, "PC_PIPE_BUF").

-----------

                               'sys.stderr.write("xyz"*%d);'
-                              'sys.stdout.write(sys.stdin.read())' % pipe_buf],
+                              'sys.stdout.write(sys.stdin.read())' %
+                              support.PIPE_MAX_SIZE],

and

+        string_to_write = b"abc" * support.PIPE_MAX_SIZE

Here you use PIPE_MAX_SIZE*3, not PIPE_MAX_SIZE :-) You can use b'abc' * (support.PIPE_MAX_SIZE // 3), or b'a' * support.PIPE_MAX_SIZE.
History
Date User Action Args
2011-05-27 16:02:25vstinnersetrecipients: + vstinner, pitrou, neologix
2011-05-27 16:02:25vstinnersetmessageid: <1306512145.22.0.117115529403.issue12196@psf.upfronthosting.co.za>
2011-05-27 16:02:24vstinnerlinkissue12196 messages
2011-05-27 16:02:24vstinnercreate