summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/glossary.rst234
-rw-r--r--Doc/library/2to3.rst12
-rw-r--r--Doc/library/collections.rst2
-rw-r--r--Doc/library/compileall.rst9
-rw-r--r--Doc/tutorial/errors.rst2
-rw-r--r--Doc/whatsnew/2.6.rst41
-rw-r--r--Misc/find_recursionlimit.py29
7 files changed, 216 insertions, 113 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index 41bf081..424f679 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -9,16 +9,17 @@ Glossary
.. glossary::
``>>>``
- The typical Python prompt of the interactive shell. Often seen for code
- examples that can be tried right away in the interpreter.
+ The default Python prompt of the interactive shell. Often seen for code
+ examples which can be executed interactively in the interpreter.
``...``
- The typical Python prompt of the interactive shell when entering code for
- an indented code block.
+ The default Python prompt of the interactive shell when entering code for
+ an indented code block or within a pair of matching left and right
+ delimiters (parentheses, square brackets or curly braces).
2to3
A tool that tries to convert Python 2.x code to Python 3.x code by
- handling most of the incompatibilites that can be detected by parsing the
+ handling most of the incompatibilites which can be detected by parsing the
source and traversing the parse tree.
2to3 is available in the standard library as :mod:`lib2to3`; a standalone
@@ -34,15 +35,21 @@ Glossary
ABC with the :mod:`abc` module.
argument
- A value passed to a function or method, assigned to a name local to
- the body. A function or method may have both positional arguments and
- keyword arguments in its definition. Positional and keyword arguments
- may be variable-length: ``*`` accepts or passes (if in the function
- definition or call) several positional arguments in a list, while ``**``
- does the same for keyword arguments in a dictionary.
+ A value passed to a function or method, assigned to a named local
+ variable in the function body. A function or method may have both
+ positional arguments and keyword arguments in its definition.
+ Positional and keyword arguments may be variable-length: ``*`` accepts
+ or passes (if in the function definition or call) several positional
+ arguments in a list, while ``**`` does the same for keyword arguments
+ in a dictionary.
Any expression may be used within the argument list, and the evaluated
value is passed to the local variable.
+
+ attribute
+ A value associated with an object which is referenced by name using
+ dotted expressions. For example, if an object *o* has an attribute
+ *a* it would be referenced as *o.a*.
BDFL
Benevolent Dictator For Life, a.k.a. `Guido van Rossum
@@ -53,8 +60,26 @@ Glossary
of a Python program in the interpreter. The bytecode is also cached in
``.pyc`` and ``.pyo`` files so that executing the same file is faster the
second time (recompilation from source to bytecode can be avoided). This
- "intermediate language" is said to run on a "virtual machine" that calls
- the subroutines corresponding to each bytecode.
+ "intermediate language" is said to run on a :term:`virtual machine`
+ that executes the machine code corresponding to each bytecode.
+
+ class
+ A template for creating user-defined objects. Class definitions
+ normally contain method definitions which operate on instances of the
+ class.
+
+ coercion
+ The implicit conversion of an instance of one type to another during an
+ operation which involves two arguments of the same type. For example,
+ ``int(3.15)`` converts the floating point number to the integer ``3``, but
+ in ``3+4.5``, each argument is of a different type (one int, one float),
+ and both must be converted to the same type before they can be added or it
+ will raise a ``TypeError``. Coercion between two operands can be
+ performed with the ``coerce`` builtin function; thus, ``3+4.5`` is
+ equivalent to calling ``operator.add(*coerce(3, 4.5))`` and results in
+ ``operator.add(3.0, 4.5)``. Without coercion, all arguments of even
+ compatible types would have to be normalized to the same value by the
+ programmer, e.g., ``float(3)+4.5`` rather than just ``3+4.5``.
complex number
An extension of the familiar real number system in which all numbers are
@@ -69,10 +94,15 @@ Glossary
it's almost certain you can safely ignore them.
context manager
- An objects that controls the environment seen in a :keyword:`with`
+ An object which controls the environment seen in a :keyword:`with`
statement by defining :meth:`__enter__` and :meth:`__exit__` methods.
See :pep:`343`.
+ CPython
+ The canonical implementation of the Python programming language. The
+ term "CPython" is used in contexts when necessary to distinguish this
+ implementation from others such as Jython or IronPython.
+
decorator
A function returning another function, usually applied as a function
transformation using the ``@wrapper`` syntax. Common examples for
@@ -92,7 +122,7 @@ Glossary
The same concept exists for classes, but is less commonly used there.
descriptor
- An object that defines the methods :meth:`__get__`, :meth:`__set__`, or
+ Any object which defines the methods :meth:`__get__`, :meth:`__set__`, or
:meth:`__delete__`. When a class attribute is a descriptor, its special
binding behavior is triggered upon attribute lookup. Normally, using
*a.b* to get, set or delete an attribute looks up the object named *b* in
@@ -106,20 +136,20 @@ Glossary
dictionary
An associative array, where arbitrary keys are mapped to values. The use
- of :class:`dict` much resembles that for :class:`list`, but the keys can
- be any object with a :meth:`__hash__` function, not just integers starting
- from zero. Called a hash in Perl.
+ of :class:`dict` closely resembles that for :class:`list`, but the keys can
+ be any object with a :meth:`__hash__` function, not just integers.
+ Called a hash in Perl.
docstring
- A docstring ("documentation string") is a string literal that appears as
- the first thing in a class or function suite. While ignored when the
- suite is executed, it is recognized by the compiler and put into the
- :attr:`__doc__` attribute of the class or function. Since it is available
- via introspection, it is the canonical place for documentation of the
+ A string literal which appears as the first expression in a class,
+ function or module. While ignored when the suite is executed, it is
+ recognized by the compiler and put into the :attr:`__doc__` attribute
+ of the enclosing class, function or module. Since it is available via
+ introspection, it is the canonical place for documentation of the
object.
duck-typing
- Pythonic programming style that determines an object's type by inspection
+ A pythonic programming style which determines an object's type by inspection
of its method or attribute signature rather than by explicit relationship
to some type object ("If it looks like a duck and quacks like a duck, it
must be a duck.") By emphasizing interfaces rather than specific types,
@@ -134,20 +164,20 @@ Glossary
style assumes the existence of valid keys or attributes and catches
exceptions if the assumption proves false. This clean and fast style is
characterized by the presence of many :keyword:`try` and :keyword:`except`
- statements. The technique contrasts with the :term:`LBYL` style that is
- common in many other languages such as C.
+ statements. The technique contrasts with the :term:`LBYL` style
+ common to many other languages such as C.
expression
A piece of syntax which can be evaluated to some value. In other words,
- an expression is an accumulation of expression elements like literals, names,
- attribute access, operators or function calls that all return a value.
- In contrast to other languages, not all language constructs are expressions,
- but there are also :term:`statement`\s that cannot be used as expressions,
- such as :keyword:`while` or :keyword:`if`. Assignments are also not
- expressions.
+ an expression is an accumulation of expression elements like literals,
+ names, attribute access, operators or function calls which all return a
+ value. In contrast to many other languages, not all language constructs
+ are expressions. There are also :term:`statement`\s which cannot be used
+ as expressions, such as :keyword:`if`. Assignments are also statements,
+ not expressions.
extension module
- A module written in C, using Python's C API to interact with the core and
+ A module written in C or C++, using Python's C API to interact with the core and
with user code.
function
@@ -178,10 +208,10 @@ Glossary
collector that is able to detect and break reference cycles.
generator
- A function that returns an iterator. It looks like a normal function
+ A function which returns an iterator. It looks like a normal function
except that values are returned to the caller using a :keyword:`yield`
statement instead of a :keyword:`return` statement. Generator functions
- often contain one or more :keyword:`for` or :keyword:`while` loops that
+ often contain one or more :keyword:`for` or :keyword:`while` loops which
:keyword:`yield` elements back to the caller. The function execution is
stopped at the :keyword:`yield` keyword (returning the result) and is
resumed there when the next element is requested by calling the
@@ -202,39 +232,41 @@ Glossary
See :term:`global interpreter lock`.
global interpreter lock
- The lock used by Python threads to assure that only one thread can be run
- at a time. This simplifies Python by assuring that no two processes can
- access the same memory at the same time. Locking the entire interpreter
- makes it easier for the interpreter to be multi-threaded, at the expense
- of some parallelism on multi-processor machines. Efforts have been made
- in the past to create a "free-threaded" interpreter (one which locks
- shared data at a much finer granularity), but performance suffered in the
- common single-processor case.
+ The lock used by Python threads to assure that only one thread
+ executes in the :term:`CPython` :term:`virtual machine` at a time.
+ This simplifies the CPython implementation by assuring that no two
+ processes can access the same memory at the same time. Locking the
+ entire interpreter makes it easier for the interpreter to be
+ multi-threaded, at the expense of much of the parallelism afforded by
+ multi-processor machines. Efforts have been made in the past to
+ create a "free-threaded" interpreter (one which locks shared data at a
+ much finer granularity), but so far none have been successful because
+ performance suffered in the common single-processor case.
hashable
- An object is *hashable* if it has a hash value that never changes during
+ An object is *hashable* if it has a hash value which never changes during
its lifetime (it needs a :meth:`__hash__` method), and can be compared to
other objects (it needs an :meth:`__eq__` or :meth:`__cmp__` method).
- Hashable objects that compare equal must have the same hash value.
+ Hashable objects which compare equal must have the same hash value.
Hashability makes an object usable as a dictionary key and a set member,
because these data structures use the hash value internally.
- All of Python's immutable built-in objects are hashable, while all mutable
- containers (such as lists or dictionaries) are not. Objects that are
+ All of Python's immutable built-in objects are hashable, while no mutable
+ containers (such as lists or dictionaries) are. Objects which are
instances of user-defined classes are hashable by default; they all
compare unequal, and their hash value is their :func:`id`.
IDLE
An Integrated Development Environment for Python. IDLE is a basic editor
- and interpreter environment that ships with the standard distribution of
+ and interpreter environment which ships with the standard distribution of
Python. Good for beginners, it also serves as clear example code for
those wanting to implement a moderately sophisticated, multi-platform GUI
application.
immutable
- An object with fixed value. Immutable objects are numbers, strings or
- tuples (and more). Such an object cannot be altered. A new object has to
+ An object with a fixed value. Immutable objects include numbers, strings and
+ tuples. Such an object cannot be altered. A new object has to
be created if a different value has to be stored. They play an important
role in places where a constant hash value is needed, for example as a key
in a dictionary.
@@ -252,18 +284,21 @@ Glossary
:term:`__future__`.
interactive
- Python has an interactive interpreter which means that you can try out
- things and immediately see their results. Just launch ``python`` with no
- arguments (possibly by selecting it from your computer's main menu). It is
- a very powerful way to test out new ideas or inspect modules and packages
- (remember ``help(x)``).
+ Python has an interactive interpreter which means you can enter
+ statements and expressions at the interpreter prompt, immediately
+ execute them and see their results. Just launch ``python`` with no
+ arguments (possibly by selecting it from your computer's main
+ menu). It is a very powerful way to test out new ideas or inspect
+ modules and packages (remember ``help(x)``).
interpreted
- Python is an interpreted language, as opposed to a compiled one. This
- means that the source files can be run directly without first creating an
- executable which is then run. Interpreted languages typically have a
- shorter development/debug cycle than compiled ones, though their programs
- generally also run more slowly. See also :term:`interactive`.
+ Python is an interpreted language, as opposed to a compiled one,
+ though the distinction can be blurry because of the presence of the
+ bytecode compiler. This means that source files can be run directly
+ without explicitly creating an executable which is then run.
+ Interpreted languages typically have a shorter development/debug cycle
+ than compiled ones, though their programs generally also run more
+ slowly. See also :term:`interactive`.
iterable
A container object capable of returning its members one at a
@@ -283,15 +318,15 @@ Glossary
iterator
An object representing a stream of data. Repeated calls to the iterator's
- :meth:`__next__` (or passing it to the builtin function) :func:`next`
- method return successive items in the stream. When no more data is
+ :meth:`__next__` (or passing it to the builtin function) :func:`next`
+ method return successive items in the stream. When no more data are
available a :exc:`StopIteration` exception is raised instead. At this
point, the iterator object is exhausted and any further calls to its
- :meth:`__next__` method just raise :exc:`StopIteration` again. Iterators
- are required to have an :meth:`__iter__` method that returns the iterator
+ :meth:`next` method just raise :exc:`StopIteration` again. Iterators are
+ required to have an :meth:`__iter__` method that returns the iterator
object itself so every iterator is also iterable and may be used in most
places where other iterables are accepted. One notable exception is code
- that attempts multiple iteration passes. A container object (such as a
+ which attempts multiple iteration passes. A container object (such as a
:class:`list`) produces a fresh new iterator each time you pass it to the
:func:`iter` function or use it in a :keyword:`for` loop. Attempting this
with an iterator will just return the same exhausted iterator object used
@@ -315,17 +350,22 @@ Glossary
pre-conditions before making calls or lookups. This style contrasts with
the :term:`EAFP` approach and is characterized by the presence of many
:keyword:`if` statements.
+
+ list
+ A built-in Python :term:`sequence`. Despite its name it is more akin
+ to an array in other languages than to a linked list since access to
+ elements are O(1).
list comprehension
- A compact way to process all or a subset of elements in a sequence and
+ A compact way to process all or part of the elements in a sequence and
return a list with the results. ``result = ["0x%02x" % x for x in
- range(256) if x % 2 == 0]`` generates a list of strings containing hex
- numbers (0x..) that are even and in the range from 0 to 255. The
- :keyword:`if` clause is optional. If omitted, all elements in
- ``range(256)`` are processed.
+ range(256) if x % 2 == 0]`` generates a list of strings containing
+ even hex numbers (0x..) in the range from 0 to 255. The :keyword:`if`
+ clause is optional. If omitted, all elements in ``range(256)`` are
+ processed.
mapping
- A container object (such as :class:`dict`) that supports arbitrary key
+ A container object (such as :class:`dict`) which supports arbitrary key
lookups using the special method :meth:`__getitem__`.
metaclass
@@ -342,7 +382,7 @@ Glossary
More information can be found in :ref:`metaclasses`.
method
- A function that is defined inside a class body. If called as an attribute
+ A function which is defined inside a class body. If called as an attribute
of an instance of that class, the method will get the instance object as
its first :term:`argument` (which is usually called ``self``).
See :term:`function` and :term:`nested scope`.
@@ -352,7 +392,7 @@ Glossary
also :term:`immutable`.
named tuple
- Any tuple subclass whose indexable fields are also accessible with
+ Any tuple subclass whose indexable elements are also accessible using
named attributes (for example, :func:`time.localtime` returns a
tuple-like object where the *year* is accessible either with an
index such as ``t[0]`` or with a named attribute like ``t.tm_year``).
@@ -374,7 +414,7 @@ Glossary
it clear which module implements a function. For instance, writing
:func:`random.seed` or :func:`itertools.izip` makes it clear that those
functions are implemented by the :mod:`random` and :mod:`itertools`
- modules respectively.
+ modules, respectively.
nested scope
The ability to refer to a variable in an enclosing definition. For
@@ -390,6 +430,13 @@ Glossary
versatile features like :attr:`__slots__`, descriptors, properties,
:meth:`__getattribute__`, class methods, and static methods.
+ More information can be found in :ref:`newstyle`.
+
+ object
+ Any data with state (attributes or value) and defined behavior
+ (methods). Also the ultimate base class of any :term:`new-style
+ class`.
+
positional argument
The arguments assigned to local names inside a function or method,
determined by the order in which they were given in the call. ``*`` is
@@ -403,11 +450,12 @@ Glossary
abbreviated "Py3k".
Pythonic
- An idea or piece of code which closely follows the most common idioms of
- the Python language, rather than implementing code using concepts common
- in other languages. For example, a common idiom in Python is the :keyword:`for`
- loop structure; other languages don't have this easy keyword, so people
- use a numerical counter instead::
+ An idea or piece of code which closely follows the most common idioms
+ of the Python language, rather than implementing code using concepts
+ common to other languages. For example, a common idiom in Python is
+ to loop over all elements of an iterable using a :keyword:`for`
+ statement. Many other languages don't have this type of construct, so
+ people unfamiliar with Python sometimes use a numerical counter instead::
for i in range(len(food)):
print(food[i])
@@ -418,11 +466,13 @@ Glossary
print(piece)
reference count
- The number of places where a certain object is referenced to. When the
- reference count drops to zero, an object is deallocated. While reference
- counting is invisible on the Python code level, it is used on the
- implementation level to keep track of allocated memory.
-
+ The number of references to an object. When the reference count of an
+ object drops to zero, it is deallocated. Reference counting is
+ generally not visible to Python code, but it is a key element of the
+ :term:`CPython` implementation. The :mod:`sys` module defines a
+ :func:`getrefcount` function that programmers can call to return the
+ reference count for a particular object.
+
__slots__
A declaration inside a class that saves memory by pre-declaring space for
instance attributes and eliminating instance dictionaries. Though
@@ -432,7 +482,8 @@ Glossary
sequence
An :term:`iterable` which supports efficient element access using integer
- indices via the :meth:`__getitem__` and :meth:`__len__` special methods.
+ indices via the :meth:`__getitem__` special method and defines a
+ :meth:`len` method that returns the length of the sequence.
Some built-in sequence types are :class:`list`, :class:`str`,
:class:`tuple`, and :class:`unicode`. Note that :class:`dict` also
supports :meth:`__getitem__` and :meth:`__len__`, but is considered a
@@ -450,10 +501,23 @@ Glossary
an :term:`expression` or a one of several constructs with a keyword, such
as :keyword:`if`, :keyword:`while` or :keyword:`for`.
+ triple-quoted string
+ A string which is bound by three instances of either a quotation mark
+ (") or an apostrophe ('). While they don't provide any functionality
+ not available with single-quoted strings, they are useful for a number
+ of reasons. They allow you to include unescaped single and double
+ quotes within a string and they can span multiple lines without the
+ use of the continuation character, making them especially useful when
+ writing docstrings.
+
type
The type of a Python object determines what kind of object it is; every
object has a type. An object's type is accessible as its
:attr:`__class__` attribute or can be retrieved with ``type(obj)``.
+
+ virtual machine
+ A computer defined entirely in software. Python's virtual machine
+ executes the :term:`bytecode` emitted by the bytecode compiler.
Zen of Python
Listing of Python design principles and philosophies that are helpful in
diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst
index e8ea861..8040124 100644
--- a/Doc/library/2to3.rst
+++ b/Doc/library/2to3.rst
@@ -79,12 +79,12 @@ flag. Note that *only* doctests will be refactored.
The :option:`-v` option enables the output of more information on the
translation process.
-When the :option:`-p` is passed to it, 2to3 treats ``print`` as a function
-instead of a statement. This is useful when ``from __future__ import
-print_function`` is being used. If this option is not given, the print fixer
-will surround print calls in an extra set of parentheses because it cannot
-differentiate between the and print statement with parentheses (such as ``print
-("a" + "b" + "c")``) and a true function call.
+When the :option:`-p` is passed, 2to3 treats ``print`` as a function instead of
+a statement. This is useful when ``from __future__ import print_function`` is
+being used. If this option is not given, the print fixer will surround print
+calls in an extra set of parentheses because it cannot differentiate between the
+and print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a
+true function call.
:mod:`lib2to3` - 2to3's library
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 94b6726..7dd8848 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -359,7 +359,7 @@ in Unix::
.. method:: defaultdict.__missing__(key)
- If the :attr:`default_factory` attribute is ``None``, this raises an
+ If the :attr:`default_factory` attribute is ``None``, this raises a
:exc:`KeyError` exception with the *key* as argument.
If :attr:`default_factory` is not ``None``, it is called without arguments
diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst
index d62b785..86f60fb 100644
--- a/Doc/library/compileall.rst
+++ b/Doc/library/compileall.rst
@@ -11,8 +11,13 @@ libraries. These functions compile Python source files in a directory tree,
allowing users without permission to write to the libraries to take advantage of
cached byte-code files.
-The source file for this module may also be used as a script to compile Python
-sources in directories named on the command line or in ``sys.path``.
+This module may also be used as a script (using the :option:`-m` Python flag) to
+compile Python sources. Directories to recursively traverse (passing
+:option:`-l` stops the recursive behavior) for sources are listed on the command
+line. If no arguments are given, the invocation is equivalent to ``-l
+sys.path``. Printing lists of the files compiled can be disabled with the
+:option:`-q` flag. In addition, the :option:`-x` option takes a regular
+expression argument. All files that match the expression will be skipped.
.. function:: compile_dir(dir[, maxlevels[, ddir[, force[, rx[, quiet]]]]])
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst
index c8b7f4c..ca70f89 100644
--- a/Doc/tutorial/errors.rst
+++ b/Doc/tutorial/errors.rst
@@ -368,7 +368,7 @@ complicated example::
As you can see, the :keyword:`finally` clause is executed in any event. The
:exc:`TypeError` raised by dividing two strings is not handled by the
:keyword:`except` clause and therefore re-raised after the :keyword:`finally`
-clauses has been executed.
+clause has been executed.
In real world applications, the :keyword:`finally` clause is useful for
releasing external resources (such as files or network connections), regardless
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 023c757..04a54a2 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -1723,9 +1723,6 @@ Optimizations
free lists when garbage-collecting the highest generation of objects.
This may return memory to the operating system sooner.
-The net result of the 2.6 optimizations is that Python 2.6 runs the pystone
-benchmark around XXX% faster than Python 2.5.
-
.. ======================================================================
.. _new-26-interpreter:
@@ -1794,7 +1791,6 @@ changes, or look through the Subversion logs for all the details.
:mod:`mimetools`,
:mod:`multifile`,
:mod:`new`,
- :mod:`popen2`,
:mod:`pure`,
:mod:`statvfs`,
:mod:`sunaudiodev`,
@@ -1806,12 +1802,10 @@ changes, or look through the Subversion logs for all the details.
were applied. (Maintained by Josiah Carlson; see :issue:`1736190` for
one patch.)
-.. |uacute| unicode:: 0xA9
-
-* The :mod:`bsddb` module also has a new maintainer, Jes|uacute|s Cea,
- and the package is now available as a standalone package.
- The web page for the package is
- `www.jcea.es/programacion/pybsddb.htm <http://www.jcea.es/programacion/pybsddb.htm>`__.
+* The :mod:`bsddb` module also has a new maintainer, Jesús Cea, and the package
+ is now available as a standalone package. The web page for the package is
+ `www.jcea.es/programacion/pybsddb.htm
+ <http://www.jcea.es/programacion/pybsddb.htm>`__.
* The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol
available, instead of restricting itself to protocol 1.
@@ -2134,6 +2128,13 @@ changes, or look through the Subversion logs for all the details.
(Contributed by Christian Heimes and Mark Dickinson.)
+* The :mod:`MimeWriter` module and :mod:`mimify` module
+ have been deprecated; use the :mod:`email`
+ package instead.
+
+* The :mod:`md5` module has been deprecated; use the :mod:`hashlib` module
+ instead.
+
* :class:`mmap` objects now have a :meth:`rfind` method that searches for a
substring beginning at the end of the string and searching
backwards. The :meth:`find` method also gained an *end* parameter
@@ -2216,6 +2217,9 @@ changes, or look through the Subversion logs for all the details.
and can optionally take new command-line arguments for the program.
(Contributed by Rocky Bernstein; :issue:`1393667`.)
+* The :mod:`posixfile` module has been deprecated; :func:`fcntl.lockf`
+ provides better locking.
+
The :func:`post_mortem` function, used to begin debugging a
traceback, will now use the traceback returned by :func:`sys.exc_info`
if no traceback is supplied. (Contributed by Facundo Batista;
@@ -2226,6 +2230,9 @@ changes, or look through the Subversion logs for all the details.
opcodes, returning a shorter pickle that contains the same data structure.
(Contributed by Raymond Hettinger.)
+* The :mod:`popen2` module has been deprecated; use the :mod:`subprocess`
+ module.
+
* A :func:`get_data` function was added to the :mod:`pkgutil`
module that returns the contents of resource files included
with an installed Python package. For example::
@@ -2305,6 +2312,9 @@ changes, or look through the Subversion logs for all the details.
* The :mod:`sets` module has been deprecated; it's better to
use the built-in :class:`set` and :class:`frozenset` types.
+* The :mod:`sha` module has been deprecated; use the :mod:`hashlib` module
+ instead.
+
* The :func:`shutil.copytree` function now has an optional *ignore* argument
that takes a callable object. This callable will receive each directory path
and a list of the directory's contents, and returns a list of names that
@@ -2390,6 +2400,10 @@ changes, or look through the Subversion logs for all the details.
(Contributed by Pedro Werneck and Jeffrey Yasskin;
:issue:`742598`, :issue:`1193577`.)
+* The :mod:`sqlite3` module, maintained by Gerhard Haering,
+ has been updated from version 2.3.2 in Python 2.5 to
+ version 2.4.1.
+
* The :mod:`struct` module now supports the C99 :ctype:`_Bool` type,
using the format character ``'?'``.
(Contributed by David Remahl.)
@@ -3158,6 +3172,13 @@ that may require changes to your code:
before adding elements from the iterable. This change makes the
behavior match ``list.__init__()``.
+* :meth:`object.__init__` previously accepted arbitrary arguments and
+ keyword arguments, ignoring them. In Python 2.6, this is no longer
+ allowed and will result in a :exc:`TypeError`. This will affect
+ :meth:`__init__` methods that end up calling the corresponding
+ method on :class:`object` (perhaps through using :func:`super`).
+ See :issue:`1683368` for discussion.
+
* The :class:`Decimal` constructor now accepts leading and trailing
whitespace when passed a string. Previously it would raise an
:exc:`InvalidOperation` exception. On the other hand, the
diff --git a/Misc/find_recursionlimit.py b/Misc/find_recursionlimit.py
index 295e094..2e202be 100644
--- a/Misc/find_recursionlimit.py
+++ b/Misc/find_recursionlimit.py
@@ -1,22 +1,32 @@
#! /usr/bin/env python
-"""Find the maximum recursion limit that prevents core dumps
+"""Find the maximum recursion limit that prevents interpreter termination.
This script finds the maximum safe recursion limit on a particular
platform. If you need to change the recursion limit on your system,
this script will tell you a safe upper bound. To use the new limit,
-call sys.setrecursionlimit.
+call sys.setrecursionlimit().
This module implements several ways to create infinite recursion in
Python. Different implementations end up pushing different numbers of
C stack frames, depending on how many calls through Python's abstract
C API occur.
-After each round of tests, it prints a message
-Limit of NNNN is fine.
+After each round of tests, it prints a message:
+"Limit of NNNN is fine".
-It ends when Python causes a segmentation fault because the limit is
-too high. On platforms like Mac and Windows, it should exit with a
-MemoryError.
+The highest printed value of "NNNN" is therefore the highest potentially
+safe limit for your system (which depends on the OS, architecture, but also
+the compilation flags). Please note that it is practically impossible to
+test all possible recursion paths in the interpreter, so the results of
+this test should not be trusted blindly -- although they give a good hint
+of which values are reasonable.
+
+NOTE: When the C stack space allocated by your system is exceeded due
+to excessive recursion, exact behaviour depends on the platform, although
+the interpreter will always fail in a likely brutal way: either a
+segmentation fault, a MemoryError, or just a silent abort.
+
+NB: A program that does not use __methods__ can set a higher limit.
"""
import sys
@@ -87,7 +97,10 @@ def check_limit(n, test_func_name):
test_func = globals()[test_func_name]
try:
test_func()
- except RuntimeError:
+ # AttributeError can be raised because of the way e.g. PyDict_GetItem()
+ # silences all exceptions and returns NULL, which is usually interpreted
+ # as "missing attribute".
+ except (RuntimeError, AttributeError):
pass
else:
print("Yikes!")