summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-04-09 08:37:03 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-04-09 08:37:03 (GMT)
commit5e69685999c0f44af3536ac71a2a59e70b7ea185 (patch)
tree7746b70fbbdad4ecf455e0b1bba93dd27b8cafa8 /Doc/whatsnew
parentf91197c6d51e5518372df281026a7ab897f6a5d1 (diff)
downloadcpython-5e69685999c0f44af3536ac71a2a59e70b7ea185.zip
cpython-5e69685999c0f44af3536ac71a2a59e70b7ea185.tar.gz
cpython-5e69685999c0f44af3536ac71a2a59e70b7ea185.tar.bz2
Merged revisions 62194,62197-62198,62204-62205,62214,62219-62221,62227,62229-62231,62233-62235,62237-62239 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r62194 | jeffrey.yasskin | 2008-04-07 01:04:28 +0200 (Mon, 07 Apr 2008) | 7 lines Add enough debugging information to diagnose failures where the HandlerBException is ignored, and fix one such problem, where it was thrown during the __del__ method of the previous Popen object. We may want to find a better way of printing verbose information so it's not spammy when the test passes. ........ r62197 | mark.hammond | 2008-04-07 03:53:39 +0200 (Mon, 07 Apr 2008) | 2 lines Issue #2513: enable 64bit cross compilation on windows. ........ r62198 | mark.hammond | 2008-04-07 03:59:40 +0200 (Mon, 07 Apr 2008) | 2 lines correct heading underline for new "Cross-compiling on Windows" section ........ r62204 | gregory.p.smith | 2008-04-07 08:33:21 +0200 (Mon, 07 Apr 2008) | 4 lines Use the new PyFile_IncUseCount & PyFile_DecUseCount calls appropriatly within the standard library. These modules use PyFile_AsFile and later release the GIL while operating on the previously returned FILE*. ........ r62205 | mark.summerfield | 2008-04-07 09:39:23 +0200 (Mon, 07 Apr 2008) | 4 lines changed "2500 components" to "several thousand" since the number keeps growning:-) ........ r62214 | georg.brandl | 2008-04-07 20:51:59 +0200 (Mon, 07 Apr 2008) | 2 lines #2525: update timezone info examples in the docs. ........ r62219 | andrew.kuchling | 2008-04-08 01:57:07 +0200 (Tue, 08 Apr 2008) | 1 line Write PEP 3127 section; add items ........ r62220 | andrew.kuchling | 2008-04-08 01:57:21 +0200 (Tue, 08 Apr 2008) | 1 line Typo fix ........ r62221 | andrew.kuchling | 2008-04-08 03:33:10 +0200 (Tue, 08 Apr 2008) | 1 line Typographical fix: 32bit -> 32-bit, 64bit -> 64-bit ........ r62227 | andrew.kuchling | 2008-04-08 23:22:53 +0200 (Tue, 08 Apr 2008) | 1 line Add items ........ r62229 | amaury.forgeotdarc | 2008-04-08 23:27:42 +0200 (Tue, 08 Apr 2008) | 7 lines Issue2564: Prevent a hang in "import test.autotest", which runs the entire test suite as a side-effect of importing the module. - in test_capi, a thread tried to import other modules - re.compile() imported sre_parse again on every call. ........ r62230 | amaury.forgeotdarc | 2008-04-08 23:51:57 +0200 (Tue, 08 Apr 2008) | 2 lines Prevent an error when inspect.isabstract() is called with something else than a new-style class. ........ r62231 | amaury.forgeotdarc | 2008-04-09 00:07:05 +0200 (Wed, 09 Apr 2008) | 8 lines Issue 2408: remove the _types module It was only used as a helper in types.py to access types (GetSetDescriptorType and MemberDescriptorType), when they can easily be obtained with python code. These expressions even work with Jython. I don't know what the future of the types module is; (cf. discussion in http://bugs.python.org/issue1605 ) at least this change makes it simpler. ........ r62233 | amaury.forgeotdarc | 2008-04-09 01:10:07 +0200 (Wed, 09 Apr 2008) | 2 lines Add a NEWS entry for previous checkin ........ r62234 | trent.nelson | 2008-04-09 01:47:30 +0200 (Wed, 09 Apr 2008) | 37 lines - Issue #2550: The approach used by client/server code for obtaining ports to listen on in network-oriented tests has been refined in an effort to facilitate running multiple instances of the entire regression test suite in parallel without issue. test_support.bind_port() has been fixed such that it will always return a unique port -- which wasn't always the case with the previous implementation, especially if socket options had been set that affected address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT). The new implementation of bind_port() will actually raise an exception if it is passed an AF_INET/SOCK_STREAM socket with either the SO_REUSEADDR or SO_REUSEPORT socket option set. Furthermore, if available, bind_port() will set the SO_EXCLUSIVEADDRUSE option on the socket it's been passed. This currently only applies to Windows. This option prevents any other sockets from binding to the host/port we've bound to, thus removing the possibility of the 'non-deterministic' behaviour, as Microsoft puts it, that occurs when a second SOCK_STREAM socket binds and accepts to a host/port that's already been bound by another socket. The optional preferred port parameter to bind_port() has been removed. Under no circumstances should tests be hard coding ports! test_support.find_unused_port() has also been introduced, which will pass a temporary socket object to bind_port() in order to obtain an unused port. The temporary socket object is then closed and deleted, and the port is returned. This method should only be used for obtaining an unused port in order to pass to an external program (i.e. the -accept [port] argument to openssl's s_server mode) or as a parameter to a server-oriented class that doesn't give you direct access to the underlying socket used. Finally, test_support.HOST has been introduced, which should be used for the host argument of any relevant socket calls (i.e. bind and connect). The following tests were updated to following the new conventions: test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib, test_poplib, test_ftplib, test_telnetlib, test_socketserver, test_asynchat and test_socket_ssl. It is now possible for multiple instances of the regression test suite to run in parallel without issue. ........ r62235 | gregory.p.smith | 2008-04-09 02:25:17 +0200 (Wed, 09 Apr 2008) | 3 lines Fix zlib crash from zlib.decompressobj().flush(val) when val was not positive. It tried to allocate negative or zero memory. That fails. ........ r62237 | trent.nelson | 2008-04-09 02:34:53 +0200 (Wed, 09 Apr 2008) | 1 line Fix typo with regards to self.PORT shadowing class variables with the same name. ........ r62238 | andrew.kuchling | 2008-04-09 03:08:32 +0200 (Wed, 09 Apr 2008) | 1 line Add items ........ r62239 | jerry.seutter | 2008-04-09 07:07:58 +0200 (Wed, 09 Apr 2008) | 1 line Changed test so it no longer runs as a side effect of importing. ........
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/2.6.rst173
1 files changed, 160 insertions, 13 deletions
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 2098508..29a2693 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -728,6 +728,12 @@ or using a :class:`bytes` constructor. For future compatibility,
Python 2.6 adds :class:`bytes` as a synonym for the :class:`str` type,
and it also supports the ``b''`` notation.
+There's also a ``__future__`` import that causes all string literals
+to become Unicode strings. This means that ``\u`` escape sequences
+can be used to include Unicode characters.
+
+XXX give example
+
.. seealso::
:pep:`3112` - Bytes literals in Python 3000
@@ -740,7 +746,70 @@ and it also supports the ``b''`` notation.
PEP 3116: New I/O Library
=====================================================
-XXX write this.
+Python's built-in file objects support a number of methods, but
+file-like objects don't necessarily support all of them. Objects that
+imitate files usually support :meth:`read` and :meth:`write`, but they
+may not support :meth:`readline`. Python 3.0 introduces a layered I/O
+library in the :mod:`io` module that separates buffering and
+text-handling features from the fundamental read and write operations.
+
+There are three levels of abstract base classes provided by
+the :mod:`io` module:
+
+* :class:`RawIOBase`: defines raw I/O operations: :meth:`read`,
+ :meth:`readinto`,
+ :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`,
+ and :meth:`close`.
+ Most of the methods of this class will often map to a single system call.
+ There are also :meth:`readable`, :meth:`writable`, and :meth:`seekable`
+ methods for determining what operations a given object will allow.
+
+ Python 3.0 has concrete implementations of this class for files and
+ sockets, but Python 2.6 hasn't restructured its file and socket objects
+ in this way.
+
+ .. XXX should 2.6 register them in io.py?
+
+* :class:`BufferedIOBase`: is an abstract base class that
+ buffers data in memory to reduce the number of
+ system calls used, making I/O processing more efficient.
+ It supports all of the methods of :class:`RawIOBase`,
+ and adds a :attr:`raw` attribute holding the underlying raw object.
+
+ There are four concrete classes implementing this ABC:
+ :class:`BufferedWriter` and
+ :class:`BufferedReader` for objects that only support
+ writing or reading and don't support random access,
+ :class:`BufferedRandom` for objects that support the :meth:`seek` method
+ for random access,
+ and :class:`BufferedRWPair` for objects such as TTYs that have
+ both read and write operations that act upon unconnected streams of data.
+
+* :class:`TextIOBase`: Provides functions for reading and writing
+ strings (remember, strings will be Unicode in Python 3.0),
+ and supporting universal newlines. :class:`TextIOBase` defines
+ the :meth:`readline` method and supports iteration upon
+ objects.
+
+ There are two concrete implementations. :class:`TextIOWrapper`
+ wraps a buffered I/O object, supporting all of the methods for
+ text I/O and adding a :attr:`buffer` attribute for access
+ to the underlying object. :class:`StringIO` simply buffers
+ everything in memory without ever writing anything to disk.
+
+ (In current 2.6 alpha releases, :class:`io.StringIO` is implemented in
+ pure Python, so it's pretty slow. You should therefore stick with the
+ existing :mod:`StringIO` module or :mod:`cStringIO` for now. At some
+ point Python 3.0's :mod:`io` module will be rewritten into C for speed,
+ and perhaps the C implementation will be backported to the 2.x releases.)
+
+ .. XXX check before final release: is io.py still written in Python?
+
+In Python 2.6, the underlying implementations haven't been
+restructured to build on top of the :mod:`io` module's classes. The
+module is being provided to make it easier to write code that's
+forward-compatible with 3.0, and to save developers the effort of writing
+their own implementations of buffering and text I/O.
.. seealso::
@@ -952,22 +1021,48 @@ Subclasses must then define a :meth:`readonly` property
PEP 3127: Integer Literal Support and Syntax
=====================================================
-XXX write this -- this section is currently just brief notes.
+Python 3.0 changes the syntax for octal (base-8) integer literals,
+which are now prefixed by "0o" or "0O" instead of a leading zero, and
+adds support for binary (base-2) integer literals, signalled by a "0b"
+or "0B" prefix.
+
+Python 2.6 doesn't drop support for a leading 0 signalling
+an octal number, but it does add support for "0o" and "0b"::
+
+ >>> 0o21, 2*8 + 1
+ (17, 17)
+ >>> 0b101111
+ 47
+
+The :func:`oct` built-in still returns numbers
+prefixed with a leading zero, and a new :func:`bin`
+built-in returns the binary representation for a number::
-Python 3.0 changes the syntax for octal integer literals, and
-adds supports for binary integers: 0o instad of 0,
-and 0b for binary. Python 2.6 doesn't support this, but a bin()
-builtin was added.
+ >>> oct(42)
+ '052'
+ >>> bin(173)
+ '0b10101101'
-XXX changes to the hex/oct builtins
+The :func:`int` and :func:`long` built-ins will now accept the "0o"
+and "0b" prefixes when base-8 or base-2 are requested, or when the
+**base** argument is zero (meaning the base used is determined from
+the string):
+ >>> int ('0o52', 0)
+ 42
+ >>> int('1101', 2)
+ 13
+ >>> int('0b1101', 2)
+ 13
+ >>> int('0b1101', 0)
+ 13
-New bin() built-in returns the binary form of a number.
.. seealso::
:pep:`3127` - Integer Literal Support and Syntax
- PEP written by Patrick Maupin.
+ PEP written by Patrick Maupin; backported to 2.6 by
+ Eric Smith.
.. ======================================================================
@@ -1124,6 +1219,13 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
.. Patch 1686487
+* Tuples now have an :meth:`index` method matching the list type's
+ :meth:`index` method::
+
+ >>> t = (0,1,2,3,4)
+ >>> t.index(3)
+ 3
+
* The built-in types now have improved support for extended slicing syntax,
where various combinations of ``(start, stop, step)`` are supplied.
Previously, the support was partial and certain corner cases wouldn't work.
@@ -1532,7 +1634,7 @@ complete list of changes, or look through the CVS logs for all the details.
(3, 1), (3, 2), (3, 4),
(4, 1), (4, 2), (4, 3)]
- ``itertools.chain(*iterables)` is an existing function in
+ ``itertools.chain(*iterables)`` is an existing function in
:mod:`itertools` that gained a new constructor in Python 2.6.
``itertools.chain.from_iterable(iterable)`` takes a single
iterable that should return other iterables. :func:`chain` will
@@ -1642,6 +1744,12 @@ complete list of changes, or look through the CVS logs for all the details.
.. Patch #1393667
+ The :func:`post_mortem` function, used to enter debugging of a
+ traceback, will now use the traceback returned by :func:`sys.exc_info`
+ if no traceback is supplied. (Contributed by Facundo Batista.)
+
+ .. Patch #1106316
+
* The :mod:`pickletools` module now has an :func:`optimize` function
that takes a string containing a pickle and removes some unused
opcodes, returning a shorter pickle that contains the same data structure.
@@ -1720,6 +1828,8 @@ complete list of changes, or look through the CVS logs for all the details.
.. Patch 1657
+ .. XXX
+
* The :mod:`sets` module has been deprecated; it's better to
use the built-in :class:`set` and :class:`frozenset` types.
@@ -1791,9 +1901,12 @@ complete list of changes, or look through the CVS logs for all the details.
* The base classes in the :mod:`SocketServer` module now support
calling a :meth:`handle_timeout` method after a span of inactivity
specified by the server's :attr:`timeout` attribute. (Contributed
- by Michael Pomraning.)
+ by Michael Pomraning.) The :meth:`serve_forever` method
+ now takes an optional poll interval measured in seconds,
+ controlling how often the server will check for a shutdown request.
+ (Contributed by Pedro Werneck and Jeffrey Yasskin.)
- .. Patch #742598
+ .. Patch #742598, #1193577
* The :mod:`struct` module now supports the C99 :ctype:`_Bool` type,
using the format character ``'?'``.
@@ -2069,6 +2182,19 @@ Changes to Python's build process and to the C API include:
.. Patch 1551895
+* Python's use of the C stdio library is now thread-safe, or at least
+ as thread-safe as the underlying library is. A long-standing potential
+ bug occurred if one thread closed a file object while another thread
+ was reading from or writing to the object. In 2.6 file objects
+ have a reference count, manipulated by the
+ :cfunc:`PyFile_IncUseCount` and :cfunc:`PyFile_DecUseCount`
+ functions. File objects can't be closed unless the reference count
+ is zero. :cfunc:`PyFile_IncUseCount` should be called while the GIL
+ is still held, before carrying out an I/O operation using the
+ ``FILE *`` pointer, and :cfunc:`PyFile_DecUseCount` should be called
+ immediately after the GIL is re-acquired.
+ (Contributed by Antoine Pitrou and Gregory P. Smith.)
+
* Several functions return information about the platform's
floating-point support. :cfunc:`PyFloat_GetMax` returns
the maximum representable floating point value,
@@ -2089,6 +2215,13 @@ Changes to Python's build process and to the C API include:
.. Issue 1635
+* Many C extensions define their own little macro for adding
+ integers and strings to the module's dictionary in the
+ ``init*`` function. Python 2.6 finally defines standard macros
+ for adding values to a module, :cmacro:`PyModule_AddStringMacro`
+ and :cmacro:`PyModule_AddIntMacro()`. (Contributed by
+ Christian Heimes.)
+
* Some macros were renamed in both 3.0 and 2.6 to make it clearer that
they are macros,
not functions. :cmacro:`Py_Size()` became :cmacro:`Py_SIZE()`,
@@ -2112,6 +2245,13 @@ Changes to Python's build process and to the C API include:
``numfree``, and a macro :cmacro:`Py<typename>_MAXFREELIST` is
always defined.
+* A new Makefile target, "make check", prepares the Python source tree
+ for making a patch: it fixes trailing whitespace in all modified
+ ``.py`` files, checks whether the documentation has been changed,
+ and reports whether the :file:`Misc/ACKS` and :file:`Misc/NEWS` files
+ have been updated.
+ (Contributed by Brett Cannon.)
+
.. ======================================================================
@@ -2140,6 +2280,13 @@ Port-Specific Changes: Windows
module now support the context protocol, so they can be used
in :keyword:`with` statements. (Contributed by Christian Heimes.)
+ :mod:`_winreg` also has better support for x64 systems,
+ exposing the :func:`DisableReflectionKey`, :func:`EnableReflectionKey`,
+ and :func:`QueryReflectionKey` functions, which enable and disable
+ registry reflection for 32-bit processes running on 64-bit systems.
+
+ .. Patch 1753245
+
* The new default compiler on Windows is Visual Studio 2008 (VS 9.0). The
build directories for Visual Studio 2003 (VS7.1) and 2005 (VS8.0)
were moved into the PC/ directory. The new PCbuild directory supports
@@ -2237,5 +2384,5 @@ Acknowledgements
================
The author would like to thank the following people for offering suggestions,
-corrections and assistance with various drafts of this article: .
+corrections and assistance with various drafts of this article: Jim Jewett.