From d4ffe186fa64e707e8d3c1053d9ec8363e40c77a Mon Sep 17 00:00:00 2001 From: Paul Price Date: Thu, 21 Mar 2013 11:38:00 -0400 Subject: [PATCH] Docs: clarify use of -1 for resource.setrlimit (Issue17409) Passing a limit of -1 to resource.setrlimit does not mean "the maximum possible upper limit", but means RLIM_INFINITY, or "unlimited" in bash's 'ulimit' command. Its use with RLIMIT_NOFILE is therefore wrong in general. Signed-off-by: Paul Price --- Doc/library/resource.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Doc/library/resource.rst b/Doc/library/resource.rst index 03a7cb5..5ae0235 100644 --- a/Doc/library/resource.rst +++ b/Doc/library/resource.rst @@ -54,7 +54,8 @@ this module for those platforms. Sets new limits of consumption of *resource*. The *limits* argument must be a tuple ``(soft, hard)`` of two integers describing the new limits. A value of - ``-1`` can be used to specify the maximum possible upper limit. + ``-1`` can be used to specify an infinite limit; no attempt is made to temper + an infinite limit with the current user hard limit or any system limits. Raises :exc:`ValueError` if an invalid resource is specified, if the new soft limit exceeds the hard limit, or if a process tries to raise its hard limit @@ -115,7 +116,9 @@ platform. .. data:: RLIMIT_NOFILE - The maximum number of open file descriptors for the current process. + The maximum number of open file descriptors for the current process. Note + that, due to inherent system limitations, in general it is impossible to + specify an infinite limit for this resource with :func:`setrlimit`. .. data:: RLIMIT_OFILE -- 1.8.0.2