Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/whatsnew/2.6.rst

    r2 r391  
    66
    77:Author: A.M. Kuchling (amk at amk.ca)
    8 :Release: |release|
    9 :Date: |today|
    10 
    11 .. $Id: 2.6.rst 78304 2010-02-22 14:55:17Z andrew.kuchling $
     8
     9.. $Id$
    1210   Rules for maintenance:
    1311
     
    110108
    111109Python 3.0 adds several new built-in functions and changes the
    112 semantics of some existing built-ins.  Functions that are new in 3.0
     110semantics of some existing builtins.  Functions that are new in 3.0
    113111such as :func:`bin` have simply been added to Python 2.6, but existing
    114 built-ins haven't been changed; instead, the :mod:`future_builtins`
     112builtins haven't been changed; instead, the :mod:`future_builtins`
    115113module has versions with the new 3.0 semantics.  Code written to be
    116114compatible with 3.0 can do ``from future_builtins import hex, map`` as
     
    122120code to 3.0.  The value of this switch is available
    123121to Python code as the boolean variable :data:`sys.py3kwarning`,
    124 and to C extension code as :cdata:`Py_Py3kWarningFlag`.
     122and to C extension code as :c:data:`Py_Py3kWarningFlag`.
    125123
    126124.. seealso::
     
    233231.. seealso::
    234232
    235    :ref:`documenting-index`
     233   `Documenting Python <http://docs.python.org/devguide/documenting.html>`__
    236234       Describes how to write for Python's documentation.
    237235
     
    612610        print 'Factorial', N, '=', result
    613611
    614 A :class:`Queue` is used to communicate the input parameter *N* and
    615 the result.  The :class:`Queue` object is stored in a global variable.
     612A :class:`Queue` is used to communicate the result of the factorial.
     613The :class:`Queue` object is stored in a global variable.
    616614The child process will use the value of the variable when the child
    617615was created; because it's a :class:`Queue`, parent and child can use
     
    834832           return str(self)
    835833
    836 There's also a :func:`format` built-in that will format a single
     834There's also a :func:`format` builtin that will format a single
    837835value.  It calls the type's :meth:`__format__` method with the
    838836provided specifier::
     
    976974
    977975At the C level, Python 3.0 will rename the existing 8-bit
    978 string type, called :ctype:`PyStringObject` in Python 2.x,
    979 to :ctype:`PyBytesObject`.  Python 2.6 uses ``#define``
    980 to support using the names :cfunc:`PyBytesObject`,
    981 :cfunc:`PyBytes_Check`, :cfunc:`PyBytes_FromStringAndSize`,
     976string type, called :c:type:`PyStringObject` in Python 2.x,
     977to :c:type:`PyBytesObject`.  Python 2.6 uses ``#define``
     978to support using the names :c:func:`PyBytesObject`,
     979:c:func:`PyBytes_Check`, :c:func:`PyBytes_FromStringAndSize`,
    982980and all the other functions and macros used with strings.
    983981
     
    10111009
    10121010There's also a corresponding C API, with
    1013 :cfunc:`PyByteArray_FromObject`,
    1014 :cfunc:`PyByteArray_FromStringAndSize`,
     1011:c:func:`PyByteArray_FromObject`,
     1012:c:func:`PyByteArray_FromStringAndSize`,
    10151013and various other functions.
    10161014
     
    10681066  over an in-memory buffer.
    10691067
     1068  .. index::
     1069     single: universal newlines; What's new
     1070
    10701071* :class:`TextIOBase`: Provides functions for reading and writing
    10711072  strings (remember, strings will be Unicode in Python 3.0),
    1072   and supporting universal newlines.  :class:`TextIOBase` defines
     1073  and supporting :term:`universal newlines`.  :class:`TextIOBase` defines
    10731074  the :meth:`readline` method and supports iteration upon
    10741075  objects.
     
    11311132.. XXX PyObject_GetBuffer not documented in c-api
    11321133
    1133 The *flags* argument to :cfunc:`PyObject_GetBuffer` specifies
     1134The *flags* argument to :c:func:`PyObject_GetBuffer` specifies
    11341135constraints upon the memory returned.  Some examples are:
    11351136
     
    11421143   Fortran-contiguous (first dimension varies the fastest) array layout.
    11431144
    1144 Two new argument codes for :cfunc:`PyArg_ParseTuple`,
     1145Two new argument codes for :c:func:`PyArg_ParseTuple`,
    11451146``s*`` and ``z*``, return locked buffer objects for a parameter.
    11461147
     
    11651166containing a metaclass called :class:`ABCMeta`, special handling of
    11661167this metaclass by the :func:`isinstance` and :func:`issubclass`
    1167 built-ins, and a collection of basic ABCs that the Python developers
     1168builtins, and a collection of basic ABCs that the Python developers
    11681169think will be widely useful.  Future versions of Python will probably
    11691170add more ABCs.
     
    13191320    47
    13201321
    1321 The :func:`oct` built-in still returns numbers
     1322The :func:`oct` builtin still returns numbers
    13221323prefixed with a leading zero, and a new :func:`bin`
    1323 built-in returns the binary representation for a number::
     1324builtin returns the binary representation for a number::
    13241325
    13251326    >>> oct(42)
     
    13301331    '0b10101101'
    13311332
    1332 The :func:`int` and :func:`long` built-ins will now accept the "0o"
     1333The :func:`int` and :func:`long` builtins will now accept the "0o"
    13331334and "0b" prefixes when base-8 or base-2 are requested, or when the
    13341335*base* argument is zero (signalling that the base used should be
     
    14161417and can be used as array indexes and slice boundaries.
    14171418
    1418 In Python 3.0, the PEP slightly redefines the existing built-ins
     1419In Python 3.0, the PEP slightly redefines the existing builtins
    14191420:func:`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new
    14201421one, :func:`math.trunc`, that's been backported to Python 2.6.
     
    15241525  (Contributed by Amaury Forgeot d'Arc; :issue:`3473`.)
    15251526
    1526 * A new built-in, ``next(iterator, [default])`` returns the next item
     1527* A new builtin, ``next(iterator, [default])`` returns the next item
    15271528  from the specified iterator.  If the *default* argument is supplied,
    15281529  it will be returned if *iterator* has been exhausted; otherwise,
     
    16361637  assigning ``None`` was implemented as an override.  At the
    16371638  C level, extensions can set ``tp_hash`` to
    1638   :cfunc:`PyObject_HashNotImplemented`.
     1639  :c:func:`PyObject_HashNotImplemented`.
    16391640  (Fixed by Nick Coghlan and Amaury Forgeot d'Arc; :issue:`2235`.)
    16401641
     
    17061707  the Python core.  Extension modules may not necessarily be compatible with
    17071708  this cache,
    1708   so they must explicitly add :cmacro:`Py_TPFLAGS_HAVE_VERSION_TAG`
     1709  so they must explicitly add :c:macro:`Py_TPFLAGS_HAVE_VERSION_TAG`
    17091710  to the module's ``tp_flags`` field to enable the method cache.
    17101711  (To be compatible with the method cache, the extension module's code
     
    17891790  one patch.)
    17901791
    1791 * The :mod:`bsddb` module also has a new maintainer, Jesús Cea, and the package
     1792* The :mod:`bsddb` module also has a new maintainer, Jesús Cea Avion, and the package
    17921793  is now available as a standalone package.  The web page for the package is
    17931794  `www.jcea.es/programacion/pybsddb.htm
     
    19531954
    19541955* The :func:`reduce` built-in function is also available in the
    1955   :mod:`functools` module.  In Python 3.0, the built-in has been
     1956  :mod:`functools` module.  In Python 3.0, the builtin has been
    19561957  dropped and :func:`reduce` is only available from :mod:`functools`;
    1957   currently there are no plans to drop the built-in in the 2.x series.
     1958  currently there are no plans to drop the builtin in the 2.x series.
    19581959  (Patched by Christian Heimes; :issue:`1739906`.)
    19591960
     
    21922193  For example, ``os.path.splitext('.ipython')``
    21932194  now returns ``('.ipython', '')`` instead of ``('', '.ipython')``.
    2194   (:issue:`115886`)
     2195  (:issue:`1115886`)
    21952196
    21962197  A new function, ``os.path.relpath(path, start='.')``, returns a relative path
     
    22852286
    22862287* The :mod:`select` module now has wrapper functions
    2287   for the Linux :cfunc:`epoll` and BSD :cfunc:`kqueue` system calls.
     2288  for the Linux :c:func:`epoll` and BSD :c:func:`kqueue` system calls.
    22882289  :meth:`modify` method was added to the existing :class:`poll`
    22892290  objects; ``pollobj.modify(fd, eventmask)`` takes a file descriptor
     
    23182319  to be used; when a signal is received, a byte is written to that
    23192320  file descriptor.  There's also a C-level function,
    2320   :cfunc:`PySignal_SetWakeupFd`, for setting the descriptor.
     2321  :c:func:`PySignal_SetWakeupFd`, for setting the descriptor.
    23212322
    23222323  Event loops will use this by opening a pipe to create two descriptors,
     
    23242325  will be passed to :func:`set_wakeup_fd`, and the readable descriptor
    23252326  will be added to the list of descriptors monitored by the event loop via
    2326   :cfunc:`select` or :cfunc:`poll`.
     2327  :c:func:`select` or :c:func:`poll`.
    23272328  On receiving a signal, a byte will be written and the main event loop
    23282329  will be woken up, avoiding the need to poll.
     
    23852386  version 2.4.1.
    23862387
    2387 * The :mod:`struct` module now supports the C99 :ctype:`_Bool` type,
     2388* The :mod:`struct` module now supports the C99 :c:type:`_Bool` type,
    23882389  using the format character ``'?'``.
    23892390  (Contributed by David Remahl.)
     
    23932394  On Windows, :meth:`send_signal` only supports the :const:`SIGTERM`
    23942395  signal, and all these methods are aliases for the Win32 API function
    2395   :cfunc:`TerminateProcess`.
     2396  :c:func:`TerminateProcess`.
    23962397  (Contributed by Christian Heimes.)
    23972398
     
    27572758* ``filter(predicate, iterable)``,
    27582759  ``map(func, iterable1, ...)``: the 3.0 versions
    2759   return iterators, unlike the 2.x built-ins which return lists.
     2760  return iterators, unlike the 2.x builtins which return lists.
    27602761
    27612762* ``hex(value)``, ``oct(value)``: instead of calling the
     
    29782979* Python now must be compiled with C89 compilers (after 19
    29792980  years!).  This means that the Python source tree has dropped its
    2980   own implementations of :cfunc:`memmove` and :cfunc:`strerror`, which
     2981  own implementations of :c:func:`memmove` and :c:func:`strerror`, which
    29812982  are in the C89 standard library.
    29822983
     
    30003001* The new buffer interface, previously described in
    30013002  `the PEP 3118 section <#pep-3118-revised-buffer-protocol>`__,
    3002   adds :cfunc:`PyObject_GetBuffer` and :cfunc:`PyBuffer_Release`,
     3003  adds :c:func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release`,
    30033004  as well as a few other functions.
    30043005
     
    30083009  was reading from or writing to the object.  In 2.6 file objects
    30093010  have a reference count, manipulated by the
    3010   :cfunc:`PyFile_IncUseCount` and :cfunc:`PyFile_DecUseCount`
     3011  :c:func:`PyFile_IncUseCount` and :c:func:`PyFile_DecUseCount`
    30113012  functions.  File objects can't be closed unless the reference count
    3012   is zero.  :cfunc:`PyFile_IncUseCount` should be called while the GIL
     3013  is zero.  :c:func:`PyFile_IncUseCount` should be called while the GIL
    30133014  is still held, before carrying out an I/O operation using the
    3014   ``FILE *`` pointer, and :cfunc:`PyFile_DecUseCount` should be called
     3015  ``FILE *`` pointer, and :c:func:`PyFile_DecUseCount` should be called
    30153016  immediately after the GIL is re-acquired.
    30163017  (Contributed by Antoine Pitrou and Gregory P. Smith.)
     
    30183019* Importing modules simultaneously in two different threads no longer
    30193020  deadlocks; it will now raise an :exc:`ImportError`.  A new API
    3020   function, :cfunc:`PyImport_ImportModuleNoBlock`, will look for a
     3021  function, :c:func:`PyImport_ImportModuleNoBlock`, will look for a
    30213022  module in ``sys.modules`` first, then try to import it after
    30223023  acquiring an import lock.  If the import lock is held by another
     
    30253026
    30263027* Several functions return information about the platform's
    3027   floating-point support.  :cfunc:`PyFloat_GetMax` returns
     3028  floating-point support.  :c:func:`PyFloat_GetMax` returns
    30283029  the maximum representable floating point value,
    3029   and :cfunc:`PyFloat_GetMin` returns the minimum
    3030   positive value.  :cfunc:`PyFloat_GetInfo` returns an object
     3030  and :c:func:`PyFloat_GetMin` returns the minimum
     3031  positive value.  :c:func:`PyFloat_GetInfo` returns an object
    30313032  containing more information from the :file:`float.h` file, such as
    30323033  ``"mant_dig"`` (number of digits in the mantissa), ``"epsilon"``
     
    30363037
    30373038* C functions and methods that use
    3038   :cfunc:`PyComplex_AsCComplex` will now accept arguments that
     3039  :c:func:`PyComplex_AsCComplex` will now accept arguments that
    30393040  have a :meth:`__complex__` method.  In particular, the functions in the
    30403041  :mod:`cmath` module will now accept objects with this method.
     
    30503051  integers and strings to the module's dictionary in the
    30513052  ``init*`` function.  Python 2.6 finally defines standard macros
    3052   for adding values to a module, :cmacro:`PyModule_AddStringMacro`
    3053   and :cmacro:`PyModule_AddIntMacro()`.  (Contributed by
     3053  for adding values to a module, :c:macro:`PyModule_AddStringMacro`
     3054  and :c:macro:`PyModule_AddIntMacro()`.  (Contributed by
    30543055  Christian Heimes.)
    30553056
    30563057* Some macros were renamed in both 3.0 and 2.6 to make it clearer that
    30573058  they are macros,
    3058   not functions.  :cmacro:`Py_Size()` became :cmacro:`Py_SIZE()`,
    3059   :cmacro:`Py_Type()` became :cmacro:`Py_TYPE()`, and
    3060   :cmacro:`Py_Refcnt()` became :cmacro:`Py_REFCNT()`.
     3059  not functions.  :c:macro:`Py_Size()` became :c:macro:`Py_SIZE()`,
     3060  :c:macro:`Py_Type()` became :c:macro:`Py_TYPE()`, and
     3061  :c:macro:`Py_Refcnt()` became :c:macro:`Py_REFCNT()`.
    30613062  The mixed-case macros are still available
    30623063  in Python 2.6 for backward compatibility.
     
    31163117* The :mod:`socket` module's socket objects now have an
    31173118  :meth:`ioctl` method that provides a limited interface to the
    3118   :cfunc:`WSAIoctl` system interface.
     3119  :c:func:`WSAIoctl` system interface.
    31193120
    31203121* The :mod:`_winreg` module now has a function,
     
    32623263  an :exc:`ImportError`.
    32633264
    3264 * C API: the :cfunc:`PyImport_Import` and :cfunc:`PyImport_ImportModule`
     3265* C API: the :c:func:`PyImport_Import` and :c:func:`PyImport_ImportModule`
    32653266  functions now default to absolute imports, not relative imports.
    32663267  This will affect C extensions that import other modules.
     
    32683269* C API: extension data types that shouldn't be hashable
    32693270  should define their ``tp_hash`` slot to
    3270   :cfunc:`PyObject_HashNotImplemented`.
     3271  :c:func:`PyObject_HashNotImplemented`.
    32713272
    32723273* The :mod:`socket` module exception :exc:`socket.error` now inherits
Note: See TracChangeset for help on using the changeset viewer.