From d69fe2a8d3f618150a61e3679a4d370e5979efd4 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Wed, 3 Feb 2010 02:59:43 +0000 Subject: Merged revisions 77712,77740-77741,77756,77886,77902,77936 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77712 | tarek.ziade | 2010-01-23 11:52:57 -0600 (Sat, 23 Jan 2010) | 1 line fixed the 64bits tests for get_platform() - mac osx ........ r77740 | benjamin.peterson | 2010-01-24 21:58:21 -0600 (Sun, 24 Jan 2010) | 1 line compare types with is not == ........ r77741 | facundo.batista | 2010-01-25 00:15:01 -0600 (Mon, 25 Jan 2010) | 3 lines Added a note about Event.is_set() syntax being new to 2.6 ........ r77756 | tarek.ziade | 2010-01-26 11:20:37 -0600 (Tue, 26 Jan 2010) | 1 line fixed bdist_msi imports and added a test module for distutils.command.bdist_msi ........ r77886 | benjamin.peterson | 2010-01-31 12:09:34 -0600 (Sun, 31 Jan 2010) | 1 line move distutils.rst to different toc ........ r77902 | andrew.kuchling | 2010-01-31 20:04:26 -0600 (Sun, 31 Jan 2010) | 1 line Add various items ........ r77936 | andrew.kuchling | 2010-02-02 20:19:14 -0600 (Tue, 02 Feb 2010) | 1 line Add various items ........ --- Doc/library/language.rst | 1 - Doc/library/python.rst | 1 + Doc/library/threading.rst | 3 + Doc/whatsnew/2.7.rst | 109 ++++++++++++++++++++++++++-------- Lib/decimal.py | 4 +- Lib/distutils/command/bdist_msi.py | 5 +- Lib/distutils/tests/test_bdist_msi.py | 23 +++++++ Lib/test/test_sysconfig.py | 9 ++- 8 files changed, 117 insertions(+), 38 deletions(-) create mode 100644 Lib/distutils/tests/test_bdist_msi.py diff --git a/Doc/library/language.rst b/Doc/library/language.rst index 3d907a0..1eac32e 100644 --- a/Doc/library/language.rst +++ b/Doc/library/language.rst @@ -26,4 +26,3 @@ These modules include: compileall.rst dis.rst pickletools.rst - distutils.rst diff --git a/Doc/library/python.rst b/Doc/library/python.rst index f307d7d..b67fbfc 100644 --- a/Doc/library/python.rst +++ b/Doc/library/python.rst @@ -25,3 +25,4 @@ overview: inspect.rst site.rst fpectl.rst + distutils.rst diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index f642111..5ce6125 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -647,6 +647,9 @@ An event object manages an internal flag that can be set to true with the Return true if and only if the internal flag is true. + .. versionchanged:: 2.6 + The ``is_set()`` syntax is new. + .. method:: set() Set the internal flag to true. All threads waiting for it to become true diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index 279c49a..20a4a46 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -6,7 +6,7 @@ :Release: |release| :Date: |today| -.. Fix accents on Kristjan Valur Jonsson, Fuerstenau, Tarek Ziade. +.. Fix accents on Kristjan Valur Jonsson, Fuerstenau .. $Id$ Rules for maintenance: @@ -53,6 +53,11 @@ This article explains the new features in Python 2.7. The final release of 2.7 is currently scheduled for June 2010; the detailed schedule is described in :pep:`373`. +Python 2.7 is planned to be the last major release in the 2.x series. +Though more major releases have not been absolutely ruled out, it's +likely that the 2.7 release will have an extended period of +maintenance compared to earlier 2.x versions. + .. Compare with previous release in 2 - 3 sentences here. add hyperlink when the documentation becomes available online. @@ -458,10 +463,12 @@ Several performance enhancements have been added: conversion function that supports arbitrary bases. (Patch by Gawain Bolton; :issue:`6713`.) -* The :meth:`rindex`, :meth:`rpartition`, and :meth:`rsplit` methods - of string objects now uses a fast reverse-search algorithm instead of - a character-by-character scan. This is often faster by a factor of 10. - (Added by Florent Xicluna; :issue:`7462`.) +* The :meth:`split`, :meth:`replace`, :meth:`rindex`, + :meth:`rpartition`, and :meth:`rsplit` methods of string-like types + (strings, Unicode strings, and :class:`bytearray` objects) now use a + fast reverse-search algorithm instead of a character-by-character + scan. This is sometimes faster by a factor of 10. (Added by + Florent Xicluna; :issue:`7462` and :issue:`7622`.) * The :mod:`pickle` and :mod:`cPickle` modules now automatically intern the strings used for attribute names, reducing memory usage @@ -585,11 +592,16 @@ changes, or look through the Subversion logs for all the details. left-alignment. This has been changed to right-alignment, which seems more sensible for numeric types. (Changed by Mark Dickinson; :issue:`6857`.) -* Distutils is being more actively developed, thanks to Tarek Ziade - who has taken over maintenance of the package. A new - :file:`setup.py` subcommand, ``check``, will - check that the arguments being passed to the :func:`setup` function - are complete and correct (:issue:`5732`). +* Distutils is being more actively developed, thanks to Tarek Ziadé + who has taken over maintenance of the package, so there are a number + of fixes and improvments. + + A new :file:`setup.py` subcommand, ``check``, will check that the + arguments being passed to the :func:`setup` function are complete + and correct (:issue:`5732`). + + Byte-compilation by the ``install_lib`` subcommand is now only done + if the ``sys.dont_write_bytecode`` setting allows it (:issue:`7071`). :func:`distutils.sdist.add_defaults` now uses *package_dir* and *data_files* to create the MANIFEST file. @@ -601,7 +613,7 @@ 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, + prompt for the password if not present. (Added by Tarek Ziadé, based on an initial contribution by Nathan Van Gheem; :issue:`4394`.) A Distutils setup can now specify that a C extension is optional by @@ -614,7 +626,7 @@ changes, or look through the Subversion logs for all the details. :meth:`read_pkg_file` method will read the contents of a package's :file:`PKG-INFO` metadata file. For an example of its use, see :ref:`reading-metadata`. - (Contributed by Tarek Ziade; :issue:`7457`.) + (Contributed by Tarek Ziadé; :issue:`7457`.) :file:`setup.py` files will now accept a :option:`--no-user-cfg` switch to skip reading the :file:`~/.pydistutils.cfg` file. (Suggested by @@ -643,6 +655,10 @@ changes, or look through the Subversion logs for all the details. recorded in a gzipped file by providing an optional timestamp to the constructor. (Contributed by Jacques Frechet; :issue:`4272`.) + Files in gzip format can be padded with trailing zero bytes; the + :mod:`gzip` module will now consume these trailing bytes. (Fixed by + Tadek Pietraszek and Brian Curtin; :issue:`2846`.) + * The default :class:`HTTPResponse` class used by the :mod:`httplib` module now supports buffering, resulting in much faster reading of HTTP responses. (Contributed by Kristjan Valur Jonsson; :issue:`4879`.) @@ -662,7 +678,9 @@ changes, or look through the Subversion logs for all the details. The :class:`io.FileIO` class now raises an :exc:`OSError` when passed an invalid file descriptor. (Implemented by Benjamin Peterson; - :issue:`4991`.) + :issue:`4991`.) The :meth:`truncate` method now preserves the + file position; previously it would change the file position to the + end of the new file. (Fixed by Pascal Chambon; :issue:`6939`.) * New function: ``itertools.compress(data, selectors)`` takes two iterators. Elements of *data* are returned if the corresponding @@ -718,6 +736,14 @@ changes, or look through the Subversion logs for all the details. passed to the callable. (Contributed by lekma; :issue:`5585`.) + The :class:`Pool` class, which controls a pool of worker processes, + now has an optional *maxtasksperchild* parameter. Worker processes + will perform the specified number of tasks and then exit, causing the + :class:`Pool` to start a new worker. This is useful if tasks may leak + memory or other resources, or if some tasks will cause the worker to + become very large. + (Contributed by Charles Cazabon; :issue:`6963`.) + * The :mod:`nntplib` module now supports IPv6 addresses. (Contributed by Derek Morr; :issue:`1664`.) @@ -730,6 +756,10 @@ changes, or look through the Subversion logs for all the details. contributed by Travis H.; :issue:`6508`. Support for initgroups added by Jean-Paul Calderone; :issue:`7333`.) + The :func:`normpath` function now preserves Unicode; if its input path + is a Unicode string, the return value is also a Unicode string. + (Fixed by Matt Giuca; :issue:`5827`.) + * The :mod:`pydoc` module now has help for the various symbols that Python uses. You can now do ``help('<<')`` or ``help('@')``, for example. (Contributed by David Laban; :issue:`4739`.) @@ -753,7 +783,7 @@ changes, or look through the Subversion logs for all the details. :func:`getuserbase` returns the value of the :envvar:`USER_BASE` environment variable, giving the path to a directory that can be used to store data. - (Contributed by Tarek Ziade; :issue:`6693`.) + (Contributed by Tarek Ziadé; :issue:`6693`.) * The :mod:`socket` module's :class:`SSL` objects now support the buffer API, which fixed a test suite failure. (Fixed by Antoine Pitrou; @@ -795,10 +825,25 @@ changes, or look through the Subversion logs for all the details. (Contributed by Jeremy Hylton.) * The ``sys.version_info`` value is now a named tuple, with attributes - named ``major``, ``minor``, ``micro``, ``releaselevel``, and ``serial``. - (Contributed by Ross Light; :issue:`4285`.) - -* The :mod:`tarfile` module now supports filtering the :class:`TarInfo` + named :attr:`major`, :attr:`minor`, :attr:`micro`, + :attr:`releaselevel`, and :attr:`serial`. (Contributed by Ross + Light; :issue:`4285`.) + + :func:`sys.getwindowsversion` also returns a named tuple, + with attributes named :attr:`service_pack_major`, + :attr:`service_pack_minor`, + :attr:`suite_mask`, and :attr:`product_type`. (Contributed by + Brian Curtin; :issue:`7766`.) + +* The :mod:`tarfile` module's default error handling has changed, to + no longer suppress fatal errors. The default error level was previously 0, + which meant that errors would only result in a message being written to the + debug log, but because the debug log is not activated by default, + these errors go unnoticed. The default error level is now 1, + which raises an exception if there's an error. + (Changed by Lars Gustäbel; :issue:`7357`.) + + :mod:`tarfile` now supports filtering the :class:`TarInfo` objects being added to a tar file. When you call :meth:`TarFile.add`, instance, you may supply an optional *filter* argument that's a callable. The *filter* callable will be passed the @@ -806,7 +851,7 @@ changes, or look through the Subversion logs for all the details. If the callable returns ``None``, the file will be excluded from the resulting archive. This is more powerful than the existing *exclude* argument, which has therefore been deprecated. - (Added by Lars Gustaebel; :issue:`6856`.) + (Added by Lars Gustäbel; :issue:`6856`.) * The :mod:`threading` module's :meth:`Event.wait` method now returns the internal flag on exit. This means the method will usually @@ -815,12 +860,22 @@ changes, or look through the Subversion logs for all the details. a timeout was provided and the operation timed out. (Contributed by Tim Lesher; :issue:`1674032`.) -* The :func:`is_zipfile` function in the :mod:`zipfile` module now - accepts a file object, in addition to the path names accepted in earlier - versions. (Contributed by Gabriel Genellina; :issue:`4756`.) +* The :class:`UserDict` class is now a new-style class. (Changed by + Benjamin Peterson.) + +* The :mod:`zipfile` module's :class:`ZipFile` now supports the context + management protocol, so you can write ``with zipfile.ZipFile(...) as f: ...``. + (Contributed by Brian Curtin; :issue:`5511`.) :mod:`zipfile` now supports archiving empty directories and extracts them correctly. (Fixed by Kuba Wieczorek; :issue:`4710`.) + Reading files out of an archive is now faster, and interleaving + :meth:`read` and :meth:`readline` now works correctly. + (Contributed by Nir Aides; :issue:`7610`.) + + The :func:`is_zipfile` function in the module now + accepts a file object, in addition to the path names accepted in earlier + versions. (Contributed by Gabriel Genellina; :issue:`4756`.) .. ====================================================================== .. whole new modules get described in subsections here @@ -1046,10 +1101,12 @@ Changes to Python's build process and to the C API include: instruction currently executing, and then look up the line number corresponding to that address. (Added by Jeffrey Yasskin.) -* New function: :cfunc:`PyLong_AsLongAndOverflow` approximates a Python long - integer as a C :ctype:`long`. If the number is too large to fit into - a :ctype:`long`, an *overflow* flag is set and returned to the caller. - (Contributed by Case Van Horsen; :issue:`7528`.) +* New functions: :cfunc:`PyLong_AsLongAndOverflow` and + :cfunc:`PyLong_AsLongLongAndOverflow` approximates a Python long + integer as a C :ctype:`long` or :ctype:`long long`. + If the number is too large to fit into + the output type, an *overflow* flag is set and returned to the caller. + (Contributed by Case Van Horsen; :issue:`7528` and :issue:`7767`.) * New function: stemming from the rewrite of string-to-float conversion, a new :cfunc:`PyOS_string_to_double` function was added. The old diff --git a/Lib/decimal.py b/Lib/decimal.py index a72afdc..d0c4df2 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -3600,12 +3600,12 @@ class Decimal(object): return (self.__class__, (str(self),)) def __copy__(self): - if type(self) == Decimal: + if type(self) is Decimal: return self # I'm immutable; therefore I am my own clone return self.__class__(str(self)) def __deepcopy__(self, memo): - if type(self) == Decimal: + if type(self) is Decimal: return self # My components are also immutable return self.__class__(str(self)) diff --git a/Lib/distutils/command/bdist_msi.py b/Lib/distutils/command/bdist_msi.py index 404f215..f13c73b 100644 --- a/Lib/distutils/command/bdist_msi.py +++ b/Lib/distutils/command/bdist_msi.py @@ -7,15 +7,12 @@ Implements the bdist_msi command. """ import sys, os -from sysconfig import get_python_version +from sysconfig import get_python_version, get_platform -import sys, os from distutils.core import Command from distutils.dir_util import remove_tree -from distutils.sysconfig import get_python_version from distutils.version import StrictVersion from distutils.errors import DistutilsOptionError -from distutils.util import get_platform from distutils import log import msilib diff --git a/Lib/distutils/tests/test_bdist_msi.py b/Lib/distutils/tests/test_bdist_msi.py new file mode 100644 index 0000000..ba2d3e1 --- /dev/null +++ b/Lib/distutils/tests/test_bdist_msi.py @@ -0,0 +1,23 @@ +"""Tests for distutils.command.bdist_msi.""" +import unittest +import sys + +from distutils.tests import support + +@unittest.skipUnless(sys.platform=="win32", "These tests are only for win32") +class BDistMSITestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): + + def test_minial(self): + # minimal test XXX need more tests + from distutils.command.bdist_msi import bdist_msi + pkg_pth, dist = self.create_dist() + cmd = bdist_msi(dist) + cmd.ensure_finalized() + +def test_suite(): + return unittest.makeSuite(BDistMSITestCase) + +if __name__ == '__main__': + test_support.run_unittest(test_suite()) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 0f8f89a..5b50901 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -145,14 +145,14 @@ class TestSysConfig(unittest.TestCase): get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g ' '-fwrapv -O3 -Wall -Wstrict-prototypes') - maxsize = sys.maxsize + maxint = sys.maxsize try: sys.maxsize = 2147483647 self.assertEquals(get_platform(), 'macosx-10.3-ppc') sys.maxsize = 9223372036854775807 self.assertEquals(get_platform(), 'macosx-10.3-ppc64') finally: - sys.maxsize = maxsize + sys.maxsize = maxint self._set_uname(('Darwin', 'macziade', '8.11.1', @@ -164,15 +164,14 @@ class TestSysConfig(unittest.TestCase): get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g ' '-fwrapv -O3 -Wall -Wstrict-prototypes') - - maxsize = sys.maxsize + maxint = sys.maxsize try: sys.maxsize = 2147483647 self.assertEquals(get_platform(), 'macosx-10.3-i386') sys.maxsize = 9223372036854775807 self.assertEquals(get_platform(), 'macosx-10.3-x86_64') finally: - sys.maxsize = maxsize + sys.maxsize = maxint # macbook with fat binaries (fat, universal or fat64) os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.4' -- cgit v0.12