[Python-checkins] cpython (merge 3.3 -> default): Merge #17409: Document RLIM_INFINITY and use it to clarify the setrlimit docs.

r.david.murray python-checkins at python.org
Sat Apr 20 19:41:01 CEST 2013


http://hg.python.org/cpython/rev/f1d95b0ab66e
changeset:   83468:f1d95b0ab66e
parent:      83465:97834382c6cc
parent:      83466:186f6bb3e46a
user:        R David Murray <rdmurray at bitdance.com>
date:        Sat Apr 20 13:40:33 2013 -0400
summary:
  Merge #17409: Document RLIM_INFINITY and use it to clarify the setrlimit docs.

files:
  Doc/library/resource.rst |  21 +++++++++++++++++----
  1 files changed, 17 insertions(+), 4 deletions(-)


diff --git a/Doc/library/resource.rst b/Doc/library/resource.rst
--- a/Doc/library/resource.rst
+++ b/Doc/library/resource.rst
@@ -43,6 +43,11 @@
 this module for those platforms.
 
 
+.. data:: RLIM_INFINITY
+
+   Constant used to represent the the limit for an unlimited resource.
+
+
 .. function:: getrlimit(resource)
 
    Returns a tuple ``(soft, hard)`` with the current soft and hard limits of
@@ -54,12 +59,20 @@
 
    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.
+   :data:`~resource.RLIM_INFINITY` can be used to request a limit that is
+   unlimited.
 
    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
-   (unless the process has an effective UID of super-user).  Can also raise
-   :exc:`error` if the underlying system call fails.
+   limit exceeds the hard limit, or if a process tries to raise its hard limit.
+   Specifying a limit of :data:`~resource.RLIM_INFINITY` when the hard or
+   system limit for that resource is not unlimited will result in a
+   :exc:`ValueError`.  A process with the effective UID of super-user can
+   request any valid limit value, including unlimited, but :exc:`ValueError`
+   will still be raised if the requested limit exceeds the system imposed
+   limit.
+
+   ``setrlimit`` may also raise :exc:`error` if the underlying system call
+   fails.
 
 These symbols define resources whose consumption can be controlled using the
 :func:`setrlimit` and :func:`getrlimit` functions described below. The values of

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list