Branch merge

This commit is contained in:
Éric Araujo 2011-07-29 14:23:13 +02:00
commit fea8ac4772
34 changed files with 69 additions and 108 deletions

View File

@ -13,6 +13,7 @@ Makefile.pre
platform
pyconfig.h
libpython*.a
libpython*.so*
python.exe
python-gdb.py
reflog.txt

View File

@ -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/*

View File

@ -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

View File

@ -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.

View File

@ -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 |
| | | <http://pypi.python.org/pypi?:action=list_classifiers>`_. |
+--------------------+--------------------------------+-------------------------------------------------------------+
| *distclass* | the :class:`Distribution` | A subclass of |
| | class to use | :class:`distutils.core.Distribution` |

View File

@ -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 <new-style-special-lookup>`). 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 <abstract-base-classes>`. Examples include
:class:`dict`, :class:`collections.defaultdict`,
:ref:`abstract base classes <collections-abstract-base-classes>`. Examples
include :class:`dict`, :class:`collections.defaultdict`,
:class:`collections.OrderedDict` and :class:`collections.Counter`.
metaclass

View File

@ -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

View File

@ -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,

View File

@ -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 <abstract base class>` (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.)

View File

@ -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 <abstract base class>`:
@ -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`

View File

@ -1,3 +1,5 @@
.. _built-in-consts:
Built-in Constants
==================

View File

@ -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])

View File

@ -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 <abstract base class>` which progressively define
more operations. None of the types defined in this module can be instantiated.
.. class:: Number

View File

@ -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:

View File

@ -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.

View File

@ -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

View File

@ -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
-----------------

View File

@ -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)) {"

1 c-api/arg :ref PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
5 c-api/sequence :i2 o[i1:i2] = v
6 c-api/sequence :i2 del o[i1:i2]
7 c-api/unicode :end str[start:end]
distutils/apiref :action http://pypi.python.org/pypi?:action=list_classifiers
8 distutils/setupscript ::
9 extending/embedding :numargs if(!PyArg_ParseTuple(args, ":numargs"))
10 extending/extending :set if (PyArg_ParseTuple(args, "O:set_callback", &temp)) {

View File

@ -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

View File

@ -166,6 +166,8 @@ also be ``.pyw``, in that case, the console window that normally appears is
suppressed.
.. _tut-source-encoding:
Source Code Encoding
--------------------

View File

@ -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
#

1
Tools/scripts/analyze_dxp.py Normal file → Executable file
View File

@ -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).

0
Tools/scripts/cleanfuture.py Normal file → Executable file
View File

0
Tools/scripts/combinerefs.py Normal file → Executable file
View File

0
Tools/scripts/db2pickle.py Normal file → Executable file
View File

1
Tools/scripts/diff.py Normal file → Executable file
View File

@ -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.

0
Tools/scripts/find_recursionlimit.py Normal file → Executable file
View File

0
Tools/scripts/hotshotmain.py Normal file → Executable file
View File

1
Tools/scripts/mailerdaemon.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
"""mailerdaemon - classes to parse mailer-daemon messages"""
import rfc822

0
Tools/scripts/md5sum.py Normal file → Executable file
View File

1
Tools/scripts/patchcheck.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
import re
import sys
import shutil

0
Tools/scripts/pickle2db.py Normal file → Executable file
View File

0
Tools/scripts/pysource.py Normal file → Executable file
View File

1
Tools/scripts/redemo.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
"""Basic regular expression demostration facility (Perl style syntax)."""
from Tkinter import *