diff options
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/aepack.rst | 4 | ||||
-rw-r--r-- | Doc/library/cookielib.rst | 2 | ||||
-rw-r--r-- | Doc/library/datetime.rst | 53 | ||||
-rw-r--r-- | Doc/library/dis.rst | 27 | ||||
-rw-r--r-- | Doc/library/email.message.rst | 2 | ||||
-rw-r--r-- | Doc/library/heapq.rst | 7 | ||||
-rw-r--r-- | Doc/library/imaplib.rst | 2 | ||||
-rw-r--r-- | Doc/library/mailbox.rst | 12 | ||||
-rw-r--r-- | Doc/library/mimetools.rst | 2 | ||||
-rw-r--r-- | Doc/library/mimetypes.rst | 2 | ||||
-rw-r--r-- | Doc/library/operator.rst | 52 | ||||
-rw-r--r-- | Doc/library/os.rst | 6 | ||||
-rw-r--r-- | Doc/library/othergui.rst | 14 | ||||
-rw-r--r-- | Doc/library/pdb.rst | 7 | ||||
-rw-r--r-- | Doc/library/py_compile.rst | 7 | ||||
-rw-r--r-- | Doc/library/re.rst | 14 | ||||
-rw-r--r-- | Doc/library/robotparser.rst | 5 | ||||
-rw-r--r-- | Doc/library/socketserver.rst | 32 | ||||
-rw-r--r-- | Doc/library/struct.rst | 6 | ||||
-rw-r--r-- | Doc/library/threading.rst | 23 | ||||
-rw-r--r-- | Doc/library/tix.rst | 2 | ||||
-rw-r--r-- | Doc/library/tkinter.rst | 2 | ||||
-rw-r--r-- | Doc/library/unittest.rst | 2 | ||||
-rw-r--r-- | Doc/library/urllib.rst | 4 | ||||
-rw-r--r-- | Doc/library/xml.dom.rst | 2 | ||||
-rw-r--r-- | Doc/library/zipfile.rst | 6 | ||||
-rw-r--r-- | Doc/library/zipimport.rst | 2 |
27 files changed, 201 insertions, 98 deletions
diff --git a/Doc/library/aepack.rst b/Doc/library/aepack.rst index daaa9b2..d8aef6b 100644 --- a/Doc/library/aepack.rst +++ b/Doc/library/aepack.rst @@ -84,7 +84,3 @@ The :mod:`aepack` module defines the following functions: Module :mod:`aetypes` Python definitions of codes for Apple Event descriptor types. - - `Inside Macintosh: Interapplication Communication <http://developer.apple.com/techpubs/mac/IAC/IAC-2.html>`_ - Information about inter-process communications on the Macintosh. - diff --git a/Doc/library/cookielib.rst b/Doc/library/cookielib.rst index bc14051..f6008f1 100644 --- a/Doc/library/cookielib.rst +++ b/Doc/library/cookielib.rst @@ -117,7 +117,7 @@ The following classes are provided: Extensions to this module, including a class for reading Microsoft Internet Explorer cookies on Windows. - http://www.netscape.com/newsref/std/cookie_spec.html + http://wp.netscape.com/newsref/std/cookie_spec.html The specification of the original Netscape cookie protocol. Though this is still the dominant protocol, the 'Netscape cookie protocol' implemented by all the major browsers (and :mod:`cookielib`) only bears a passing resemblance to diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index 3fad2fb..8db1cb5 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1486,9 +1486,31 @@ For :class:`time` objects, the format codes for year, month, and day should not be used, as time objects have no such values. If they're used anyway, ``1900`` is substituted for the year, and ``0`` for the month and day. -For :class:`date` objects, the format codes for hours, minutes, and seconds -should not be used, as :class:`date` objects have no such values. If they're -used anyway, ``0`` is substituted for them. +For :class:`date` objects, the format codes for hours, minutes, seconds, and +microseconds should not be used, as :class:`date` objects have no such +values. If they're used anyway, ``0`` is substituted for them. + +:class:`time` and :class:`datetime` objects support a ``%f`` format code +which expands to the number of microseconds in the object, zero-padded on +the left to six places. + +.. versionadded:: 2.6 + +For a naive object, the ``%z`` and ``%Z`` format codes are replaced by empty +strings. + +For an aware object: + +``%z`` + :meth:`utcoffset` is transformed into a 5-character string of the form +HHMM or + -HHMM, where HH is a 2-digit string giving the number of UTC offset hours, and + MM is a 2-digit string giving the number of UTC offset minutes. For example, if + :meth:`utcoffset` returns ``timedelta(hours=-3, minutes=-30)``, ``%z`` is + replaced with the string ``'-0330'``. + +``%Z`` + If :meth:`tzname` returns ``None``, ``%Z`` is replaced by an empty string. + Otherwise ``%Z`` is replaced by the returned value, which must be a string. The full set of format codes supported varies across platforms, because Python calls the platform C library's :func:`strftime` function, and platform @@ -1521,6 +1543,10 @@ platforms. Regardless of platform, years before 1900 cannot be used. | ``%d`` | Day of the month as a decimal | | | | number [01,31]. | | +-----------+--------------------------------+-------+ +| ``%f`` | Microsecond as a decimal | \(1) | +| | number [0,999999], zero-padded | | +| | on the left | | ++-----------+--------------------------------+-------+ | ``%H`` | Hour (24-hour clock) as a | | | | decimal number [00,23]. | | +-----------+--------------------------------+-------+ @@ -1536,13 +1562,13 @@ platforms. Regardless of platform, years before 1900 cannot be used. | ``%M`` | Minute as a decimal number | | | | [00,59]. | | +-----------+--------------------------------+-------+ -| ``%p`` | Locale's equivalent of either | \(1) | +| ``%p`` | Locale's equivalent of either | \(2) | | | AM or PM. | | +-----------+--------------------------------+-------+ -| ``%S`` | Second as a decimal number | \(2) | +| ``%S`` | Second as a decimal number | \(3) | | | [00,61]. | | +-----------+--------------------------------+-------+ -| ``%U`` | Week number of the year | \(3) | +| ``%U`` | Week number of the year | \(4) | | | (Sunday as the first day of | | | | the week) as a decimal number | | | | [00,53]. All days in a new | | @@ -1553,7 +1579,7 @@ platforms. Regardless of platform, years before 1900 cannot be used. | ``%w`` | Weekday as a decimal number | | | | [0(Sunday),6]. | | +-----------+--------------------------------+-------+ -| ``%W`` | Week number of the year | \(3) | +| ``%W`` | Week number of the year | \(4) | | | (Monday as the first day of | | | | the week) as a decimal number | | | | [00,53]. All days in a new | | @@ -1573,7 +1599,7 @@ platforms. Regardless of platform, years before 1900 cannot be used. | ``%Y`` | Year with century as a decimal | | | | number. | | +-----------+--------------------------------+-------+ -| ``%z`` | UTC offset in the form +HHMM | \(4) | +| ``%z`` | UTC offset in the form +HHMM | \(5) | | | or -HHMM (empty string if the | | | | the object is naive). | | +-----------+--------------------------------+-------+ @@ -1586,17 +1612,22 @@ platforms. Regardless of platform, years before 1900 cannot be used. Notes: (1) + When used with the :func:`strptime` function, the ``%f`` directive + accepts from one to six digits and zero pads on the right. ``%f`` is + an extension to the set of format characters in the C standard. + +(2) When used with the :func:`strptime` function, the ``%p`` directive only affects the output hour field if the ``%I`` directive is used to parse the hour. -(2) +(3) The range really is ``0`` to ``61``; this accounts for leap seconds and the (very rare) double leap seconds. -(3) +(4) When used with the :func:`strptime` function, ``%U`` and ``%W`` are only used in calculations when the day of the week and the year are specified. -(4) +(5) For example, if :meth:`utcoffset` returns ``timedelta(hours=-3, minutes=-30)``, ``%z`` is replaced with the string ``'-0330'``. diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 5b09847..3af9250 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -412,21 +412,24 @@ Miscellaneous opcodes. .. opcode:: WITH_CLEANUP () - Cleans up the stack when a :keyword:`with` statement block exits. TOS is the - context manager's :meth:`__exit__` bound method. Below that are 1--3 values - indicating how/why the finally clause was entered: + Cleans up the stack when a :keyword:`with` statement block exits. On top of + the stack are 1--3 values indicating how/why the finally clause was entered: - * SECOND = ``None`` - * (SECOND, THIRD) = (``WHY_{RETURN,CONTINUE}``), retval - * SECOND = ``WHY_*``; no retval below it - * (SECOND, THIRD, FOURTH) = exc_info() + * TOP = ``None`` + * (TOP, SECOND) = (``WHY_{RETURN,CONTINUE}``), retval + * TOP = ``WHY_*``; no retval below it + * (TOP, SECOND, THIRD) = exc_info() - In the last case, ``TOS(SECOND, THIRD, FOURTH)`` is called, otherwise - ``TOS(None, None, None)``. + Under them is EXIT, the context manager's :meth:`__exit__` bound method. - In addition, if the stack represents an exception, *and* the function call - returns a 'true' value, this information is "zapped", to prevent ``END_FINALLY`` - from re-raising the exception. (But non-local gotos should still be resumed.) + In the last case, ``EXIT(TOP, SECOND, THIRD)`` is called, otherwise + ``EXIT(None, None, None)``. + + EXIT is removed from the stack, leaving the values above it in the same + order. In addition, if the stack represents an exception, *and* the function + call returns a 'true' value, this information is "zapped", to prevent + ``END_FINALLY`` from re-raising the exception. (But non-local gotos should + still be resumed.) .. XXX explain the WHY stuff! diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst index 7f3cf6f..2b0df34 100644 --- a/Doc/library/email.message.rst +++ b/Doc/library/email.message.rst @@ -38,7 +38,7 @@ Here are the methods of the :class:`Message` class: .. method:: Message.as_string([unixfrom]) - Return the entire message flatten as a string. When optional *unixfrom* is + Return the entire message flattened as a string. When optional *unixfrom* is ``True``, the envelope header is included in the returned string. *unixfrom* defaults to ``False``. diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst index f26d29b..1530144 100644 --- a/Doc/library/heapq.rst +++ b/Doc/library/heapq.rst @@ -43,6 +43,13 @@ The following functions are provided: Pop and return the smallest item from the *heap*, maintaining the heap invariant. If the heap is empty, :exc:`IndexError` is raised. +.. function:: heappushpop(heap, item) + + Push *item* on the heap, then pop and return the smallest item from the + *heap*. The combined action runs more efficiently than :func:`heappush` + followed by a separate call to :func:`heappop`. + + .. versionadded:: 2.6 .. function:: heapify(x) diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst index 10f3a42..01249b2 100644 --- a/Doc/library/imaplib.rst +++ b/Doc/library/imaplib.rst @@ -116,7 +116,7 @@ example of usage. Documents describing the protocol, and sources and binaries for servers implementing it, can all be found at the University of Washington's *IMAP - Information Center* (http://www.cac.washington.edu/imap/). + Information Center* (http://www.washington.edu/imap/). .. _imap4-objects: diff --git a/Doc/library/mailbox.rst b/Doc/library/mailbox.rst index e05f44a..b5773f4 100644 --- a/Doc/library/mailbox.rst +++ b/Doc/library/mailbox.rst @@ -403,7 +403,7 @@ remarks: Notes on Maildir by its inventor. Includes an updated name-creation scheme and details on "info" semantics. - `maildir man page from Courier <http://www.courier-mta.org/?maildir.html>`_ + `maildir man page from Courier <http://www.courier-mta.org/maildir.html>`_ Another specification of the format. Describes a common extension for supporting folders. @@ -460,7 +460,7 @@ remarks: `mbox man page from tin <http://www.tin.org/bin/man.cgi?section=5&topic=mbox>`_ Another specification of the format, with details on locking. - `Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad <http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/content-length.html>`_ + `Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad <http://www.jwz.org/doc/content-length.html>`_ An argument for using the original mbox format rather than a variation. `"mbox" is a family of several mutually incompatible mailbox formats <http://homepages.tesco.net./~J.deBoynePollard/FGA/mail-mbox-formats.html>`_ @@ -664,7 +664,7 @@ remarks: `Format of Version 5 Babyl Files <http://quimby.gnus.org/notes/BABYL>`_ A specification of the Babyl format. - `Reading Mail with Rmail <http://www.gnu.org/software/emacs/manual/html_node/Rmail.html>`_ + `Reading Mail with Rmail <http://www.gnu.org/software/emacs/manual/html_node/emacs/Rmail.html>`_ The Rmail manual, with some information on Babyl semantics. @@ -1540,10 +1540,6 @@ counterparts are as follows: :class:`UnixMailbox` except that individual messages are separated by only ``From`` lines. - For more information, see `Configuring Netscape Mail on Unix: Why the - Content-Length Format is Bad - <http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/content-length.html>`_. - .. class:: PortableUnixMailbox(fp[, factory]) @@ -1629,7 +1625,7 @@ format-specific information that can be converted:: destination = mailbox.MH('~/Mail') destination.lock() for message in mailbox.Babyl('~/RMAIL'): - destination.add(MHMessage(message)) + destination.add(mailbox.MHMessage(message)) destination.flush() destination.unlock() diff --git a/Doc/library/mimetools.rst b/Doc/library/mimetools.rst index 8da385e..7813867 100644 --- a/Doc/library/mimetools.rst +++ b/Doc/library/mimetools.rst @@ -73,7 +73,7 @@ It defines the following items: Module :mod:`multifile` Support for reading files which contain distinct parts, such as MIME data. - http://www.cs.uu.nl/wais/html/na-dir/mail/mime-faq/.html + http://faqs.cs.uu.nl/na-dir/mail/mime-faq/.html The MIME Frequently Asked Questions document. For an overview of MIME, see the answer to question 1.1 in Part 1 of this document. diff --git a/Doc/library/mimetypes.rst b/Doc/library/mimetypes.rst index f59cd82..cc11dfc 100644 --- a/Doc/library/mimetypes.rst +++ b/Doc/library/mimetypes.rst @@ -41,7 +41,7 @@ the information :func:`init` sets up. Optional *strict* is a flag specifying whether the list of known MIME types is limited to only the official types `registered with IANA - <http://www.isi.edu/in-notes/iana/assignments/media-types>`_ are recognized. + <http://www.iana.org/assignments/media-types/>`_ are recognized. When *strict* is true (the default), only the IANA types are supported; when *strict* is false, some additional non-standard but commonly used MIME types are also recognized. diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index ca056ab..590098b 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -428,21 +428,43 @@ expect a function argument. .. function:: itemgetter(item[, args...]) - Return a callable object that fetches *item* from its operand. If more than one - item is requested, returns a tuple of items. After, ``f=itemgetter(2)``, the - call ``f(b)`` returns ``b[2]``. After, ``f=itemgetter(2,5,3)``, the call - ``f(b)`` returns ``(b[2], b[5], b[3])``. - - -Examples:: - - >>> from operator import itemgetter - >>> inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)] - >>> getcount = itemgetter(1) - >>> map(getcount, inventory) - [3, 2, 5, 1] - >>> sorted(inventory, key=getcount) - [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)] + Return a callable object that fetches *item* from its operand using the + operand's :meth:`__getitem__` method. If multiple items are specified, + returns a tuple of lookup values. Equivalent to:: + + def itemgetter(*items): + if len(items) == 1: + item = items[0] + def g(obj): + return obj[item] + else: + def g(obj): + return tuple(obj[item] for item in items) + return g + + The items can be any type accepted by the operand's :meth:`__getitem__` + method. Dictionaries accept any hashable value. Lists, tuples, and + strings accept an index or a slice:: + + >>> itemgetter(1)('ABCDEFG') + 'B' + >>> itemgetter(1,3,5)('ABCDEFG') + ('B', 'D', 'F') + >>> itemgetter(slice(2,None))('ABCDEFG') + 'CDEFG' + + .. versionadded:: 2.4 + + Example of using :func:`itemgetter` to retrieve specific fields from a + tuple record:: + + >>> from operator import itemgetter + >>> inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)] + >>> getcount = itemgetter(1) + >>> map(getcount, inventory) + [3, 2, 5, 1] + >>> sorted(inventory, key=getcount) + [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)] .. function:: methodcaller(name[, args...]) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index ef81304..ec35c3b 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1387,7 +1387,8 @@ written in Python, such as a mail server's external command delivery program. .. function:: fork() Fork a child process. Return ``0`` in the child and the child's process id in the - parent. Availability: Macintosh, Unix. + parent. If an error occurs :exc:`OSError` is raised. + Availability: Macintosh, Unix. .. function:: forkpty() @@ -1396,7 +1397,8 @@ written in Python, such as a mail server's external command delivery program. terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, the new child's process id in the parent, and *fd* is the file descriptor of the master end of the pseudo-terminal. For a more portable approach, use the - :mod:`pty` module. Availability: Macintosh, some flavors of Unix. + :mod:`pty` module. If an error occurs :exc:`OSError` is raised. + Availability: Macintosh, some flavors of Unix. .. function:: kill(pid, sig) diff --git a/Doc/library/othergui.rst b/Doc/library/othergui.rst index b36568d..ab4efdb 100644 --- a/Doc/library/othergui.rst +++ b/Doc/library/othergui.rst @@ -36,14 +36,12 @@ also available for Python: `PyGTK <http://www.pygtk.org/>`_ is a set of bindings for the `GTK <http://www.gtk.org/>`_ widget set. It - provides an object oriented interface that is slightly higher level than the C - one. It comes with many more widgets than Tkinter provides, and - has good Python-specific reference documentation. There are also `bindings - <http://www.daa.com.au/~james/gnome/>`_ to `GNOME <http://www.gnome.org>`_. - One well known PyGTK application is - `PythonCAD <http://www.pythoncad.org/>`_. An - online `tutorial <http://www.pygtk.org/pygtk2tutorial/index.html>`_ is - available. + provides an object oriented interface that is slightly higher level than + the C one. It comes with many more widgets than Tkinter provides, and has + good Python-specific reference documentation. There are also bindings to + `GNOME <http://www.gnome.org>`_. One well known PyGTK application is + `PythonCAD <http://www.pythoncad.org/>`_. An online `tutorial + <http://www.pygtk.org/pygtk2tutorial/index.html>`_ is available. `PyQt <http://www.riverbankcomputing.co.uk/pyqt/index.php>`_ PyQt is a :program:`sip`\ -wrapped binding to the Qt toolkit. Qt is an diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 017fbd6..df8cf6c 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -103,9 +103,12 @@ slightly different way: being debugged (e.g. when an assertion fails). -.. function:: post_mortem(traceback) +.. function:: post_mortem([traceback]) - Enter post-mortem debugging of the given *traceback* object. + Enter post-mortem debugging of the given *traceback* object. If no + *traceback* is given, it uses the one of the exception that is currently + being handled (an exception must be being handled if the default is to be + used). .. function:: pm() diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst index de9a80e..77ed8cf 100644 --- a/Doc/library/py_compile.rst +++ b/Doc/library/py_compile.rst @@ -42,7 +42,12 @@ byte-code cache files in the directory containing the source code. structure to locate source files; it only compiles files named explicitly. When this module is run as a script, the :func:`main` is used to compile all the -files named on the command line. +files named on the command line. The exit status is nonzero if one of the files +could not be compiled. + +.. versionchanged:: 2.6 + + Added the nonzero exit status. .. seealso:: diff --git a/Doc/library/re.rst b/Doc/library/re.rst index c3ec777..d7eb6f6 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -539,14 +539,26 @@ form. >>> re.split('\W+', 'Words, words, words.', 1) ['Words', 'words, words.'] + If there are capturing groups in the separator and it matches at the start of + the string, the result will start with an empty string. The same holds for + the end of the string:: + + >>> re.split('(\W+)', '...words, words...') + ['', '...', 'words', ', ', 'words', '...', ''] + + That way, separator components are always found at the same relative + indices within the result list (e.g., if there's one capturing group + in the separator, the 0th, the 2nd and so forth). + Note that *split* will never split a string on an empty pattern match. - For example :: + For example:: >>> re.split('x*', 'foo') ['foo'] >>> re.split("(?m)^$", "foo\n\nbar\n") ['foo\n\nbar\n'] + .. function:: findall(pattern, string[, flags]) Return all non-overlapping matches of *pattern* in *string*, as a list of diff --git a/Doc/library/robotparser.rst b/Doc/library/robotparser.rst index 2451799..6cc7df8 100644 --- a/Doc/library/robotparser.rst +++ b/Doc/library/robotparser.rst @@ -15,9 +15,8 @@ This module provides a single class, :class:`RobotFileParser`, which answers questions about whether or not a particular user agent can fetch a URL on the -Web site that published the :file:`robots.txt` file. For more details on the -structure of :file:`robots.txt` files, see -http://www.robotstxt.org/wc/norobots.html. +Web site that published the :file:`robots.txt` file. For more details on the +structure of :file:`robots.txt` files, see http://www.robotstxt.org/orig.html. .. class:: RobotFileParser() diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst index 2c85c86..a8eb953 100644 --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -113,7 +113,8 @@ or inappropriate for the service) is to maintain an explicit table of partially finished requests and to use :func:`select` to decide which request to work on next (or whether to handle a new incoming request). This is particularly important for stream services where each client can potentially be connected for -a long time (if threads or subprocesses cannot be used). +a long time (if threads or subprocesses cannot be used). See :mod:`asyncore` for +another way to manage this. .. XXX should data and methods be intermingled, or separate? how should the distinction between class and instance variables be drawn? @@ -132,16 +133,24 @@ Server Objects .. function:: handle_request() - Process a single request. This function calls the following methods in order: - :meth:`get_request`, :meth:`verify_request`, and :meth:`process_request`. If - the user-provided :meth:`handle` method of the handler class raises an - exception, the server's :meth:`handle_error` method will be called. + Process a single request. This function calls the following methods in + order: :meth:`get_request`, :meth:`verify_request`, and + :meth:`process_request`. If the user-provided :meth:`handle` method of the + handler class raises an exception, the server's :meth:`handle_error` method + will be called. If no request is received within :attr:`self.timeout` + seconds, :meth:`handle_timeout` will be called and :meth:`handle_request` + will return. -.. function:: serve_forever() +.. function:: serve_forever(poll_interval=0.5) - Handle an infinite number of requests. This simply calls :meth:`handle_request` - inside an infinite loop. + Handle requests until an explicit :meth:`shutdown` request. Polls for + shutdown every *poll_interval* seconds. + + +.. function:: shutdown() + + Tells the :meth:`serve_forever` loop to stop and waits until it does. .. data:: address_family @@ -195,10 +204,9 @@ The server classes support the following class variables: .. 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. + Timeout duration, measured in seconds, or :const:`None` if no timeout is + desired. If :meth:`handle_request` receives no incoming requests within the + timeout period, the :meth:`handle_timeout` method is called. 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 diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index ee568e6..924cb60 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -73,7 +73,7 @@ Python values should be obvious given their types: +--------+-------------------------+--------------------+-------+ | ``B`` | :ctype:`unsigned char` | integer | | +--------+-------------------------+--------------------+-------+ -| ``t`` | :ctype:`_Bool` | bool | \(1) | +| ``?`` | :ctype:`_Bool` | bool | \(1) | +--------+-------------------------+--------------------+-------+ | ``h`` | :ctype:`short` | integer | | +--------+-------------------------+--------------------+-------+ @@ -106,7 +106,7 @@ Python values should be obvious given their types: Notes: (1) - The ``'t'`` conversion code corresponds to the :ctype:`_Bool` type defined by + The ``'?'`` conversion code corresponds to the :ctype:`_Bool` type defined by C99. If this type is not available, it is simulated using a :ctype:`char`. In standard mode, it is always represented by one byte. @@ -141,7 +141,7 @@ bytes, but that the string returned can never contain more than 255 characters. -For the ``'t'`` format character, the return value is either :const:`True` or +For the ``'?'`` format character, the return value is either :const:`True` or :const:`False`. When packing, the truth value of the argument object is used. Either 0 or 1 in the native or standard bool representation will be packed, and any non-zero value will be True when unpacking. diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 6f3e95b..3f62e69 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -724,3 +724,26 @@ Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, with some_rlock: print("some_rlock is locked while this executes") + +.. _threaded-imports: + +Importing in threaded code +-------------------------- + +While the import machinery is thread safe, there are two key +restrictions on threaded imports due to inherent limitations in the way +that thread safety is provided: + +* Firstly, other than in the main module, an import should not have the + side effect of spawning a new thread and then waiting for that thread in + any way. Failing to abide by this restriction can lead to a deadlock if + the spawned thread directly or indirectly attempts to import a module. +* Secondly, all import attempts must be completed before the interpreter + starts shutting itself down. This can be most easily achieved by only + performing imports from non-daemon threads created through the threading + module. Daemon threads and threads created directly with the thread + module will require some other form of synchronization to ensure they do + not attempt imports after system shutdown has commenced. Failure to + abide by this restriction will lead to intermittent exceptions and + crashes during interpreter shutdown (as the late imports attempt to + access machinery which is no longer in a valid state). diff --git a/Doc/library/tix.rst b/Doc/library/tix.rst index f4bb20f..ad14cc4 100644 --- a/Doc/library/tix.rst +++ b/Doc/library/tix.rst @@ -35,7 +35,7 @@ special needs of your application and users. `Tix Programming Guide <http://tix.sourceforge.net/dist/current/docs/tix-book/tix.book.html>`_ On-line version of the programmer's reference material. - `Tix Development Applications <http://tix.sourceforge.net/Tide/>`_ + `Tix Development Applications <http://tix.sourceforge.net/Tixapps/src/Tide.html>`_ Tix applications for development of Tix and Tkinter programs. Tide applications work under Tk or Tkinter, and include :program:`TixInspect`, an inspector to remotely modify and debug Tix/Tk/Tkinter applications. diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index 4d5cce8..e03d959 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -21,7 +21,7 @@ of Python; it is maintained at ActiveState.) `An Introduction to Tkinter <http://www.pythonware.com/library/an-introduction-to-tkinter.htm>`_ Fredrik Lundh's on-line reference material. - `Tkinter reference: a GUI for Python <http://www.nmt.edu/tcc/help/pubs/lang.html>`_ + `Tkinter reference: a GUI for Python <http://infohost.nmt.edu/tcc/help/pubs/lang.html>`_ On-line reference material. `Tkinter for JPython <http://jtkinter.sourceforge.net>`_ diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 7703ad9..8188e70 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -562,6 +562,7 @@ failures. .. method:: TestCase.assert_(expr[, msg]) TestCase.failUnless(expr[, msg]) + TestCase.assertTrue(expr[, msg]) Signal a test failure if *expr* is false; the explanation for the error will be *msg* if given, otherwise it will be :const:`None`. @@ -618,6 +619,7 @@ failures. .. method:: TestCase.failIf(expr[, msg]) + TestCase.assertFalse(expr[, msg]) The inverse of the :meth:`failUnless` method is the :meth:`failIf` method. This signals a test failure if *expr* is true, with *msg* or :const:`None` for the diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst index 63fb53e..e976cb1 100644 --- a/Doc/library/urllib.rst +++ b/Doc/library/urllib.rst @@ -107,10 +107,6 @@ High-level interface filehandle = urllib.urlopen(some_url, proxies=None) filehandle = urllib.urlopen(some_url) - The :func:`urlopen` function does not support explicit proxy specification. If - you need to override environmental proxy settings, use :class:`URLopener`, or a - subclass such as :class:`FancyURLopener`. - Proxies which require authentication for use are not currently supported; this is considered an implementation limitation. diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst index 768c9c8..2a0c788 100644 --- a/Doc/library/xml.dom.rst +++ b/Doc/library/xml.dom.rst @@ -506,7 +506,7 @@ Document Objects ^^^^^^^^^^^^^^^^ A :class:`Document` represents an entire XML document, including its constituent -elements, attributes, processing instructions, comments etc. Remeber that it +elements, attributes, processing instructions, comments etc. Remember that it inherits properties from :class:`Node`. diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index c90f946..b1c9038 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -11,7 +11,7 @@ The ZIP file format is a common archive and compression standard. This module provides tools to create, read, write, append, and list a ZIP file. Any advanced use of this module will require an understanding of the format, as defined in `PKZIP Application Note -<http://www.pkware.com/business_and_developers/developer/appnote/>`_. +<http://www.pkware.com/documents/casestudies/APPNOTE.TXT>`_. This module does not currently handle multi-disk ZIP files, or ZIP files which have appended comments (although it correctly handles comments @@ -81,7 +81,7 @@ The module defines the following items: .. seealso:: - `PKZIP Application Note <http://www.pkware.com/business_and_developers/developer/appnote/>`_ + `PKZIP Application Note <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>`_ Documentation on the ZIP file format by Phil Katz, the creator of the format and algorithms used. @@ -361,7 +361,7 @@ Instances have the following attributes: .. attribute:: ZipInfo.extra Expansion field data. The `PKZIP Application Note - <http://www.pkware.com/business_and_developers/developer/appnote/>`_ contains + <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>`_ contains some comments on the internal structure of the data contained in this string. diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst index ed9c631..f8d0b1d 100644 --- a/Doc/library/zipimport.rst +++ b/Doc/library/zipimport.rst @@ -29,7 +29,7 @@ doesn't contain :file:`.pyc` files, importing may be rather slow. .. seealso:: - `PKZIP Application Note <http://www.pkware.com/business_and_developers/developer/appnote/>`_ + `PKZIP Application Note <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>`_ Documentation on the ZIP file format by Phil Katz, the creator of the format and algorithms used. |