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.2.rst

    r2 r391  
    3131
    3232
    33 .. seealso (now defunct)
     33.. see also, now defunct
    3434
    3535   http://www.unixreview.com/documents/s=1356/urm0109h/0109h.htm
     
    451451return a new iterator for the object; if the object is its own iterator, this
    452452method can just return ``self``.  In particular, iterators will usually be their
    453 own iterators.  Extension types implemented in C can implement a :attr:`tp_iter`
     453own iterators.  Extension types implemented in C can implement a :c:member:`~PyTypeObject.tp_iter`
    454454function in order to return an iterator, and extension types that want to behave
    455 as iterators can define a :attr:`tp_iternext` function.
     455as iterators can define a :c:member:`~PyTypeObject.tp_iternext` function.
    456456
    457457So, after all this, what do iterators actually do?  They have one required
     
    479479expects something for which :func:`iter` will return an iterator. For backward
    480480compatibility and convenience, an iterator is automatically constructed for
    481 sequences that don't implement :meth:`__iter__` or a :attr:`tp_iter` slot, so
     481sequences that don't implement :meth:`__iter__` or a :c:member:`~PyTypeObject.tp_iter` slot, so
    482482``for i in [1,2,3]`` will still work.  Wherever the Python interpreter loops
    483483over a sequence, it's been changed to use the iterator protocol.  This means you
     
    755755* Classes can define methods called :meth:`__truediv__` and :meth:`__floordiv__`
    756756  to overload the two division operators.  At the C level, there are also slots in
    757   the :ctype:`PyNumberMethods` structure so extension types can define the two
     757  the :c:type:`PyNumberMethods` structure so extension types can define the two
    758758  operators.
    759759
     
    984984
    985985* Two new format characters were added to the :mod:`struct` module for 64-bit
    986   integers on platforms that support the C :ctype:`long long` type.  ``q`` is for
     986  integers on platforms that support the C :c:type:`long long` type.  ``q`` is for
    987987  a signed 64-bit integer, and ``Q`` is for an unsigned one.  The value is
    988988  returned in Python's long integer type.  (Contributed by Tim Peters.)
     
    10581058  of profiling and tracing.  This  will be of interest to authors of development
    10591059  environments for Python.  Two new C functions were added to Python's API,
    1060   :cfunc:`PyEval_SetProfile` and :cfunc:`PyEval_SetTrace`. The existing
     1060  :c:func:`PyEval_SetProfile` and :c:func:`PyEval_SetTrace`. The existing
    10611061  :func:`sys.setprofile` and :func:`sys.settrace` functions still exist, and have
    10621062  simply been changed to use the new C-level interface.  (Contributed by Fred L.
     
    10641064
    10651065* Another low-level API, primarily of interest to implementors of Python
    1066   debuggers and development tools, was added. :cfunc:`PyInterpreterState_Head` and
    1067   :cfunc:`PyInterpreterState_Next` let a caller walk through all the existing
    1068   interpreter objects; :cfunc:`PyInterpreterState_ThreadHead` and
    1069   :cfunc:`PyThreadState_Next` allow looping over all the thread states for a given
     1066  debuggers and development tools, was added. :c:func:`PyInterpreterState_Head` and
     1067  :c:func:`PyInterpreterState_Next` let a caller walk through all the existing
     1068  interpreter objects; :c:func:`PyInterpreterState_ThreadHead` and
     1069  :c:func:`PyThreadState_Next` allow looping over all the thread states for a given
    10701070  interpreter.  (Contributed by David Beazley.)
    10711071
     
    10791079  To upgrade an extension module to the new API, perform the following steps:
    10801080
    1081 * Rename :cfunc:`Py_TPFLAGS_GC` to :cfunc:`PyTPFLAGS_HAVE_GC`.
    1082 
    1083 * Use :cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_NewVar` to allocate
    1084     objects, and :cfunc:`PyObject_GC_Del` to deallocate them.
    1085 
    1086 * Rename :cfunc:`PyObject_GC_Init` to :cfunc:`PyObject_GC_Track` and
    1087     :cfunc:`PyObject_GC_Fini` to :cfunc:`PyObject_GC_UnTrack`.
    1088 
    1089 * Remove :cfunc:`PyGC_HEAD_SIZE` from object size calculations.
    1090 
    1091 * Remove calls to :cfunc:`PyObject_AS_GC` and :cfunc:`PyObject_FROM_GC`.
    1092 
    1093 * A new ``et`` format sequence was added to :cfunc:`PyArg_ParseTuple`; ``et``
     1081* Rename :c:func:`Py_TPFLAGS_GC` to :c:func:`PyTPFLAGS_HAVE_GC`.
     1082
     1083* Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate
     1084    objects, and :c:func:`PyObject_GC_Del` to deallocate them.
     1085
     1086* Rename :c:func:`PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and
     1087    :c:func:`PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`.
     1088
     1089* Remove :c:func:`PyGC_HEAD_SIZE` from object size calculations.
     1090
     1091* Remove calls to :c:func:`PyObject_AS_GC` and :c:func:`PyObject_FROM_GC`.
     1092
     1093* A new ``et`` format sequence was added to :c:func:`PyArg_ParseTuple`; ``et``
    10941094  takes both a parameter and an encoding name, and converts the parameter to the
    10951095  given encoding if the parameter turns out to be a Unicode string, or leaves it
     
    11001100  support on Windows described in the following section.)
    11011101
    1102 * A different argument parsing function, :cfunc:`PyArg_UnpackTuple`, has been
     1102* A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been
    11031103  added that's simpler and presumably faster.  Instead of specifying a format
    11041104  string, the caller simply gives the minimum and maximum number of arguments
    1105   expected, and a set of pointers to :ctype:`PyObject\*` variables that will be
     1105  expected, and a set of pointers to :c:type:`PyObject\*` variables that will be
    11061106  filled in with argument values.
    11071107
     
    11121112  :const:`METH_OLDARGS` style of writing C methods is  now officially deprecated.
    11131113
    1114 * Two new wrapper functions, :cfunc:`PyOS_snprintf` and :cfunc:`PyOS_vsnprintf`
     1114* Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf`
    11151115  were added to provide  cross-platform implementations for the relatively new
    1116   :cfunc:`snprintf` and :cfunc:`vsnprintf` C lib APIs. In contrast to the standard
    1117   :cfunc:`sprintf` and :cfunc:`vsprintf` functions, the Python versions check the
     1116  :c:func:`snprintf` and :c:func:`vsnprintf` C lib APIs. In contrast to the standard
     1117  :c:func:`sprintf` and :c:func:`vsprintf` functions, the Python versions check the
    11181118  bounds of the buffer used to protect against buffer overruns. (Contributed by
    11191119  M.-A. Lemburg.)
    11201120
    1121 * The :cfunc:`_PyTuple_Resize` function has lost an unused parameter, so now it
     1121* The :c:func:`_PyTuple_Resize` function has lost an unused parameter, so now it
    11221122  takes 2 parameters instead of 3.  The third argument was never used, and can
    11231123  simply be discarded when porting code from earlier versions to Python 2.2.
     
    12201220  :meth:`tolist` method and the :attr:`start`, :attr:`stop`, and :attr:`step`
    12211221  attributes are also being deprecated.  At the C level, the fourth argument to
    1222   the :cfunc:`PyRange_New` function, ``repeat``, has also been deprecated.
     1222  the :c:func:`PyRange_New` function, ``repeat``, has also been deprecated.
    12231223
    12241224* There were a bunch of patches to the dictionary implementation, mostly to fix
     
    12431243  in case they're also usable as modules.  (Implemented by David Bolen.)
    12441244
    1245 * On platforms where Python uses the C :cfunc:`dlopen` function  to load
    1246   extension modules, it's now possible to set the flags used  by :cfunc:`dlopen`
     1245* On platforms where Python uses the C :c:func:`dlopen` function  to load
     1246  extension modules, it's now possible to set the flags used  by :c:func:`dlopen`
    12471247  using the :func:`sys.getdlopenflags` and :func:`sys.setdlopenflags` functions.
    12481248  (Contributed by Bram Stolk.)
Note: See TracChangeset for help on using the changeset viewer.