[Pythonjp-checkins] [python-doc-ja] push by songo****@gmail***** - What's new を Python 2.6.6 のものに置き換え. on 2011-03-19 15:56 GMT

Back to archive index

pytho****@googl***** pytho****@googl*****
2011年 3月 20日 (日) 05:27:59 JST


Revision: 71690c84ff11
Author:   Naoki INADA  <inada****@klab*****>
Date:     Sat Mar 19 08:56:24 2011
Log:      What's new を Python 2.6.6 のものに置き換え.
http://code.google.com/p/python-doc-ja/source/detail?r=71690c84ff11

Modified:
  /whatsnew/2.4.rst
  /whatsnew/2.5.rst
  /whatsnew/2.6.rst

=======================================
--- /whatsnew/2.4.rst	Sun Nov 21 07:57:58 2010
+++ /whatsnew/2.4.rst	Sat Mar 19 08:56:24 2011
@@ -680,9 +680,6 @@
        Written by Facundo Batista and implemented by Facundo Batista, Eric  
Price,
        Raymond Hettinger, Aahz, and Tim Peters.

-   http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
-      A more detailed overview of the IEEE-754 representation.
-
     http://www.lahey.com/float.htm
        The article uses Fortran code to illustrate many of the problems  
that floating-
        point inaccuracy can cause.
@@ -756,7 +753,7 @@
    :ctype:`double` to an ASCII string.

  The code for these functions came from the GLib library
-(http://developer.gnome.org/arch/gtk/glib.html), whose developers kindly
+(http://library.gnome.org/devel/glib/stable/), whose developers kindly
  relicensed the relevant functions and donated them to the Python Software
  Foundation.  The :mod:`locale` module  can now change the numeric locale,
  letting extensions such as GTK+  produce the correct results.
=======================================
--- /whatsnew/2.5.rst	Sun Nov 21 07:57:58 2010
+++ /whatsnew/2.5.rst	Sat Mar 19 08:56:24 2011
@@ -1765,7 +1765,7 @@
  http://effbot.org/zone/element-index.htm.

  ElementTree represents an XML document as a tree of element nodes. The text
-content of the document is stored as the :attr:`.text` and :attr:`.tail`
+content of the document is stored as the :attr:`text` and :attr:`tail`
  attributes of  (This is one of the major differences between ElementTree  
and
  the Document Object Model; in the DOM there are many different types of  
node,
  including :class:`TextNode`.)
=======================================
--- /whatsnew/2.6.rst	Tue Jun  8 18:28:23 2010
+++ /whatsnew/2.6.rst	Sat Mar 19 08:56:24 2011
@@ -8,7 +8,7 @@
  :Release: |release|
  :Date: |today|

-.. $Id: 2.6.rst 71282 2009-04-05 21:48:06Z georg.brandl $
+.. $Id: 2.6.rst 81887 2010-06-11 01:07:06Z andrew.kuchling $
     Rules for maintenance:

     * Anyone can add text to this document.  Do not spend very much time
@@ -84,8 +84,6 @@

  .. ========================================================================
  .. Large, PEP-level features and changes should be described here.
-.. Should there be a new section here for 3k migration?
-.. Or perhaps a more general section describing module changes/deprecation?
  .. ========================================================================

  Python 3.0
@@ -111,9 +109,9 @@
    :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.
@@ -348,9 +346,10 @@

  * The code in *BLOCK* is executed.

-* If *BLOCK* raises an exception, the :meth:`__exit__(type, value,  
traceback)`
-  is called with the exception details, the same values returned by
-  :func:`sys.exc_info`.  The method's return value controls whether the  
exception
+* If *BLOCK* raises an exception, the context manager's :meth:`__exit__`  
method
+  is called with three arguments, the exception details (``type, value,  
traceback``,
+  the same values returned by :func:`sys.exc_info`, which can also be  
``None``
+  if no exception occurred).  The method's return value controls whether  
an exception
    is re-raised: any false value re-raises the exception, and ``True`` will  
result
    in suppressing it.  You'll only rarely want to suppress the exception,  
because
    if you do the author of the code containing the ':keyword:`with`'  
statement will
@@ -461,7 +460,7 @@
     with db_transaction(db) as cursor:
         ...

-The :mod:`contextlib` module also has a :func:`nested(mgr1, mgr2, ...)`  
function
+The :mod:`contextlib` module also has a ``nested(mgr1, mgr2, ...)``  
function
  that combines a number of context managers so you don't need to write  
nested
  ':keyword:`with`' statements.  In this example, the  
single ':keyword:`with`'
  statement both starts a database transaction and acquires a thread lock::
@@ -470,8 +469,9 @@
     with nested (db_transaction(db), lock) as (cursor, locked):
         ...

-Finally, the :func:`closing(object)` function returns *object* so that it  
can be
-bound to a variable, and calls ``object.close`` at the end of the block. ::
+Finally, the :func:`closing` function returns its argument so that it can  
be
+bound to a variable, and calls the argument's ``.close()`` method at the  
end
+of the block. ::

     import urllib, sys
     from contextlib import closing
@@ -680,15 +680,15 @@
          for N in range(1, 1000, 10):
              p.apply_async(factorial, (N, d))

-    # Mark pool as closed -- no more tasks can be added.
-    p.close()
-
-    # Wait for tasks to exit
-    p.join()
-
-    # Output results
-    for k, v in sorted(d.items()):
-        print k, v
+        # Mark pool as closed -- no more tasks can be added.
+        p.close()
+
+        # Wait for tasks to exit
+        p.join()
+
+        # Output results
+        for k, v in sorted(d.items()):
+            print k, v

  This will produce the output::

@@ -833,7 +833,7 @@
         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 @@
  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 @@
      >>> 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 @@
      >>> 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 @@
  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
@@ -1481,6 +1481,13 @@

  Some smaller changes made to the core Python language are:

+* Directories and zip archives containing a :file:`__main__.py` file
+  can now be executed directly by passing their name to the
+  interpreter. The directory or zip archive is automatically inserted
+  as the first entry in sys.path.  (Suggestion and initial patch by
+  Andy Chu, subsequently revised by Phillip J. Eby and Nick Coghlan;
+  :issue:`1739468`.)
+
  * The :func:`hasattr` function was catching and ignoring all errors,
    under the assumption that they meant a :meth:`__getattr__` method
    was failing somehow and the return value of :func:`hasattr` would
@@ -1516,7 +1523,7 @@
    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
@@ -1631,11 +1638,6 @@
    :cfunc:`PyObject_HashNotImplemented`.
    (Fixed by Nick Coghlan and Amaury Forgeot d'Arc; :issue:`2235`.)

-* Changes to the :class:`Exception` interface
-  as dictated by :pep:`352` continue to be made.  For 2.6,
-  the :attr:`message` attribute is being deprecated in favor of the
-  :attr:`args` attribute.
-
  * The :exc:`GeneratorExit` exception now subclasses
    :exc:`BaseException` instead of :exc:`Exception`.  This means
    that an exception handler that does ``except Exception:``
@@ -1772,8 +1774,8 @@

  .. ======================================================================

-New, Improved, and Deprecated Modules
-=====================================
+New and Improved Modules
+========================

  As in every release, Python's standard library received a number of
  enhancements and bug fixes.  Here's a partial list of the most notable
@@ -1781,42 +1783,12 @@
  :file:`Misc/NEWS` file in the source tree for a more complete list of
  changes, or look through the Subversion logs for all the details.

-* (3.0-warning mode) Python 3.0 will feature a reorganized standard
-  library that will drop many outdated modules and rename others.
-  Python 2.6 running in 3.0-warning mode will warn about these modules
-  when they are imported.
-
-  The list of deprecated modules is:
-  :mod:`audiodev`,
-  :mod:`bgenlocations`,
-  :mod:`buildtools`,
-  :mod:`bundlebuilder`,
-  :mod:`Canvas`,
-  :mod:`compiler`,
-  :mod:`dircache`,
-  :mod:`dl`,
-  :mod:`fpformat`,
-  :mod:`gensuitemodule`,
-  :mod:`ihooks`,
-  :mod:`imageop`,
-  :mod:`imgfile`,
-  :mod:`linuxaudiodev`,
-  :mod:`mhlib`,
-  :mod:`mimetools`,
-  :mod:`multifile`,
-  :mod:`new`,
-  :mod:`pure`,
-  :mod:`statvfs`,
-  :mod:`sunaudiodev`,
-  :mod:`test.testall`, and
-  :mod:`toaiff`.
-
  * The :mod:`asyncore` and :mod:`asynchat` modules are
    being actively maintained again, and a number of patches and bugfixes
    were applied.  (Maintained by Josiah Carlson; see :issue:`1736190` for
    one patch.)

-* The :mod:`bsddb` module also has a new maintainer, Jesús Cea, and the  
package
+* The :mod:`bsddb` module also has a new maintainer, Jesús Cea Avion, 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>`__.
@@ -1826,7 +1798,7 @@

    The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol
    available, instead of restricting itself to protocol 1.
-  (Contributed by W. Barnes; :issue:`1551443`.)
+  (Contributed by W. Barnes.)

  * The :mod:`cgi` module will now read variables from the query string
    of an HTTP POST request.  This makes it possible to use form actions
@@ -1980,9 +1952,9 @@
    (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
@@ -1995,8 +1967,6 @@
    a Unicode path was used and Unicode filenames are matched within the
    directory.  (:issue:`1001604`)

-* The :mod:`gopherlib` module has been removed.
-
  * A new function in the :mod:`heapq` module, ``merge(iter1, iter2, ...)``,
    takes any number of iterables returning data in sorted
    order, and returns a new generator that returns the contents of all
@@ -2156,13 +2126,6 @@

    (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
@@ -2228,7 +2191,7 @@
    This produces better results when operating on Unix's dot-files.
    For example, ``os.path.splitext('.ipython')``
    now returns ``('.ipython', '')`` instead of ``('', '.ipython')``.
-  (:issue:`115886`)
+  (:issue:`1115886`)

    A new function, ``os.path.relpath(path, start='.')``, returns a relative  
path
    from the ``start`` path, if it's supplied, or from the current
@@ -2245,10 +2208,7 @@
    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
+* The :func:`pdb.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;
    :issue:`1106316`.)
@@ -2258,9 +2218,6 @@
    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::
@@ -2316,8 +2273,6 @@
    (Contributed by Guido van Rossum from work for Google App Engine;
    :issue:`3487`.)

-* The :mod:`rgbimg` module has been removed.
-
  * The :mod:`rlcompleter` module's :meth:`Completer.complete()` method
    will now ignore exceptions triggered while evaluating a name.
    (Fixed by Lorenz Quack; :issue:`2250`.)
@@ -2336,12 +2291,6 @@
    for that file.
    (Contributed by Christian Heimes; :issue:`1657`.)

-* 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
@@ -2404,7 +2353,7 @@
    e-mail between agents that don't manage a mail queue.  (LMTP
    implemented by Leif Hedstrom; :issue:`957003`.)

-  SMTP.starttls() now complies with :rfc:`3207` and forgets any
+  :meth:`SMTP.starttls` now complies with :rfc:`3207` and forgets any
    knowledge obtained from the server not obtained from the TLS
    negotiation itself.  (Patch contributed by Bill Fenner;
    :issue:`829951`.)
@@ -2414,9 +2363,13 @@
    environments.  TIPC addresses are 4- or 5-tuples.
    (Contributed by Alberto Bertogli; :issue:`1646`.)

-  A new function, :func:`create_connection`, takes an address
-  and connects to it using an optional timeout value, returning
-  the connected socket object.
+  A new function, :func:`create_connection`, takes an address and
+  connects to it using an optional timeout value, returning the
+  connected socket object.  This function also looks up the address's
+  type and connects to it using IPv4 or IPv6 as appropriate.  Changing
+  your code to use :func:`create_connection` instead of
+  ``socket(socket.AF_INET, ...)`` may be all that's required to make
+  your code work with IPv6.

  * The base classes in the :mod:`SocketServer` module now support
    calling a :meth:`handle_timeout` method after a span of inactivity
@@ -2803,7 +2756,7 @@

  * ``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
@@ -2821,7 +2774,7 @@
  often used in web applications. For more information about JSON, see
  http://www.json.org.

-:mod:`json` comes with support for decoding and encoding most builtin  
Python
+:mod:`json` comes with support for decoding and encoding most built-in  
Python
  types. The following example encodes and decodes a dictionary::

         >>> import json
@@ -2949,6 +2902,73 @@

  .. ======================================================================

+Deprecations and Removals
+=========================
+
+* String exceptions have been removed.  Attempting to use them raises a
+  :exc:`TypeError`.
+
+* Changes to the :class:`Exception` interface
+  as dictated by :pep:`352` continue to be made.  For 2.6,
+  the :attr:`message` attribute is being deprecated in favor of the
+  :attr:`args` attribute.
+
+* (3.0-warning mode) Python 3.0 will feature a reorganized standard
+  library that will drop many outdated modules and rename others.
+  Python 2.6 running in 3.0-warning mode will warn about these modules
+  when they are imported.
+
+  The list of deprecated modules is:
+  :mod:`audiodev`,
+  :mod:`bgenlocations`,
+  :mod:`buildtools`,
+  :mod:`bundlebuilder`,
+  :mod:`Canvas`,
+  :mod:`compiler`,
+  :mod:`dircache`,
+  :mod:`dl`,
+  :mod:`fpformat`,
+  :mod:`gensuitemodule`,
+  :mod:`ihooks`,
+  :mod:`imageop`,
+  :mod:`imgfile`,
+  :mod:`linuxaudiodev`,
+  :mod:`mhlib`,
+  :mod:`mimetools`,
+  :mod:`multifile`,
+  :mod:`new`,
+  :mod:`pure`,
+  :mod:`statvfs`,
+  :mod:`sunaudiodev`,
+  :mod:`test.testall`, and
+  :mod:`toaiff`.
+
+* The :mod:`gopherlib` module has been removed.
+
+* 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.
+
+* The :mod:`posixfile` module has been deprecated; :func:`fcntl.lockf`
+  provides better locking.
+
+* The :mod:`popen2` module has been deprecated; use the :mod:`subprocess`
+  module.
+
+* The :mod:`rgbimg` module has been removed.
+
+* 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.
+
+
+.. ======================================================================
+

  Build and C API Changes
  =======================
@@ -2972,10 +2992,37 @@
    architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), or both.
    (Contributed by Ronald Oussoren.)

+* A new function added in Python 2.6.6, :cfunc:`PySys_SetArgvEx`, sets
+  the value of ``sys.argv`` and can optionally update ``sys.path`` to
+  include the directory containing the script named by ``sys.argv[0]``
+  depending on the value of an *updatepath* parameter.
+
+  This function was added to close a security hole for applications
+  that embed Python.  The old function, :cfunc:`PySys_SetArgv`, would
+  always update ``sys.path``, and sometimes it would add the current
+  directory.  This meant that, if you ran an application embedding
+  Python in a directory controlled by someone else, attackers could
+  put a Trojan-horse module in the directory (say, a file named
+  :file:`os.py`) that your application would then import and run.
+
+  If you maintain a C/C++ application that embeds Python, check
+  whether you're calling :cfunc:`PySys_SetArgv` and carefully consider
+  whether the application should be using :cfunc:`PySys_SetArgvEx`
+  with *updatepath* set to false.  Note that using this function will
+  break compatibility with Python versions 2.6.5 and earlier; if you
+  have to continue working with earlier versions, you can leave
+  the call to :cfunc:`PySys_SetArgv` alone and call
+  ``PyRun_SimpleString("sys.path.pop(0)\n")`` afterwards to discard
+  the first ``sys.path`` component.
+
+  Security issue reported as `CVE-2008-5983
+  <http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5983>`_;
+  discussed in :issue:`5753`, and fixed by Antoine Pitrou.
+
  * The BerkeleyDB module now has a C API object, available as
    ``bsddb.db.api``.   This object can be used by other C extensions
    that wish to use the :mod:`bsddb` module for their own purposes.
-  (Contributed by Duncan Grisby; :issue:`1551895`.)
+  (Contributed by Duncan Grisby.)

  * The new buffer interface, previously described in
    `the PEP 3118 section <#pep-3118-revised-buffer-protocol>`__,
@@ -3274,6 +3321,15 @@
    scoping rules, also cause warnings because such comparisons are forbidden
    entirely in 3.0.

+For applications that embed Python:
+
+* The :cfunc:`PySys_SetArgvEx` function was added in Python 2.6.6,
+  letting applications close a security hole when the existing
+  :cfunc:`PySys_SetArgv` function was used.  Check whether you're
+  calling :cfunc:`PySys_SetArgv` and carefully consider whether the
+  application should be using :cfunc:`PySys_SetArgvEx` with
+  *updatepath* set to false.
+
  .. ======================================================================





Pythonjp-checkins メーリングリストの案内
Back to archive index