From 9d36fd2acbe618796ecfcb1dd6cb04e9d0f44c8f Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Fri, 3 Jul 2009 20:48:31 +0000 Subject: [PATCH] Adds the select.PIPE_BUF attribute to expose the system constant. --- Doc/library/select.rst | 9 +++++++++ Modules/selectmodule.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/Doc/library/select.rst b/Doc/library/select.rst index 351ecfa2be5..469fbac71e3 100644 --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -100,6 +100,15 @@ The module defines the following: library, and does not handle file descriptors that don't originate from WinSock. +.. attribute:: select.PIPE_BUF + + 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. + + .. versionadded:: 2.7 + .. _epoll-objects: diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 2638bdc7b6d..a4058127017 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -1746,6 +1746,8 @@ initselect(void) Py_INCREF(SelectError); PyModule_AddObject(m, "error", SelectError); + PyModule_AddIntConstant(m, "PIPE_BUF", PIPE_BUF); + #if defined(HAVE_POLL) #ifdef __APPLE__ if (select_have_broken_poll()) {