summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/mmap.rst17
-rw-r--r--Doc/library/socketserver.rst16
-rw-r--r--Doc/library/threading.rst13
-rw-r--r--Doc/library/trace.rst8
-rw-r--r--Doc/whatsnew/2.6.rst14
5 files changed, 54 insertions, 14 deletions
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst
index 9e552fd..37391d0 100644
--- a/Doc/library/mmap.rst
+++ b/Doc/library/mmap.rst
@@ -137,11 +137,12 @@ Memory-mapped file objects support the following methods:
an exception being raised.
-.. method:: mmap.find(string[, start])
+.. method:: mmap.find(string[, start[, end]])
- Returns the lowest index in the object where the substring *string* is found.
- Returns ``-1`` on failure. *start* is the index at which the search begins, and
- defaults to zero.
+ Returns the lowest index in the object where the substring *string* is found,
+ such that *string* is contained in the range [*start*, *end*]. Optional
+ arguments *start* and *end* are interpreted as in slice notation.
+ Returns ``-1`` on failure.
.. method:: mmap.flush([offset, size])
@@ -186,6 +187,14 @@ Memory-mapped file objects support the following methods:
:exc:`TypeError` exception.
+.. method:: mmap.rfind(string[, start[, end]])
+
+ Returns the highest index in the object where the substring *string* is
+ found, such that *string* is contained in the range [*start*,
+ *end*]. Optional arguments *start* and *end* are interpreted as in slice
+ notation. Returns ``-1`` on failure.
+
+
.. method:: mmap.seek(pos[, whence])
Set the file's current position. *whence* argument is optional and defaults to
diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst
index c900ea7..2c85c86 100644
--- a/Doc/library/socketserver.rst
+++ b/Doc/library/socketserver.rst
@@ -44,7 +44,7 @@ to behave autonomously; the default is :const:`False`, meaning that Python will
not exit until all threads created by :class:`ThreadingMixIn` have exited.
Server classes have the same external methods and attributes, no matter what
-network protocol they use:
+network protocol they use.
Server Creation Notes
@@ -193,6 +193,13 @@ The server classes support the following class variables:
The type of socket used by the server; :const:`socket.SOCK_STREAM` and
:const:`socket.SOCK_DGRAM` are two possible values.
+.. data:: timeout
+
+ Timeout duration, measured in seconds, or :const:`None` if no timeout is desired.
+ If no incoming requests are received within the timeout period,
+ the :meth:`handle_timeout` method is called and then the server resumes waiting for
+ requests.
+
There are various server methods that can be overridden by subclasses of base
server classes like :class:`TCPServer`; these methods aren't useful to external
users of the server object.
@@ -220,6 +227,13 @@ users of the server object.
method raises an exception. The default action is to print the traceback to
standard output and continue handling further requests.
+.. function:: handle_timeout()
+
+ This function is called when the :attr:`timeout` attribute has been set to a
+ value other than :const:`None` and the timeout period has passed with no
+ requests being received. The default action for forking servers is
+ to collect the status of any child processes that have exited, while
+ in threading servers this method does nothing.
.. function:: process_request(request, client_address)
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
index c015372..6f3e95b 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -615,18 +615,19 @@ impossible to detect the termination of alien threads.
When the *timeout* argument is present and not ``None``, it should be a floating
point number specifying a timeout for the operation in seconds (or fractions
- thereof). As :meth:`join` always returns ``None``, you must call
- :meth:`isAlive` to decide whether a timeout happened.
+ thereof). As :meth:`join` always returns ``None``, you must call :meth:`isAlive`
+ after :meth:`join` to decide whether a timeout happened -- if the thread is
+ still alive, the :meth:`join` call timed out.
When the *timeout* argument is not present or ``None``, the operation will block
until the thread terminates.
A thread can be :meth:`join`\ ed many times.
- :meth:`join` may throw a :exc:`RuntimeError`, if an attempt is made to join the
- current thread as that would cause a deadlock. It is also an error to
- :meth:`join` a thread before it has been started and attempts to do so raises
- same exception.
+ :meth:`join` raises a :exc:`RuntimeError` if an attempt is made to join
+ the current thread as that would cause a deadlock. It is also an error to
+ :meth:`join` a thread before it has been started and attempts to do so
+ raises the same exception.
.. method:: Thread.getName()
diff --git a/Doc/library/trace.rst b/Doc/library/trace.rst
index 91cf1a4..9d0c0c4 100644
--- a/Doc/library/trace.rst
+++ b/Doc/library/trace.rst
@@ -64,12 +64,14 @@ The following command-line arguments are supported:
stdout for each file processed.
:option:`--ignore-module`
- Ignore the named module and its submodules (if it is a package). May be given
+ Accepts comma separated list of module names. Ignore each of the named
+ module and its submodules (if it is a package). May be given
multiple times.
:option:`--ignore-dir`
- Ignore all modules and packages in the named directory and subdirectories. May
- be given multiple times.
+ Ignore all modules and packages in the named directory and subdirectories
+ (multiple directories can be joined by os.pathsep). May be given multiple
+ times.
.. _trace-api:
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 46922a4..e386b36 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -960,6 +960,13 @@ complete list of changes, or look through the CVS logs for all the details.
.. Patch #1490190
+* :class:`mmap` objects now have a :meth:`rfind` method that finds
+ a substring, beginning at the end of the string and searching
+ backwards. The :meth:`find` method
+ also gained a *end* parameter containing the index at which to stop
+ the forward search.
+ (Contributed by John Lenton.)
+
* The :mod:`new` module has been removed from Python 3.0.
Importing it therefore
triggers a warning message when Python is running in 3.0-warning
@@ -1102,6 +1109,13 @@ complete list of changes, or look through the CVS logs for all the details.
(Contributed by Alberto Bertogli.)
.. Patch #1646
+
+* The base classes in the :mod:`SocketServer` module now support
+ calling a :meth:`handle_timeout` method after a span of inactivity
+ specified by the server's :attr:`timeout` attribute. (Contributed
+ by Michael Pomraning.)
+
+ .. Patch #742598
* A new variable in the :mod:`sys` module,
:attr:`float_info`, is an object