Merged revisions 82798,82805,83659,83977,84015,84018,84141,84264,84326-84327,84480,84482,84484,84530-84531,84553,84619,84915-84916 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r82798 | georg.brandl | 2010-07-11 11:23:11 +0200 (So, 11 Jul 2010) | 1 line

  #6774: explain shutdown() behavior varying with platform.
........
  r82805 | georg.brandl | 2010-07-11 11:42:10 +0200 (So, 11 Jul 2010) | 1 line

  #7935: cross-reference to ast.literal_eval() from eval() docs.
........
  r83659 | georg.brandl | 2010-08-03 14:06:29 +0200 (Di, 03 Aug 2010) | 1 line

  Terminology fix: exceptions are raised, except in generator.throw().
........
  r83977 | georg.brandl | 2010-08-13 17:10:49 +0200 (Fr, 13 Aug 2010) | 1 line

  Fix copy-paste error.
........
  r84015 | georg.brandl | 2010-08-14 17:44:34 +0200 (Sa, 14 Aug 2010) | 1 line

  Add some maintainers.
........
  r84018 | georg.brandl | 2010-08-14 17:48:49 +0200 (Sa, 14 Aug 2010) | 1 line

  Typo fix.
........
  r84141 | georg.brandl | 2010-08-17 16:11:59 +0200 (Di, 17 Aug 2010) | 1 line

  Markup nits.
........
  r84264 | georg.brandl | 2010-08-22 22:23:38 +0200 (So, 22 Aug 2010) | 1 line

  #9649: fix default value description.
........
  r84326 | georg.brandl | 2010-08-26 16:30:15 +0200 (Do, 26 Aug 2010) | 1 line

  #9689: add links from overview to in-depth class API descriptions.
........
  r84327 | georg.brandl | 2010-08-26 16:30:56 +0200 (Do, 26 Aug 2010) | 1 line

  #9681: typo.
........
  r84480 | georg.brandl | 2010-09-04 00:33:27 +0200 (Sa, 04 Sep 2010) | 1 line

  More inclusive title.
........
  r84482 | georg.brandl | 2010-09-04 00:40:02 +0200 (Sa, 04 Sep 2010) | 1 line

  #9760: clarify what context expression is.
........
  r84484 | georg.brandl | 2010-09-04 00:49:27 +0200 (Sa, 04 Sep 2010) | 1 line

  Fix missing word.
........
  r84530 | georg.brandl | 2010-09-05 19:07:12 +0200 (So, 05 Sep 2010) | 1 line

  #9747: fix copy-paste error in getresgid() doc.
........
  r84531 | georg.brandl | 2010-09-05 19:09:18 +0200 (So, 05 Sep 2010) | 1 line

  #9776: fix some spacing.
........
  r84553 | georg.brandl | 2010-09-06 08:49:07 +0200 (Mo, 06 Sep 2010) | 1 line

  #9780: both { and } are not valid fill characters.
........
  r84619 | georg.brandl | 2010-09-08 12:43:45 +0200 (Mi, 08 Sep 2010) | 1 line

  Add Lukasz.
........
  r84915 | georg.brandl | 2010-09-20 08:27:02 +0200 (Mo, 20 Sep 2010) | 1 line

  Fix typo.
........
  r84916 | georg.brandl | 2010-09-20 08:29:01 +0200 (Mo, 20 Sep 2010) | 1 line

  Mention % as string formatting.
........
This commit is contained in:
Georg Brandl 2010-10-06 09:28:45 +00:00
parent e85e1ae413
commit 21946afe3f
31 changed files with 97 additions and 56 deletions

View File

@ -975,7 +975,7 @@ in previous versions.
.. cvar:: int PyTrace_C_EXCEPTION
The value for the *what* parameter to :ctype:`Py_tracefunc` functions when a C
function has thrown an exception.
function has raised an exception.
.. cvar:: int PyTrace_C_RETURN

View File

@ -579,7 +579,7 @@ These are the UTF-7 codec APIs:
*s*. Return *NULL* if an exception was raised by the codec.
.. cfunction:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
.. cfunction:: PyObject* PyUnicode_DecodeUTF7Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed)
If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF7`. If
*consumed* is not *NULL*, trailing incomplete UTF-7 base-64 sections will not

View File

@ -125,7 +125,7 @@ latex_documents = [
('tutorial/index', 'tutorial.tex',
'Python Tutorial', _stdauthor, 'manual'),
('using/index', 'using.tex',
'Python Setup', _stdauthor, 'manual'),
'Python Setup and Usage', _stdauthor, 'manual'),
('whatsnew/' + version, 'whatsnew.tex',
'What\'s New in Python', 'A. M. Kuchling', 'howto'),
]

View File

@ -672,9 +672,8 @@ Yes. Here's a simple example that uses httplib::
if reply != 200:
sys.stdout.write(httpobj.getfile().read())
Note that in general for a percent-encoded POST operations, query strings must be
quoted by using :func:`urllib.quote`. For example to send name="Guy Steele,
Jr."::
Note that in general for percent-encoded POST operations, query strings must be
quoted using :func:`urllib.quote`. For example to send name="Guy Steele, Jr."::
>>> from urllib import quote
>>> x = quote("Guy Steele, Jr.")

View File

@ -108,7 +108,7 @@ The :mod:`bdb` module also defines two classes:
* ``"exception"``: An exception has occurred.
* ``"c_call"``: A C function is about to be called.
* ``"c_return"``: A C function has returned.
* ``"c_exception"``: A C function has thrown an exception.
* ``"c_exception"``: A C function has raised an exception.
For the Python events, specialized functions (see below) are called. For
the C events, no action is taken.

View File

@ -1768,7 +1768,7 @@ There are two exceptions that may be raised by :class:`DebugRunner` instances:
.. exception:: DocTestFailure(test, example, got)
An exception thrown by :class:`DocTestRunner` to signal that a doctest example's
An exception raised by :class:`DocTestRunner` to signal that a doctest example's
actual output did not match its expected output. The constructor arguments are
used to initialize the member variables of the same names.
@ -1792,9 +1792,9 @@ There are two exceptions that may be raised by :class:`DebugRunner` instances:
.. exception:: UnexpectedException(test, example, exc_info)
An exception thrown by :class:`DocTestRunner` to signal that a doctest example
raised an unexpected exception. The constructor arguments are used to
initialize the member variables of the same names.
An exception raised by :class:`DocTestRunner` to signal that a doctest
example raised an unexpected exception. The constructor arguments are used
to initialize the member variables of the same names.
:exc:`UnexpectedException` defines the following member variables:

View File

@ -17,7 +17,7 @@ The following exception classes are defined in the :mod:`email.errors` module:
.. exception:: MessageParseError()
This is the base class for exceptions thrown by the :class:`~email.parser.Parser`
This is the base class for exceptions raised by the :class:`~email.parser.Parser`
class. It is derived from :exc:`MessageError`.

View File

@ -347,6 +347,9 @@ available. They are listed here in alphabetical order.
returns the current global and local dictionary, respectively, which may be
useful to pass around for use by :func:`eval` or :func:`execfile`.
See :func:`ast.literal_eval` for a function that can safely evaluate strings
with expressions containing only literals.
.. function:: execfile(filename[, globals[, locals]])

View File

@ -29,7 +29,7 @@ access files and streams.
At the top of the I/O hierarchy is the abstract base class :class:`IOBase`. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are allowed
to throw an :exc:`IOError` if they do not support a given operation.
to raise an :exc:`IOError` if they do not support a given operation.
Extending :class:`IOBase` is :class:`RawIOBase` which deals simply with the
reading and writing of raw bytes to a stream. :class:`FileIO` subclasses

View File

@ -360,7 +360,7 @@ Encoders and decoders
encoders and decoders. Otherwise, it will be a :exc:`ValueError` to encode
such floats.
If *sort_keys* is ``True`` (the default), then the output of dictionaries
If *sort_keys* is ``True`` (default ``False``), then the output of dictionaries
will be sorted by key; this is useful for regression tests to ensure that
JSON serializations can be compared on a day-to-day basis.

View File

@ -17,7 +17,7 @@ The :mod:`linecache` module defines the following functions:
.. function:: getline(filename, lineno[, module_globals])
Get line *lineno* from file named *filename*. This function will never throw an
Get line *lineno* from file named *filename*. This function will never raise an
exception --- it will return ``''`` on errors (the terminating newline character
will be included for lines that are found).

View File

@ -173,7 +173,7 @@ memory but does not update the underlying file.
Copy the *count* bytes starting at offset *src* to the destination index
*dest*. If the mmap was created with :const:`ACCESS_READ`, then calls to
move will throw a :exc:`TypeError` exception.
move will raise a :exc:`TypeError` exception.
.. method:: read(num)
@ -199,7 +199,7 @@ memory but does not update the underlying file.
Resizes the map and the underlying file, if any. If the mmap was created
with :const:`ACCESS_READ` or :const:`ACCESS_COPY`, resizing the map will
throw a :exc:`TypeError` exception.
raise a :exc:`TypeError` exception.
.. method:: rfind(string[, start[, end]])
@ -234,7 +234,7 @@ memory but does not update the underlying file.
Write the bytes in *string* into memory at the current position of the
file pointer; the file position is updated to point after the bytes that
were written. If the mmap was created with :const:`ACCESS_READ`, then
writing to it will throw a :exc:`TypeError` exception.
writing to it will raise a :exc:`TypeError` exception.
.. method:: write_byte(byte)
@ -242,6 +242,4 @@ memory but does not update the underlying file.
Write the single-character string *byte* into memory at the current
position of the file pointer; the file position is advanced by ``1``. If
the mmap was created with :const:`ACCESS_READ`, then writing to it will
throw a :exc:`TypeError` exception.
raise a :exc:`TypeError` exception.

View File

@ -2223,8 +2223,8 @@ Synchronization types like locks, conditions and queues:
.. literalinclude:: ../includes/mp_synchronize.py
An showing how to use queues to feed tasks to a collection of worker process and
collect the results:
An example showing how to use queues to feed tasks to a collection of worker
process and collect the results:
.. literalinclude:: ../includes/mp_workers.py

View File

@ -223,7 +223,7 @@ process and user.
.. function:: getresgid()
Return a tuple (rgid, egid, sgid) denoting the current process's
real, effective, and saved user ids.
real, effective, and saved group ids.
Availability: Unix.

View File

@ -121,7 +121,7 @@ and ``'exec'`` forms.
The :func:`expr` function parses the parameter *source* as if it were an input
to ``compile(source, 'file.py', 'eval')``. If the parse succeeds, an ST object
is created to hold the internal parse tree representation, otherwise an
appropriate exception is thrown.
appropriate exception is raised.
.. function:: suite(source)
@ -129,7 +129,7 @@ and ``'exec'`` forms.
The :func:`suite` function parses the parameter *source* as if it were an input
to ``compile(source, 'file.py', 'exec')``. If the parse succeeds, an ST object
is created to hold the internal parse tree representation, otherwise an
appropriate exception is thrown.
appropriate exception is raised.
.. function:: sequence2st(sequence)
@ -139,9 +139,9 @@ and ``'exec'`` forms.
to the Python grammar and all nodes are valid node types in the host version of
Python, an ST object is created from the internal representation and returned
to the called. If there is a problem creating the internal representation, or
if the tree cannot be validated, a :exc:`ParserError` exception is thrown. An
if the tree cannot be validated, a :exc:`ParserError` exception is raised. An
ST object created this way should not be assumed to compile correctly; normal
exceptions thrown by compilation may still be initiated when the ST object is
exceptions raised by compilation may still be initiated when the ST object is
passed to :func:`compilest`. This may indicate problems not related to syntax
(such as a :exc:`MemoryError` exception), but may also be due to constructs such
as the result of parsing ``del f(0)``, which escapes the Python parser but is
@ -264,8 +264,8 @@ function for information about the exceptions it can raise.
.. exception:: ParserError
Exception raised when a failure occurs within the parser module. This is
generally produced for validation failures rather than the built in
:exc:`SyntaxError` thrown during normal parsing. The exception argument is
generally produced for validation failures rather than the built-in
:exc:`SyntaxError` raised during normal parsing. The exception argument is
either a string describing the reason of the failure or a tuple containing a
sequence causing the failure from a parse tree passed to :func:`sequence2st`
and an explanatory string. Calls to :func:`sequence2st` need to be able to
@ -273,7 +273,7 @@ function for information about the exceptions it can raise.
will only need to be aware of the simple string values.
Note that the functions :func:`compilest`, :func:`expr`, and :func:`suite` may
throw exceptions which are normally thrown by the parsing and compilation
raise exceptions which are normally thrown by the parsing and compilation
process. These include the built in exceptions :exc:`MemoryError`,
:exc:`OverflowError`, :exc:`SyntaxError`, and :exc:`SystemError`. In these
cases, these exceptions carry all the meaning normally associated with them.

View File

@ -464,7 +464,7 @@ otherwise stated.
Called if the XML document hasn't been declared as being a standalone document.
This happens when there is an external subset or a reference to a parameter
entity, but the XML declaration does not set standalone to ``yes`` in an XML
declaration. If this handler returns ``0``, then the parser will throw an
declaration. If this handler returns ``0``, then the parser will raise an
:const:`XML_ERROR_NOT_STANDALONE` error. If this handler is not set, no
exception is raised by the parser for this condition.
@ -481,7 +481,7 @@ otherwise stated.
responsible for creating the sub-parser using
``ExternalEntityParserCreate(context)``, initializing it with the appropriate
callbacks, and parsing the entity. This handler should return an integer; if it
returns ``0``, the parser will throw an
returns ``0``, the parser will raise an
:const:`XML_ERROR_EXTERNAL_ENTITY_HANDLING` error, otherwise parsing will
continue.

View File

@ -298,9 +298,9 @@ An :class:`SMTP` instance has the following methods:
and ESMTP options suppressed.
This method will return normally if the mail is accepted for at least one
recipient. Otherwise it will throw an exception. That is, if this method does
not throw an exception, then someone should get your mail. If this method does
not throw an exception, it returns a dictionary, with one entry for each
recipient. Otherwise it will raise an exception. That is, if this method does
not raise an exception, then someone should get your mail. If this method does
not raise an exception, it returns a dictionary, with one entry for each
recipient that was refused. Each entry contains a tuple of the SMTP error code
and the accompanying error message sent by the server.

View File

@ -798,7 +798,9 @@ timeout error of its own regardless of any Python socket timeout setting.
Shut down one or both halves of the connection. If *how* is :const:`SHUT_RD`,
further receives are disallowed. If *how* is :const:`SHUT_WR`, further sends
are disallowed. If *how* is :const:`SHUT_RDWR`, further sends and receives are
disallowed.
disallowed. Depending on the platform, shutting down one half of the connection
can also close the opposite half (e.g. on Mac OS X, ``shutdown(SHUT_WR)`` does
not allow further reads on the other end of the connection).
Note that there are no methods :meth:`read` or :meth:`write`; use
:meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead.

View File

@ -190,7 +190,7 @@ string formatting behaviors using the same implementation as the built-in
the format string (integers for positional arguments, and strings for
named arguments), and a reference to the *args* and *kwargs* that was
passed to vformat. The set of unused args can be calculated from these
parameters. :meth:`check_unused_args` is assumed to throw an exception if
parameters. :meth:`check_unused_args` is assumed to raise an exception if
the check fails.
.. method:: format_field(value, format_spec)
@ -324,11 +324,11 @@ The general form of a *standard format specifier* is:
precision: `integer`
type: "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
The *fill* character can be any character other than '}' (which signifies the
end of the field). The presence of a fill character is signaled by the *next*
character, which must be one of the alignment options. If the second character
of *format_spec* is not a valid alignment option, then it is assumed that both
the fill character and the alignment option are absent.
The *fill* character can be any character other than '{' or '}'. The presence
of a fill character is signaled by the character following it, which must be
one of the alignment options. If the second character of *format_spec* is not
a valid alignment option, then it is assumed that both the fill character and
the alignment option are absent.
The meaning of the various alignment options is as follows:

View File

@ -254,7 +254,7 @@ Exceptions
Exceptions raised in the child process, before the new program has started to
execute, will be re-raised in the parent. Additionally, the exception object
will have one extra attribute called :attr:`child_traceback`, which is a string
containing traceback information from the childs point of view.
containing traceback information from the child's point of view.
The most common exception raised is :exc:`OSError`. This occurs, for example,
when trying to execute a non-existent file. Applications should prepare for

View File

@ -890,7 +890,7 @@ always available.
A C function has returned. *arg* is ``None``.
``'c_exception'``
A C function has thrown an exception. *arg* is ``None``.
A C function has raised an exception. *arg* is ``None``.
Note that as an exception is propagated down the chain of callers, an
``'exception'`` event is generated at each level.

View File

@ -43,6 +43,8 @@ This module defines the following functions and objects:
variable allows one or more threads to wait until they are notified by another
thread.
See :ref:`condition-objects`.
.. function:: current_thread()
currentThread()
@ -69,6 +71,8 @@ This module defines the following functions and objects:
with the :meth:`clear` method. The :meth:`wait` method blocks until the flag
is true.
See :ref:`event-objects`.
.. class:: local
@ -93,6 +97,8 @@ This module defines the following functions and objects:
acquired it, subsequent attempts to acquire it block, until it is released; any
thread may release it.
See :ref:`lock-objects`.
.. function:: RLock()
@ -101,6 +107,8 @@ This module defines the following functions and objects:
reentrant lock, the same thread may acquire it again without blocking; the
thread must release it once for each time it has acquired it.
See :ref:`rlock-objects`.
.. function:: Semaphore([value])
:noindex:
@ -111,6 +119,8 @@ This module defines the following functions and objects:
if necessary until it can return without making the counter negative. If not
given, *value* defaults to 1.
See :ref:`semaphore-objects`.
.. function:: BoundedSemaphore([value])
@ -122,15 +132,21 @@ This module defines the following functions and objects:
.. class:: Thread
:noindex:
A class that represents a thread of control. This class can be safely
subclassed in a limited fashion.
See :ref:`thread-objects`.
.. class:: Timer
:noindex:
A thread that executes a function after a specified interval has passed.
See :ref:`timer-objects`.
.. function:: settrace(func)

View File

@ -157,7 +157,7 @@ The :class:`XMLReader` interface supports the following methods:
Allow an application to set the locale for errors and warnings.
SAX parsers are not required to provide localization for errors and warnings; if
they cannot support the requested locale, however, they must throw a SAX
they cannot support the requested locale, however, they must raise a SAX
exception. Applications may request a locale change in the middle of a parse.

View File

@ -338,7 +338,8 @@ patterns to be encapsulated for convenient reuse.
The execution of the :keyword:`with` statement with one "item" proceeds as follows:
#. The context expression is evaluated to obtain a context manager.
#. The context expression (the expression given in the :token:`with_item`) is
evaluated to obtain a context manager.
#. The context manager's :meth:`__exit__` is loaded for later use.

View File

@ -1367,6 +1367,7 @@ groups from right to left).
| ``+``, ``-`` | Addition and subtraction |
+-----------------------------------------------+-------------------------------------+
| ``*``, ``/``, ``//``, ``%`` | Multiplication, division, remainder |
| | [#]_ |
+-----------------------------------------------+-------------------------------------+
| ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |
+-----------------------------------------------+-------------------------------------+
@ -1422,5 +1423,7 @@ groups from right to left).
the :keyword:`is` operator, like those involving comparisons between instance
methods, or constants. Check their documentation for more info.
.. [#] The ``%`` is also used for string formatting; the same precedence applies.
.. [#] The power operator ``**`` binds less tightly than an arithmetic or
bitwise unary operator on its right, that is, ``2**-1`` is ``0.5``.

View File

@ -11,7 +11,7 @@
<span class="linkdescr">keep this under your pillow</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("reference/index") }}">Language Reference</a><br/>
<span class="linkdescr">describes syntax and language elements</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">Python Setup</a><br/>
<p class="biglink"><a class="biglink" href="{{ pathto("using/index") }}">Python Setup and Usage</a><br/>
<span class="linkdescr">how to use Python on different platforms</span></p>
<p class="biglink"><a class="biglink" href="{{ pathto("howto/index") }}">Python HOWTOs</a><br/>
<span class="linkdescr">in-depth documents on specific topics</span></p>

View File

@ -1,8 +1,8 @@
.. _using-index:
################
Python Setup
################
##########################
Python Setup and Usage
##########################
This part of the documentation is devoted to general information on the setup

View File

@ -1066,7 +1066,7 @@ complete list of changes, or look through the CVS logs for all the details.
deprecated APIs and removes support for Python versions earlier than 2.3. The
3.0 version of the package uses a new incremental parser for MIME messages,
available in the :mod:`email.FeedParser` module. The new parser doesn't require
reading the entire message into memory, and doesn't throw exceptions if a
reading the entire message into memory, and doesn't raise exceptions if a
message is malformed; instead it records any problems in the :attr:`defect`
attribute of the message. (Developed by Anthony Baxter, Barry Warsaw, Thomas
Wouters, and others.)

View File

@ -20,6 +20,25 @@ for details. When the agreement is signed, please note it in this log.
Permissions History
-------------------
- Lukasz Langa was given commit access on Sep 08 2010 by GFB,
at suggestion of Antoine Pitrou, for general bug fixing.
- Daniel Stutzbach was given commit access on Aug 22 2010 by MvL,
for general bug fixing.
- Ask Solem was given commit access on Aug 17 2010 by MvL,
on recommendation by Jesse Noller, for work on the multiprocessing
library.
- George Boutsioukis was given commit access on Aug 10 2010
by MvL, for work on 2to3.
- Éric Araujo was given commit access on Aug 10 2010 by BAC,
at suggestion of Tarek Ziadé.
- Terry Reedy was given commit access on Aug 04 2010 by MvL,
at suggestion of Nick Coghlan.
- Brian Quinlan was given commit access on Jul 26 2010 by GFB,
for work related to PEP 3148.

View File

@ -82,10 +82,10 @@ PyDoc_STRVAR(fcntl_doc,
Perform the requested operation on file descriptor fd. The operation\n\
is defined by op and is operating system dependent. These constants are\n\
available from the fcntl module. The argument arg is optional, and\n\
defaults to 0; it may be an int or a string. If arg is given as a string,\n\
defaults to 0; it may be an int or a string. If arg is given as a string,\n\
the return value of fcntl is a string of that length, containing the\n\
resulting value put in the arg buffer by the operating system.The length\n\
of the arg string is not allowed to exceed 1024 bytes. If the arg given\n\
resulting value put in the arg buffer by the operating system. The length\n\
of the arg string is not allowed to exceed 1024 bytes. If the arg given\n\
is an integer or if none is specified, the result value is an integer\n\
corresponding to the return value of the fcntl call in the C code.");

View File

@ -8619,7 +8619,7 @@ posix_getresuid (PyObject *self, PyObject *noargs)
#ifdef HAVE_GETRESGID
PyDoc_STRVAR(posix_getresgid__doc__,
"getresgid() -> (rgid, egid, sgid)\n\n\
Get tuple of the current process's real, effective, and saved user ids.");
Get tuple of the current process's real, effective, and saved group ids.");
static PyObject*
posix_getresgid (PyObject *self, PyObject *noargs)