diff --git a/.bzrignore b/.bzrignore index e0f006555b4..2527052a1ba 100644 --- a/.bzrignore +++ b/.bzrignore @@ -13,6 +13,7 @@ Makefile.pre platform pyconfig.h libpython*.a +libpython*.so* python.exe python-gdb.py reflog.txt diff --git a/.hgignore b/.hgignore index 5df8684bcb1..8c402ff3c62 100644 --- a/.hgignore +++ b/.hgignore @@ -38,14 +38,13 @@ Parser/pgen.stamp$ syntax: glob python.exe-gdb.py libpython*.a +libpython*.so* *.swp *.o *.pyc *.pyo *.pyd *.cover -*.orig -*.rej *~ Lib/lib2to3/*.pickle Lib/test/data/* diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt index 774192e812f..1e44cf7d027 100644 --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -199,6 +199,7 @@ docs@python.org), and we'll be glad to correct the problem. * Kalle Svensson * Jim Tittsler * David Turner + * Sandro Tosi * Ville Vainio * Martijn Vries * Charles G. Waldman diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst index 927368d7a10..188fac874e2 100644 --- a/Doc/c-api/veryhigh.rst +++ b/Doc/c-api/veryhigh.rst @@ -32,7 +32,7 @@ the same library that the Python runtime is using. prepared exactly as those which are passed to a C program's :cfunc:`main` function. It is important to note that the argument list may be modified (but the contents of the strings pointed to by the argument list are not). The return - value will be ```0``` if the interpreter exits normally (ie, without an + value will be ``0`` if the interpreter exits normally (ie, without an exception), ``1`` if the interpreter exits due to an exception, or ``2`` if the parameter list does not represent a valid Python command line. diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index 28af893648b..63eca411e57 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -72,8 +72,8 @@ setup script). Indirectly provides the :class:`distutils.dist.Distribution` and | | be built | :class:`distutils.core.Extension` | +--------------------+--------------------------------+-------------------------------------------------------------+ | *classifiers* | A list of categories for the | The list of available | - | | package | categorizations is at | - | | | http://pypi.python.org/pypi?:action=list_classifiers. | + | | package | categorizations is available on `PyPI | + | | | `_. | +--------------------+--------------------------------+-------------------------------------------------------------+ | *distclass* | the :class:`Distribution` | A subclass of | | | class to use | :class:`distutils.core.Distribution` | diff --git a/Doc/glossary.rst b/Doc/glossary.rst index fa811442c2e..eb72558ecc7 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -27,12 +27,13 @@ Glossary :ref:`2to3-reference`. abstract base class - :ref:`abstract-base-classes` complement :term:`duck-typing` by + Abstract base classes complement :term:`duck-typing` by providing a way to define interfaces when other techniques like - :func:`hasattr` would be clumsy. Python comes with many built-in ABCs for + :func:`hasattr` would be clumsy or subtly wrong (for example with + :ref:`magic methods `). Python comes with many built-in ABCs for data structures (in the :mod:`collections` module), numbers (in the :mod:`numbers` module), and streams (in the :mod:`io` module). You can - create your own ABC with the :mod:`abc` module. + create your own ABCs with the :mod:`abc` module. argument A value passed to a function or method, assigned to a named local @@ -424,8 +425,8 @@ Glossary mapping A container object that supports arbitrary key lookups and implements the methods specified in the :class:`Mapping` or :class:`MutableMapping` - :ref:`abstract base classes `. Examples include - :class:`dict`, :class:`collections.defaultdict`, + :ref:`abstract base classes `. Examples + include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` and :class:`collections.Counter`. metaclass diff --git a/Doc/install/index.rst b/Doc/install/index.rst index 915654d4ea8..e8037067b03 100644 --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -72,7 +72,7 @@ In that case, you would download the installer appropriate to your platform and do the obvious thing with it: run it if it's an executable installer, ``rpm --install`` it if it's an RPM, etc. You don't need to run Python or a setup script, you don't need to compile anything---you might not even need to read any -instructions (although it's always a good idea to do so anyways). +instructions (although it's always a good idea to do so anyway). Of course, things will not always be that easy. You might be interested in a module distribution that doesn't have an easy-to-use installer for your diff --git a/Doc/library/__builtin__.rst b/Doc/library/__builtin__.rst index ec189b6c9fb..673d74f984b 100644 --- a/Doc/library/__builtin__.rst +++ b/Doc/library/__builtin__.rst @@ -8,7 +8,9 @@ This module provides direct access to all 'built-in' identifiers of Python; for example, ``__builtin__.open`` is the full name for the built-in function -:func:`open`. +:func:`open`. See :ref:`built-in-funcs` and :ref:`built-in-consts` for +documentation. + This module is not normally accessed explicitly by most applications, but can be useful in modules that provide objects with the same name as a built-in value, diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst index 9f70b024c40..0408f302069 100644 --- a/Doc/library/abc.rst +++ b/Doc/library/abc.rst @@ -9,8 +9,8 @@ .. versionadded:: 2.6 -This module provides the infrastructure for defining an :term:`abstract base -class` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this +This module provides the infrastructure for defining :term:`abstract base +classes ` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this was added to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 0f098f716e8..9f6d079253b 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -28,7 +28,7 @@ Python's general purpose built-in containers, :class:`dict`, :class:`list`, ===================== ==================================================================== =========================== In addition to the concrete container classes, the collections module provides -:ref:`abstract-base-classes` that can be used to test whether a class provides a +:ref:`collections-abstract-base-classes` that can be used to test whether a class provides a particular interface, for example, whether it is hashable or a mapping. .. seealso:: @@ -851,8 +851,8 @@ If a new entry overwrites an existing entry, the original insertion position is changed and moved to the end:: class LastUpdatedOrderedDict(OrderedDict): - 'Store items in the order the keys were last added' + def __setitem__(self, key, value): if key in self: del self[key] @@ -871,10 +871,10 @@ so that the counter remembers the order elements are first encountered:: return self.__class__, (OrderedDict(self),) -.. _abstract-base-classes: +.. _collections-abstract-base-classes: -ABCs - abstract base classes ----------------------------- +Collections Abstract Base Classes +--------------------------------- The collections module offers the following :term:`ABCs `: @@ -888,7 +888,7 @@ ABC Inherits from Abstract Methods Mixin :class:`Sized` ``__len__`` :class:`Callable` ``__call__`` -:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``. ``__iter__``, ``__reversed__``, +:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``, ``__iter__``, ``__reversed__``, :class:`Iterable`, ``index``, and ``count`` :class:`Container` diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst index 80e792c9521..0db83374811 100644 --- a/Doc/library/constants.rst +++ b/Doc/library/constants.rst @@ -1,3 +1,5 @@ +.. _built-in-consts: + Built-in Constants ================== diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 635b4653245..e31dff8f84c 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -583,7 +583,7 @@ available. They are listed here in alphabetical order. Two objects with non-overlapping lifetimes may have the same :func:`id` value. - .. impl-detail:: This is the address of the object. + .. impl-detail:: This is the address of the object in memory. .. function:: input([prompt]) diff --git a/Doc/library/numbers.rst b/Doc/library/numbers.rst index a0a825f7b20..f46e8ac824e 100644 --- a/Doc/library/numbers.rst +++ b/Doc/library/numbers.rst @@ -7,9 +7,9 @@ .. versionadded:: 2.6 -The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric abstract -base classes which progressively define more operations. None of the types -defined in this module can be instantiated. +The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric +:term:`abstract base classes ` which progressively define +more operations. None of the types defined in this module can be instantiated. .. class:: Number diff --git a/Doc/library/ossaudiodev.rst b/Doc/library/ossaudiodev.rst index 37ead5d68d3..848eca5dfca 100644 --- a/Doc/library/ossaudiodev.rst +++ b/Doc/library/ossaudiodev.rst @@ -17,7 +17,7 @@ the standard audio interface for Linux and recent versions of FreeBSD. ALSA is in the standard kernel as of 2.5.x. Presumably if you use ALSA, you'll have to make sure its OSS compatibility layer is active to use ossaudiodev, but you're gonna need it for the vast - majority of Linux audio apps anyways. + majority of Linux audio apps anyway. Sounds like things are also complicated for other BSDs. In response to my python-dev query, Thomas Wouters said: diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index 1e2350fff8b..87e2fbe2e9e 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -10,29 +10,6 @@ The Python Profilers .. module:: profile :synopsis: Python source profiler. -.. index:: single: InfoSeek Corporation - -Copyright © 1994, by InfoSeek Corporation, all rights reserved. - -Written by James Roskind. [#]_ - -Permission to use, copy, modify, and distribute this Python software and its -associated documentation for any purpose (subject to the restriction in the -following sentence) without fee is hereby granted, provided that the above -copyright notice appears in all copies, and that both that copyright notice and -this permission notice appear in supporting documentation, and that the name of -InfoSeek not be used in advertising or publicity pertaining to distribution of -the software without specific, written prior permission. This permission is -explicitly restricted to the copying and modification of the software to remain -in Python, compiled Python, or other languages (such as C) wherein the modified -or derived code is exclusively imported into a Python module. - -INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT -SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .. _profiler-introduction: @@ -65,7 +42,6 @@ The Python standard library provides three different profilers: :mod:`cProfile`. Adds significant overhead to profiled programs. If you're trying to extend the profiler in some way, the task might be easier with this module. - Copyright © 1994, by InfoSeek Corporation. .. versionchanged:: 2.4 Now also reports the time spent in calls to built-in functions and methods. diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst index ed622addc9b..1082d2a37b4 100644 --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -161,24 +161,31 @@ Directory and files operations .. function:: move(src, dst) - Recursively move a file or directory to another location. + Recursively move a file or directory (*src*) to another location (*dst*). - Uses :func:`os.rename` to perform the move. If it fails, for reasons such as - when *src* and *dst* are on different filesystems or in case of windows where - rename is not supported when *dst* exists, fallback to copying *src* (with - :func:`copy2`) to the *dst* and then remove *src*. + If the destination is a directory or a symlink to a directory, then *src* is + moved inside that directory. + + The destination directory must not already exist. If the destination already + exists but is not a directory, it may be overwritten depending on + :func:`os.rename` semantics. + + If the destination is on the current filesystem, then :func:`os.rename` is + used. Otherwise, *src* is copied (using :func:`copy2`) to *dst* and then + removed. .. versionadded:: 2.3 .. exception:: Error - This exception collects exceptions that raised during a multi-file operation. For - :func:`copytree`, the exception argument is a list of 3-tuples (*srcname*, - *dstname*, *exception*). + This exception collects exceptions that are raised during a multi-file + operation. For :func:`copytree`, the exception argument is a list of 3-tuples + (*srcname*, *dstname*, *exception*). .. versionadded:: 2.3 + .. _shutil-example: copytree example @@ -277,7 +284,7 @@ Archives operations .. function:: get_archive_formats() - Returns a list of supported formats for archiving. + Return a list of supported formats for archiving. Each element of the returned sequence is a tuple ``(name, description)`` By default :mod:`shutil` provides these formats: @@ -295,7 +302,7 @@ Archives operations .. function:: register_archive_format(name, function, [extra_args, [description]]) - Registers an archiver for the format *name*. *function* is a callable that + Register an archiver for the format *name*. *function* is a callable that will be used to invoke the archiver. If given, *extra_args* is a sequence of ``(name, value)`` that will be diff --git a/Doc/license.rst b/Doc/license.rst index 7931cd0f2d0..f56602900f9 100644 --- a/Doc/license.rst +++ b/Doc/license.rst @@ -536,36 +536,6 @@ The :mod:`Cookie` module contains the following notice:: PERFORMANCE OF THIS SOFTWARE. -Profiling ---------- - -The :mod:`profile` and :mod:`pstats` modules contain the following notice:: - - Copyright 1994, by InfoSeek Corporation, all rights reserved. - Written by James Roskind - - Permission to use, copy, modify, and distribute this Python software - and its associated documentation for any purpose (subject to the - restriction in the following sentence) without fee is hereby granted, - provided that the above copyright notice appears in all copies, and - that both that copyright notice and this permission notice appear in - supporting documentation, and that the name of InfoSeek not be used in - advertising or publicity pertaining to distribution of the software - without specific, written prior permission. This permission is - explicitly restricted to the copying and modification of the software - to remain in Python, compiled Python, or other languages (such as C) - wherein the modified or derived code is exclusively imported into a - Python module. - - INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS. IN NO EVENT SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY - SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - Execution tracing ----------------- diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv index a97b7646e73..18049889219 100644 --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -5,7 +5,6 @@ c-api/sequence,,:i2,o[i1:i2] c-api/sequence,,:i2,o[i1:i2] = v c-api/sequence,,:i2,del o[i1:i2] c-api/unicode,,:end,str[start:end] -distutils/apiref,,:action,http://pypi.python.org/pypi?:action=list_classifiers distutils/setupscript,,::, extending/embedding,,:numargs,"if(!PyArg_ParseTuple(args, "":numargs""))" extending/extending,,:set,"if (PyArg_ParseTuple(args, ""O:set_callback"", &temp)) {" diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index f9a2d114002..c3640a05f7c 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -556,24 +556,24 @@ occurs within the definition of a class. Name mangling is helpful for letting subclasses override methods without breaking intraclass method calls. For example:: - class Mapping: - def __init__(self, iterable): - self.items_list = [] - self.__update(iterable) + class Mapping: + def __init__(self, iterable): + self.items_list = [] + self.__update(iterable) - def update(self, iterable): - for item in iterable: - self.items_list.append(item) + def update(self, iterable): + for item in iterable: + self.items_list.append(item) - __update = update # private copy of original update() method + __update = update # private copy of original update() method - class MappingSubclass(Mapping): + class MappingSubclass(Mapping): - def update(self, keys, values): - # provides new signature for update() - # but does not break __init__() - for item in zip(keys, values): - self.items_list.append(item) + def update(self, keys, values): + # provides new signature for update() + # but does not break __init__() + for item in zip(keys, values): + self.items_list.append(item) Note that the mangling rules are designed mostly to avoid accidents; it still is possible to access or modify a variable that is considered private. This can diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst index df93af20e91..0cdba6e6e74 100644 --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -166,6 +166,8 @@ also be ``.pyw``, in that case, the console window that normally appears is suppressed. +.. _tut-source-encoding: + Source Code Encoding -------------------- diff --git a/Lib/pstats.py b/Lib/pstats.py index f3c52d956e5..3dc61d69ee9 100644 --- a/Lib/pstats.py +++ b/Lib/pstats.py @@ -1,13 +1,9 @@ """Class for printing reports on profiled python code.""" -# Class for printing reports on profiled python code. rev 1.0 4/1/94 -# # Written by James Roskind # Based on prior profile module by Sjoerd Mullender... # which was hacked somewhat by: Guido van Rossum -"""Class for profiling Python code.""" - # Copyright Disney Enterprises, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement # diff --git a/Tools/scripts/analyze_dxp.py b/Tools/scripts/analyze_dxp.py old mode 100644 new mode 100755 index bde931e7503..1224383e2d9 --- a/Tools/scripts/analyze_dxp.py +++ b/Tools/scripts/analyze_dxp.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python """ Some helper functions to analyze the output of sys.getdxp() (which is only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE). diff --git a/Tools/scripts/cleanfuture.py b/Tools/scripts/cleanfuture.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/combinerefs.py b/Tools/scripts/combinerefs.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/db2pickle.py b/Tools/scripts/db2pickle.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/diff.py b/Tools/scripts/diff.py old mode 100644 new mode 100755 index 52dcab1ff9c..513e2a7112d --- a/Tools/scripts/diff.py +++ b/Tools/scripts/diff.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python """ Command line interface to difflib.py providing diffs in four formats: * ndiff: lists every line and highlights interline changes. diff --git a/Tools/scripts/find_recursionlimit.py b/Tools/scripts/find_recursionlimit.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/hotshotmain.py b/Tools/scripts/hotshotmain.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/mailerdaemon.py b/Tools/scripts/mailerdaemon.py old mode 100644 new mode 100755 index 85f90aa611f..a1eeaadf9fe --- a/Tools/scripts/mailerdaemon.py +++ b/Tools/scripts/mailerdaemon.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python """mailerdaemon - classes to parse mailer-daemon messages""" import rfc822 diff --git a/Tools/scripts/md5sum.py b/Tools/scripts/md5sum.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py old mode 100644 new mode 100755 index bc8bc795333..7398e7820d5 --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python import re import sys import shutil diff --git a/Tools/scripts/pickle2db.py b/Tools/scripts/pickle2db.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py old mode 100644 new mode 100755 diff --git a/Tools/scripts/redemo.py b/Tools/scripts/redemo.py old mode 100644 new mode 100755 index de7f3c4a219..2b5ade44aa2 --- a/Tools/scripts/redemo.py +++ b/Tools/scripts/redemo.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python """Basic regular expression demostration facility (Perl style syntax).""" from Tkinter import *