Add various items

This commit is contained in:
Andrew M. Kuchling 2009-03-31 01:21:01 +00:00
parent 82eb5902ce
commit 7706957f59
1 changed files with 55 additions and 9 deletions

View File

@ -113,7 +113,13 @@ Some smaller changes made to the core Python language are:
Optimizations Optimizations
------------- -------------
A few performance enhancements have been added: Several performance enhancements have been added:
.. * A new :program:`configure` option, :option:`--with-computed-gotos`,
compiles the main bytecode interpreter loop using a new dispatch
mechanism that gives speedups of up to 20%, depending on the system
and benchmark. The new mechanism is only supported on certain
compilers, such as gcc, SunPro, and icc.
* The garbage collector now performs better when many objects are * The garbage collector now performs better when many objects are
being allocated without deallocating any. A full garbage collection being allocated without deallocating any. A full garbage collection
@ -158,7 +164,7 @@ A few performance enhancements have been added:
(Contributed by Mark Dickinson; :issue:`4258`.) (Contributed by Mark Dickinson; :issue:`4258`.)
Another set of changes made long objects a few bytes smaller: 2 bytes Another set of changes made long objects a few bytes smaller: 2 bytes
smaller on 32-bit systems and 6 bytes on 64-bit. (: smaller on 32-bit systems and 6 bytes on 64-bit.
(Contributed by Mark Dickinson; :issue:`5260`.) (Contributed by Mark Dickinson; :issue:`5260`.)
* The division algorithm for long integers has been made faster * The division algorithm for long integers has been made faster
@ -168,6 +174,10 @@ A few performance enhancements have been added:
integer divisions and modulo operations. integer divisions and modulo operations.
(Contributed by Mark Dickinson; :issue:`5512`.) (Contributed by Mark Dickinson; :issue:`5512`.)
* List comprehensions with an ``if`` condition are compiled into
faster bytecode. (Patch by Antoine Pitrou, back-ported to 2.7
by Jeffrey Yasskin; :issue:`4715`.)
.. ====================================================================== .. ======================================================================
New, Improved, and Deprecated Modules New, Improved, and Deprecated Modules
@ -179,12 +189,6 @@ changes, sorted alphabetically by module name. Consult the
:file:`Misc/NEWS` file in the source tree for a more complete list of :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. changes, or look through the Subversion logs for all the details.
* It is no longer mandatory to store clear-text passwords in the
:file:`.pypirc` file when registering and uploading packages to PyPI. As long
as the username is present in that file, the :mod:`distutils` package will
prompt for the password if not present. (Added by Tarek Ziade,
with the initial contribution by Nathan Van Gheem; :issue:`4394`.)
* The :mod:`bz2` module's :class:`BZ2File` now supports the context * The :mod:`bz2` module's :class:`BZ2File` now supports the context
management protocol, so you can write ``with bz2.BZ2File(...) as f: ...``. management protocol, so you can write ``with bz2.BZ2File(...) as f: ...``.
(Contributed by Hagen Fuerstenau; :issue:`3860`.) (Contributed by Hagen Fuerstenau; :issue:`3860`.)
@ -224,7 +228,24 @@ changes, or look through the Subversion logs for all the details.
Contributed by Raymond Hettinger; :issue:`1696199`. Contributed by Raymond Hettinger; :issue:`1696199`.
* In Distutils, :func:`distutils.sdist.add_defaults` now uses * In Distutils, :func:`distutils.sdist.add_defaults` now uses
*package_dir* and *data_files* to feed MANIFEST. *package_dir* and *data_files* to create the MANIFEST file.
It is no longer mandatory to store clear-text passwords in the
:file:`.pypirc` file when registering and uploading packages to PyPI. As long
as the username is present in that file, the :mod:`distutils` package will
prompt for the password if not present. (Added by Tarek Ziade,
with the initial contribution by Nathan Van Gheem; :issue:`4394`.)
* New method: the :class:`Decimal` class gained a
:meth:`from_float` class method that performs an exact conversion
of a floating-point number to a :class:`Decimal`.
Note that this is an **exact** conversion that strives for the
closest decimal approximation to the floating-point representation's value;
the resulting decimal value will therefore still include the inaccuracy,
if any.
For example, ``Decimal.from_float(0.1)`` returns
``Decimal('0.1000000000000000055511151231257827021181583404541015625')``.
(Implemented by Raymond Hettinger; :issue:`4796`.)
* A new function in the :mod:`gc` module, :func:`is_tracked`, returns * A new function in the :mod:`gc` module, :func:`is_tracked`, returns
True if a given instance is tracked by the garbage collector, False True if a given instance is tracked by the garbage collector, False
@ -233,6 +254,9 @@ changes, or look through the Subversion logs for all the details.
* The :mod:`gzip` module's :class:`GzipFile` now supports the context * The :mod:`gzip` module's :class:`GzipFile` now supports the context
management protocol, so you can write ``with gzip.GzipFile(...) as f: ...``. management protocol, so you can write ``with gzip.GzipFile(...) as f: ...``.
(Contributed by Hagen Fuerstenau; :issue:`3860`.) (Contributed by Hagen Fuerstenau; :issue:`3860`.)
It's now possible to override the modification time
recorded in a gzipped file by providing an optional timestamp to
the constructor. (Contributed by Jacques Frechet; :issue:`4272`.)
* The :class:`io.FileIO` class now raises an :exc:`OSError` when passed * The :class:`io.FileIO` class now raises an :exc:`OSError` when passed
an invalid file descriptor. (Implemented by Benjamin Peterson; an invalid file descriptor. (Implemented by Benjamin Peterson;
@ -263,6 +287,11 @@ changes, or look through the Subversion logs for all the details.
floats or :class:`Decimal` instances. (Implemented by Raymond floats or :class:`Decimal` instances. (Implemented by Raymond
Hettinger; :issue:`5032`.) Hettinger; :issue:`5032`.)
:func:`itertools.combinations` and :func:`itertools.product` were
previously raising :exc:`ValueError` for values of *r* larger than
the input iterable. This was deemed a specification error, so they
now return an empty iterator. (Fixed by Raymond Hettinger; :issue:`4816`.)
* The :mod:`json` module was upgraded to version 2.0.9 of the * The :mod:`json` module was upgraded to version 2.0.9 of the
simplejson package, which includes a C extension that makes simplejson package, which includes a C extension that makes
encoding and decoding faster. encoding and decoding faster.
@ -351,6 +380,11 @@ Changes to Python's build process and to the C API include:
is particularly useful for asynchronous IO operations. is particularly useful for asynchronous IO operations.
(Contributed by Kristjan Valur Jonsson; :issue:`4293`.) (Contributed by Kristjan Valur Jonsson; :issue:`4293`.)
* The :program:`configure` script now checks for floating-point rounding bugs
on certain 32-bit Intel chips and defines a :cmacro:`X87_DOUBLE_ROUNDING`
preprocessor definition. No code currently uses this definition,
but it's available if anyone wishes to use it.
(Added by Mark Dickinson; :issue:`2937`.)
.. ====================================================================== .. ======================================================================
@ -373,10 +407,22 @@ Port-Specific Changes: Windows
Port-Specific Changes: Mac OS X Port-Specific Changes: Mac OS X
----------------------------------- -----------------------------------
* The ``/Library/Python/2.7/site-packages`` is now appended to
``sys.path``, in order to share added packages between the system
installation and a user-installed copy of the same version.
(Changed by Ronald Oussoren; :issue:`4865`.)
Other Changes and Fixes Other Changes and Fixes
======================= =======================
* When importing a module from a :file:`.pyc` or :file:`.pyo` file
with an existing :file:`.py` counterpart, the :attr:`co_filename`
attributes of all code objects if the original filename is obsolete,
which can happen if the file has been renamed, moved, or is accessed
through different paths. (Patch by Ziga Seilnacht and Jean-Paul
Calderone; :issue:`1180193`.)
* The :file:`regrtest.py` script now takes a :option:`--randseed=` * The :file:`regrtest.py` script now takes a :option:`--randseed=`
switch that takes an integer that will be used as the random seed switch that takes an integer that will be used as the random seed
for the :option:`-r` option that executes tests in random order. for the :option:`-r` option that executes tests in random order.