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

    r2 r391  
    367367
    368368
     369.. index::
     370   single: universal newlines; What's new
     371
    369372PEP 278: Universal Newline Support
    370373==================================
     
    377380two-character sequence of a carriage return plus a newline.
    378381
    379 Python's file objects can now support end of line conventions other than the one
    380 followed by the platform on which Python is running. Opening a file with the
    381 mode ``'U'`` or ``'rU'`` will open a file for reading in universal newline mode.
    382 All three line ending conventions will be translated to a ``'\n'`` in the
    383 strings returned by the various file methods such as :meth:`read` and
    384 :meth:`readline`.
     382Python's file objects can now support end of line conventions other than the
     383one followed by the platform on which Python is running. Opening a file with
     384the mode ``'U'`` or ``'rU'`` will open a file for reading in :term:`universal
     385newlines` mode.  All three line ending conventions will be translated to a
     386``'\n'`` in the strings returned by the various file methods such as
     387:meth:`read` and :meth:`readline`.
    385388
    386389Universal newline support is also used when importing modules and when executing
     
    17991802Pymalloc, a specialized object allocator written by Vladimir Marangozov, was a
    18001803feature added to Python 2.1.  Pymalloc is intended to be faster than the system
    1801 :cfunc:`malloc` and to have less memory overhead for allocation patterns typical
    1802 of Python programs. The allocator uses C's :cfunc:`malloc` function to get large
     1804:c:func:`malloc` and to have less memory overhead for allocation patterns typical
     1805of Python programs. The allocator uses C's :c:func:`malloc` function to get large
    18031806pools of memory and then fulfills smaller memory requests from these pools.
    18041807
     
    18161819There's one particularly common error that causes problems.  There are a number
    18171820of memory allocation functions in Python's C API that have previously just been
    1818 aliases for the C library's :cfunc:`malloc` and :cfunc:`free`, meaning that if
     1821aliases for the C library's :c:func:`malloc` and :c:func:`free`, meaning that if
    18191822you accidentally called mismatched functions the error wouldn't be noticeable.
    18201823When the object allocator is enabled, these functions aren't aliases of
    1821 :cfunc:`malloc` and :cfunc:`free` any more, and calling the wrong function to
     1824:c:func:`malloc` and :c:func:`free` any more, and calling the wrong function to
    18221825free memory may get you a core dump.  For example, if memory was allocated using
    1823 :cfunc:`PyObject_Malloc`, it has to be freed using :cfunc:`PyObject_Free`, not
    1824 :cfunc:`free`.  A few modules included with Python fell afoul of this and had to
     1826:c:func:`PyObject_Malloc`, it has to be freed using :c:func:`PyObject_Free`, not
     1827:c:func:`free`.  A few modules included with Python fell afoul of this and had to
    18251828be fixed; doubtless there are more third-party modules that will have the same
    18261829problem.
     
    18331836
    18341837* To allocate and free an undistinguished chunk of memory use the "raw memory"
    1835   family: :cfunc:`PyMem_Malloc`, :cfunc:`PyMem_Realloc`, and :cfunc:`PyMem_Free`.
     1838  family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:func:`PyMem_Free`.
    18361839
    18371840* The "object memory" family is the interface to the pymalloc facility described
    18381841  above and is biased towards a large number of "small" allocations:
    1839   :cfunc:`PyObject_Malloc`, :cfunc:`PyObject_Realloc`, and :cfunc:`PyObject_Free`.
     1842  :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:func:`PyObject_Free`.
    18401843
    18411844* To allocate and free Python objects, use the "object" family
    1842   :cfunc:`PyObject_New`, :cfunc:`PyObject_NewVar`, and :cfunc:`PyObject_Del`.
     1845  :c:func:`PyObject_New`, :c:func:`PyObject_NewVar`, and :c:func:`PyObject_Del`.
    18431846
    18441847Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides debugging
     
    18791882  Python's :program:`configure` script.  (Contributed by Ondrej Palkovsky.)
    18801883
    1881 * The :cmacro:`DL_EXPORT` and :cmacro:`DL_IMPORT` macros are now deprecated.
     1884* The :c:macro:`DL_EXPORT` and :c:macro:`DL_IMPORT` macros are now deprecated.
    18821885  Initialization functions for Python extension modules should now be declared
    1883   using the new macro :cmacro:`PyMODINIT_FUNC`, while the Python core will
    1884   generally use the :cmacro:`PyAPI_FUNC` and :cmacro:`PyAPI_DATA` macros.
     1886  using the new macro :c:macro:`PyMODINIT_FUNC`, while the Python core will
     1887  generally use the :c:macro:`PyAPI_FUNC` and :c:macro:`PyAPI_DATA` macros.
    18851888
    18861889* The interpreter can be compiled without any docstrings for the built-in
     
    18901893  by Gustavo Niemeyer.)
    18911894
    1892 * The :cfunc:`PyArg_NoArgs` macro is now deprecated, and code that uses it
     1895* The :c:func:`PyArg_NoArgs` macro is now deprecated, and code that uses it
    18931896  should be changed.  For Python 2.2 and later, the method definition table can
    18941897  specify the :const:`METH_NOARGS` flag, signalling that there are no arguments,
     
    18971900  "")`` instead, but this will be slower than using :const:`METH_NOARGS`.
    18981901
    1899 * :cfunc:`PyArg_ParseTuple` accepts new format characters for various sizes of
    1900   unsigned integers: ``B`` for :ctype:`unsigned char`, ``H`` for :ctype:`unsigned
    1901   short int`,  ``I`` for :ctype:`unsigned int`,  and ``K`` for :ctype:`unsigned
     1902* :c:func:`PyArg_ParseTuple` accepts new format characters for various sizes of
     1903  unsigned integers: ``B`` for :c:type:`unsigned char`, ``H`` for :c:type:`unsigned
     1904  short int`,  ``I`` for :c:type:`unsigned int`,  and ``K`` for :c:type:`unsigned
    19021905  long long`.
    19031906
    1904 * A new function, :cfunc:`PyObject_DelItemString(mapping, char \*key)` was added
     1907* A new function, :c:func:`PyObject_DelItemString(mapping, char \*key)` was added
    19051908  as shorthand for ``PyObject_DelItem(mapping, PyString_New(key))``.
    19061909
     
    19121915* It's now possible to define class and static methods for a C extension type by
    19131916  setting either the :const:`METH_CLASS` or :const:`METH_STATIC` flags in a
    1914   method's :ctype:`PyMethodDef` structure.
     1917  method's :c:type:`PyMethodDef` structure.
    19151918
    19161919* Python now includes a copy of the Expat XML parser's source code, removing any
Note: See TracChangeset for help on using the changeset viewer.