summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-03-21 19:29:04 (GMT)
committerGeorg Brandl <georg@python.org>2010-03-21 19:29:04 (GMT)
commit5a7eca17498f3e7ed54c0d569bfd4f19bc81fe9f (patch)
treed66b48add092c9847fd99441cd81824734ecd55e /Doc
parentd131c10732d53343ae2c53830e3b2c67d9060aca (diff)
downloadcpython-5a7eca17498f3e7ed54c0d569bfd4f19bc81fe9f.zip
cpython-5a7eca17498f3e7ed54c0d569bfd4f19bc81fe9f.tar.gz
cpython-5a7eca17498f3e7ed54c0d569bfd4f19bc81fe9f.tar.bz2
Merged revisions 77593,77702-77703,77858,77887,78113-78115,78117,78245,78385-78386,78496,78760,78771-78773,78802 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77593 | georg.brandl | 2010-01-18 00:33:53 +0100 (Mo, 18 Jan 2010) | 1 line Fix internal reference. ........ r77702 | georg.brandl | 2010-01-23 09:43:31 +0100 (Sa, 23 Jan 2010) | 1 line #7762: fix refcount annotation of PyUnicode_Tailmatch(). ........ r77703 | georg.brandl | 2010-01-23 09:47:54 +0100 (Sa, 23 Jan 2010) | 1 line #7725: fix referencing issue. ........ r77858 | georg.brandl | 2010-01-30 18:57:48 +0100 (Sa, 30 Jan 2010) | 1 line #7802: fix invalid example (heh). ........ r77887 | georg.brandl | 2010-01-31 19:51:49 +0100 (So, 31 Jan 2010) | 5 lines Fix-up ftplib documentation: move exception descriptions to toplevel, not inside a class remove attribution in "versionadded" spell and grammar check docstring of FTP_TLS ........ r78113 | georg.brandl | 2010-02-08 23:37:20 +0100 (Mo, 08 Feb 2010) | 1 line Fix missing string formatting argument. ........ r78114 | georg.brandl | 2010-02-08 23:37:52 +0100 (Mo, 08 Feb 2010) | 1 line Fix undefined local. ........ r78115 | georg.brandl | 2010-02-08 23:40:51 +0100 (Mo, 08 Feb 2010) | 1 line Fix missing string formatting placeholder. ........ r78117 | georg.brandl | 2010-02-08 23:48:37 +0100 (Mo, 08 Feb 2010) | 1 line Convert test failure from output-producing to self.fail(). ........ r78245 | georg.brandl | 2010-02-19 20:36:08 +0100 (Fr, 19 Feb 2010) | 1 line #7967: PyXML is no more. ........ r78385 | georg.brandl | 2010-02-23 22:33:17 +0100 (Di, 23 Feb 2010) | 1 line #8000: fix deprecated directive. What a shame to lose that glorious issue number to such a minor bug :) ........ r78386 | georg.brandl | 2010-02-23 22:48:57 +0100 (Di, 23 Feb 2010) | 1 line #6544: fix refleak in kqueue, occurring in certain error conditions. ........ r78496 | georg.brandl | 2010-02-27 15:58:08 +0100 (Sa, 27 Feb 2010) | 1 line Link to http://www.python.org/dev/workflow/ from bugs page. ........ r78760 | georg.brandl | 2010-03-07 16:23:59 +0100 (So, 07 Mär 2010) | 1 line #5341: more built-in vs builtin fixes. ........ r78771 | georg.brandl | 2010-03-07 21:58:31 +0100 (So, 07 Mär 2010) | 1 line #8085: The function is called PyObject_NewVar, not PyObject_VarNew. ........ r78772 | georg.brandl | 2010-03-07 22:12:28 +0100 (So, 07 Mär 2010) | 1 line #8039: document conditional expressions better, giving them their own section. ........ r78773 | georg.brandl | 2010-03-07 22:32:06 +0100 (So, 07 Mär 2010) | 1 line #8044: document Py_{Enter,Leave}RecursiveCall functions. ........ r78802 | georg.brandl | 2010-03-08 17:28:40 +0100 (Mo, 08 Mär 2010) | 1 line Fix typo. ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/bugs.rst10
-rw-r--r--Doc/c-api/exceptions.rst30
-rw-r--r--Doc/c-api/gcsupport.rst2
-rw-r--r--Doc/c-api/typeobj.rst2
-rw-r--r--Doc/data/refcounts.dat2
-rw-r--r--Doc/library/ftplib.rst38
-rw-r--r--Doc/library/markup.rst7
-rw-r--r--Doc/library/mutex.rst2
-rw-r--r--Doc/library/profile.rst2
-rw-r--r--Doc/library/xmlrpclib.rst6
-rw-r--r--Doc/reference/executionmodel.rst4
-rw-r--r--Doc/reference/expressions.rst37
-rw-r--r--Doc/whatsnew/2.6.rst24
13 files changed, 102 insertions, 64 deletions
diff --git a/Doc/bugs.rst b/Doc/bugs.rst
index dc7d388..4db2433 100644
--- a/Doc/bugs.rst
+++ b/Doc/bugs.rst
@@ -23,10 +23,9 @@ In the case of documentation bugs, look at the most recent development docs at
http://docs.python.org/dev to see if the bug has been fixed.
If the problem you're reporting is not already in the bug tracker, go back to
-the Python Bug Tracker. If you don't already have a tracker account, select the
-"Register" link in the sidebar and undergo the registration procedure.
-Otherwise, if you're not logged in, enter your credentials and select "Login".
-It is not possible to submit a bug report anonymously.
+the Python Bug Tracker and log in. If you don't already have a tracker account,
+select the "Register" link or, if you use OpenID, one of the OpenID provider
+logos in the sidebar. It is not possible to submit a bug report anonymously.
Being now logged in, you can submit a bug. Select the "Create New" link in the
sidebar to open the bug reporting form.
@@ -43,7 +42,8 @@ were using (including version information as appropriate).
Each bug report will be assigned to a developer who will determine what needs to
be done to correct the problem. You will receive an update each time action is
-taken on the bug.
+taken on the bug. See http://www.python.org/dev/workflow/ for a detailed
+description of the issue workflow.
.. seealso::
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 4482cd0..141f357 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -429,6 +429,36 @@ is a separate error indicator for each thread.
the warning message.
+Recursion Control
+=================
+
+These two functions provide a way to perform safe recursive calls at the C
+level, both in the core and in extension modules. They are needed if the
+recursive code does not necessarily invoke Python code (which tracks its
+recursion depth automatically).
+
+.. cfunction:: int Py_EnterRecursiveCall(char *where)
+
+ Marks a point where a recursive C-level call is about to be performed.
+
+ If :const:`USE_STACKCHECK` is defined, this function checks if the the OS
+ stack overflowed using :cfunc:`PyOS_CheckStack`. In this is the case, it
+ sets a :exc:`MemoryError` and returns a nonzero value.
+
+ The function then checks if the recursion limit is reached. If this is the
+ case, a :exc:`RuntimeError` is set and a nonzero value is returned.
+ Otherwise, zero is returned.
+
+ *where* should be a string such as ``" in instance check"`` to be
+ concatenated to the :exc:`RuntimeError` message caused by the recursion depth
+ limit.
+
+.. cfunction:: void Py_LeaveRecursiveCall()
+
+ Ends a :cfunc:`Py_EnterRecursiveCall`. Must be called once for each
+ *successful* invocation of :cfunc:`Py_EnterRecursiveCall`.
+
+
.. _standardexceptions:
Standard Exceptions
diff --git a/Doc/c-api/gcsupport.rst b/Doc/c-api/gcsupport.rst
index 7fe33b3..4517929 100644
--- a/Doc/c-api/gcsupport.rst
+++ b/Doc/c-api/gcsupport.rst
@@ -31,7 +31,7 @@ include the :const:`Py_TPFLAGS_HAVE_GC` and provide an implementation of the
Constructors for container types must conform to two rules:
#. The memory for the object must be allocated using :cfunc:`PyObject_GC_New`
- or :cfunc:`PyObject_GC_VarNew`.
+ or :cfunc:`PyObject_GC_NewVar`.
#. Once all the fields which may contain references to other containers are
initialized, it must call :cfunc:`PyObject_GC_Track`.
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index 0566375..8489c35 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -189,7 +189,7 @@ type objects) *must* have the :attr:`ob_size` field.
instance; this is normally :cfunc:`PyObject_Del` if the instance was allocated
using :cfunc:`PyObject_New` or :cfunc:`PyObject_VarNew`, or
:cfunc:`PyObject_GC_Del` if the instance was allocated using
- :cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_VarNew`.
+ :cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_NewVar`.
This field is inherited by subtypes.
diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat
index 4d889bd..f48b754 100644
--- a/Doc/data/refcounts.dat
+++ b/Doc/data/refcounts.dat
@@ -1595,7 +1595,7 @@ PyUnicode_Join:PyObject*::+1:
PyUnicode_Join:PyObject*:separator:0:
PyUnicode_Join:PyObject*:seq:0:
-PyUnicode_Tailmatch:PyObject*::+1:
+PyUnicode_Tailmatch:int:::
PyUnicode_Tailmatch:PyObject*:str:0:
PyUnicode_Tailmatch:PyObject*:substr:0:
PyUnicode_Tailmatch:int:start::
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
index 63c653b..009fe38 100644
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -33,8 +33,8 @@ Here's a sample session using the :mod:`ftplib` module::
'226 Transfer complete.'
>>> ftp.quit()
-The module defines the following items:
+The module defines the following items:
.. class:: FTP([host[, user[, passwd[, acct[, timeout]]]]])
@@ -50,42 +50,42 @@ The module defines the following items:
*timeout* was added.
- .. attribute:: all_errors
+.. exception:: error_reply
- The set of all exceptions (as a tuple) that methods of :class:`FTP`
- instances may raise as a result of problems with the FTP connection (as
- opposed to programming errors made by the caller). This set includes the
- four exceptions listed below as well as :exc:`socket.error` and
- :exc:`IOError`.
+ Exception raised when an unexpected reply is received from the server.
- .. exception:: error_reply
+.. exception:: error_temp
- Exception raised when an unexpected reply is received from the server.
+ Exception raised when an error code in the range 400--499 is received.
- .. exception:: error_temp
+.. exception:: error_perm
- Exception raised when an error code in the range 400--499 is received.
+ Exception raised when an error code in the range 500--599 is received.
- .. exception:: error_perm
+.. exception:: error_proto
- Exception raised when an error code in the range 500--599 is received.
+ Exception raised when a reply is received from the server that does not
+ begin with a digit in the range 1--5.
- .. exception:: error_proto
+.. data:: all_errors
- Exception raised when a reply is received from the server that does not
- begin with a digit in the range 1--5.
+ The set of all exceptions (as a tuple) that methods of :class:`FTP`
+ instances may raise as a result of problems with the FTP connection (as
+ opposed to programming errors made by the caller). This set includes the
+ four exceptions listed below as well as :exc:`socket.error` and
+ :exc:`IOError`.
.. seealso::
Module :mod:`netrc`
- Parser for the :file:`.netrc` file format. The file :file:`.netrc` is typically
- used by FTP clients to load user authentication information before prompting the
- user.
+ Parser for the :file:`.netrc` file format. The file :file:`.netrc` is
+ typically used by FTP clients to load user authentication information
+ before prompting the user.
.. index:: single: ftpmirror.py
diff --git a/Doc/library/markup.rst b/Doc/library/markup.rst
index dd0dd8f..8508a1f 100644
--- a/Doc/library/markup.rst
+++ b/Doc/library/markup.rst
@@ -35,10 +35,3 @@ definition of the Python bindings for the DOM and SAX interfaces.
xml.sax.utils.rst
xml.sax.reader.rst
xml.etree.elementtree.rst
-
-.. seealso::
-
- `Python/XML Libraries <http://pyxml.sourceforge.net/>`_
- Home page for the PyXML package, containing an extension of :mod:`xml` package
- bundled with Python.
-
diff --git a/Doc/library/mutex.rst b/Doc/library/mutex.rst
index 53656c3..2d41350 100644
--- a/Doc/library/mutex.rst
+++ b/Doc/library/mutex.rst
@@ -6,7 +6,7 @@
:synopsis: Lock and queue for mutual exclusion.
:deprecated:
-.. deprecated::
+.. deprecated:: 2.6
The :mod:`mutex` module has been removed in Python 3.0.
.. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst
index 8370f4d..a69a0da 100644
--- a/Doc/library/profile.rst
+++ b/Doc/library/profile.rst
@@ -124,7 +124,7 @@ script. For example::
cProfile.py [-o output_file] [-s sort_order]
-:option:`-s` only applies to standard output (:option:`-o` is not supplied).
+``-s`` only applies to standard output (``-o`` is not supplied).
Look in the :class:`Stats` documentation for valid sort values.
When you wish to review the profile, you should use the methods in the
diff --git a/Doc/library/xmlrpclib.rst b/Doc/library/xmlrpclib.rst
index f2b4736..cc2e8b6 100644
--- a/Doc/library/xmlrpclib.rst
+++ b/Doc/library/xmlrpclib.rst
@@ -414,12 +414,12 @@ does not exist). It has the following members:
error.
In the following example we're going to intentionally cause a :exc:`ProtocolError`
-by providing an invalid URI::
+by providing an URI that doesn't point to an XMLRPC server::
import xmlrpclib
- # create a ServerProxy with an invalid URI
- proxy = xmlrpclib.ServerProxy("http://invalidaddress/")
+ # create a ServerProxy with an URI that doesn't respond to XMLRPC requests
+ proxy = xmlrpclib.ServerProxy("http://www.google.com/")
try:
proxy.some_method()
diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst
index 9f6170d..4e38536 100644
--- a/Doc/reference/executionmodel.rst
+++ b/Doc/reference/executionmodel.rst
@@ -119,7 +119,7 @@ searched. The global statement must precede all uses of the name.
.. index:: pair: restricted; execution
-The built-in namespace associated with the execution of a code block is actually
+The builtins namespace associated with the execution of a code block is actually
found by looking up the name ``__builtins__`` in its global namespace; this
should be a dictionary or a module (in the latter case the module's dictionary
is used). By default, when in the :mod:`__main__` module, ``__builtins__`` is
@@ -131,7 +131,7 @@ weak form of restricted execution.
.. impl-detail::
Users should not touch ``__builtins__``; it is strictly an implementation
- detail. Users wanting to override values in the built-in namespace should
+ detail. Users wanting to override values in the builtins namespace should
:keyword:`import` the :mod:`__builtin__` (no 's') module and modify its
attributes appropriately.
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index e060670..c03113c 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -185,6 +185,7 @@ brackets:
list_comprehension: `expression` `list_for`
list_for: "for" `target_list` "in" `old_expression_list` [`list_iter`]
old_expression_list: `old_expression` [("," `old_expression`)+ [","]]
+ old_expression: `or_test` | `old_lambda_form`
list_iter: `list_for` | `list_if`
list_if: "if" `old_expression` [`list_iter`]
@@ -1136,12 +1137,7 @@ Boolean operations
pair: Conditional; expression
pair: Boolean; operation
-Boolean operations have the lowest priority of all Python operations:
-
.. productionlist::
- expression: `conditional_expression` | `lambda_form`
- old_expression: `or_test` | `old_lambda_form`
- conditional_expression: `or_test` ["if" `or_test` "else" `expression`]
or_test: `and_test` | `or_test` "or" `and_test`
and_test: `not_test` | `and_test` "and" `not_test`
not_test: `comparison` | "not" `not_test`
@@ -1158,12 +1154,6 @@ special method for a way to change this.)
The operator :keyword:`not` yields ``True`` if its argument is false, ``False``
otherwise.
-The expression ``x if C else y`` first evaluates *C* (*not* *x*); if *C* is
-true, *x* is evaluated and its value is returned; otherwise, *y* is evaluated
-and its value is returned.
-
-.. versionadded:: 2.5
-
.. index:: operator: and
The expression ``x and y`` first evaluates *x*; if *x* is false, its value is
@@ -1183,6 +1173,29 @@ not bother to return a value of the same type as its argument, so e.g., ``not
'foo'`` yields ``False``, not ``''``.)
+Conditional Expressions
+=======================
+
+.. versionadded:: 2.5
+
+.. index::
+ pair: conditional; expression
+ pair: ternary; operator
+
+.. productionlist::
+ conditional_expression: `or_test` ["if" `or_test` "else" `expression`]
+ expression: `conditional_expression` | `lambda_form`
+
+Conditional expressions (sometimes called a "ternary operator") have the lowest
+priority of all Python operations.
+
+The expression ``x if C else y`` first evaluates the condition, *C* (*not* *x*);
+if *C* is true, *x* is evaluated and its value is returned; otherwise, *y* is
+evaluated and its value is returned.
+
+See :pep:`308` for more details about conditional expressions.
+
+
.. _lambdas:
.. _lambda:
@@ -1276,6 +1289,8 @@ groups from right to left).
+===============================================+=====================================+
| :keyword:`lambda` | Lambda expression |
+-----------------------------------------------+-------------------------------------+
+| :keyword:`if` -- :keyword:`else` | Conditional expression |
++-----------------------------------------------+-------------------------------------+
| :keyword:`or` | Boolean OR |
+-----------------------------------------------+-------------------------------------+
| :keyword:`and` | Boolean AND |
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 1c517c0..a322bdb 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -109,9 +109,9 @@ are:
:func:`reduce` function.
Python 3.0 adds several new built-in functions and changes the
-semantics of some existing built-ins. Functions that are new in 3.0
+semantics of some existing builtins. Functions that are new in 3.0
such as :func:`bin` have simply been added to Python 2.6, but existing
-built-ins haven't been changed; instead, the :mod:`future_builtins`
+builtins haven't been changed; instead, the :mod:`future_builtins`
module has versions with the new 3.0 semantics. Code written to be
compatible with 3.0 can do ``from future_builtins import hex, map`` as
necessary.
@@ -833,7 +833,7 @@ formatted. It receives a single argument, the format specifier::
else:
return str(self)
-There's also a :func:`format` built-in that will format a single
+There's also a :func:`format` builtin that will format a single
value. It calls the type's :meth:`__format__` method with the
provided specifier::
@@ -1164,7 +1164,7 @@ access protocol. Abstract Base Classes (or ABCs) are an equivalent
feature for Python. The ABC support consists of an :mod:`abc` module
containing a metaclass called :class:`ABCMeta`, special handling of
this metaclass by the :func:`isinstance` and :func:`issubclass`
-built-ins, and a collection of basic ABCs that the Python developers
+builtins, and a collection of basic ABCs that the Python developers
think will be widely useful. Future versions of Python will probably
add more ABCs.
@@ -1318,9 +1318,9 @@ an octal number, but it does add support for "0o" and "0b"::
>>> 0b101111
47
-The :func:`oct` built-in still returns numbers
+The :func:`oct` builtin still returns numbers
prefixed with a leading zero, and a new :func:`bin`
-built-in returns the binary representation for a number::
+builtin returns the binary representation for a number::
>>> oct(42)
'052'
@@ -1329,7 +1329,7 @@ built-in returns the binary representation for a number::
>>> bin(173)
'0b10101101'
-The :func:`int` and :func:`long` built-ins will now accept the "0o"
+The :func:`int` and :func:`long` builtins will now accept the "0o"
and "0b" prefixes when base-8 or base-2 are requested, or when the
*base* argument is zero (signalling that the base used should be
determined from the string)::
@@ -1415,7 +1415,7 @@ can be shifted left and right with ``<<`` and ``>>``,
combined using bitwise operations such as ``&`` and ``|``,
and can be used as array indexes and slice boundaries.
-In Python 3.0, the PEP slightly redefines the existing built-ins
+In Python 3.0, the PEP slightly redefines the existing builtins
:func:`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new
one, :func:`math.trunc`, that's been backported to Python 2.6.
:func:`math.trunc` rounds toward zero, returning the closest
@@ -1523,7 +1523,7 @@ Some smaller changes made to the core Python language are:
Previously this would have been a syntax error.
(Contributed by Amaury Forgeot d'Arc; :issue:`3473`.)
-* A new built-in, ``next(iterator, [default])`` returns the next item
+* A new builtin, ``next(iterator, [default])`` returns the next item
from the specified iterator. If the *default* argument is supplied,
it will be returned if *iterator* has been exhausted; otherwise,
the :exc:`StopIteration` exception will be raised. (Backported
@@ -1952,9 +1952,9 @@ changes, or look through the Subversion logs for all the details.
(Contributed by Phil Schwartz; :issue:`1221598`.)
* The :func:`reduce` built-in function is also available in the
- :mod:`functools` module. In Python 3.0, the built-in has been
+ :mod:`functools` module. In Python 3.0, the builtin has been
dropped and :func:`reduce` is only available from :mod:`functools`;
- currently there are no plans to drop the built-in in the 2.x series.
+ currently there are no plans to drop the builtin in the 2.x series.
(Patched by Christian Heimes; :issue:`1739906`.)
* When possible, the :mod:`getpass` module will now use
@@ -2756,7 +2756,7 @@ The functions in this module currently include:
* ``filter(predicate, iterable)``,
``map(func, iterable1, ...)``: the 3.0 versions
- return iterators, unlike the 2.x built-ins which return lists.
+ return iterators, unlike the 2.x builtins which return lists.
* ``hex(value)``, ``oct(value)``: instead of calling the
:meth:`__hex__` or :meth:`__oct__` methods, these versions will