summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-27 15:18:18 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-27 15:18:18 (GMT)
commitaf98da18c0af924d7b03884a14ecd8e72a4832d0 (patch)
tree22aaecf7da5a5102d9c43cae707212a5a9b7c97f /Doc
parent4f110d880502f87995ea7d04726deeeb0640a4db (diff)
downloadcpython-af98da18c0af924d7b03884a14ecd8e72a4832d0.zip
cpython-af98da18c0af924d7b03884a14ecd8e72a4832d0.tar.gz
cpython-af98da18c0af924d7b03884a14ecd8e72a4832d0.tar.bz2
Merged revisions 60284-60349 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r60286 | christian.heimes | 2008-01-25 15:54:23 +0100 (Fri, 25 Jan 2008) | 1 line setup.py doesn't pick up changes to a header file ........ r60287 | christian.heimes | 2008-01-25 16:52:11 +0100 (Fri, 25 Jan 2008) | 2 lines Added the Python core headers Include/*.h and pyconfig.h as dependencies for the extensions in Modules/ It forces a rebuild of all extensions when a header files has been modified ........ r60291 | raymond.hettinger | 2008-01-25 20:24:46 +0100 (Fri, 25 Jan 2008) | 4 lines Changes 54857 and 54840 broke code and were reverted in Py2.5 just before it was released, but that reversion never made it to the Py2.6 head. ........ r60296 | guido.van.rossum | 2008-01-25 20:50:26 +0100 (Fri, 25 Jan 2008) | 2 lines Rewrite the list_inline_repeat overflow check slightly differently. ........ r60301 | thomas.wouters | 2008-01-25 22:09:34 +0100 (Fri, 25 Jan 2008) | 4 lines Use the right (portable) definition of the max of a Py_ssize_t. ........ r60303 | thomas.wouters | 2008-01-26 02:47:05 +0100 (Sat, 26 Jan 2008) | 5 lines Make 'testall' work again when building in a separate directory. test_distutils still fails when doing that. ........ r60305 | neal.norwitz | 2008-01-26 06:54:48 +0100 (Sat, 26 Jan 2008) | 3 lines Prevent this test from failing if there are transient network problems by retrying the host for up to 3 times. ........ r60306 | neal.norwitz | 2008-01-26 08:26:12 +0100 (Sat, 26 Jan 2008) | 12 lines Use a condition variable (threading.Event) rather than sleeps and checking a global to determine when the server is ready to be used. This slows the test down, but should make it correct. There was a race condition before where the server could have assigned a port, yet it wasn't ready to serve requests. If the client sent a request before the server was completely ready, it would get an exception. There was machinery to try to handle this condition. All of that should be unnecessary and removed if this change works. A NOTE was added as a comment about what needs to be fixed. The buildbots will tell us if there are more errors or if this test is now stable. ........ r60307 | neal.norwitz | 2008-01-26 08:38:03 +0100 (Sat, 26 Jan 2008) | 3 lines Fix exception in tearDown on ppc buildbot. If there's no directory, that shouldn't cause the test to fail. Just like it setUp. ........ r60308 | raymond.hettinger | 2008-01-26 09:19:06 +0100 (Sat, 26 Jan 2008) | 3 lines Make PySet_Add() work with frozensets. Works like PyTuple_SetItem() to build-up values in a brand new frozenset. ........ r60309 | neal.norwitz | 2008-01-26 09:26:00 +0100 (Sat, 26 Jan 2008) | 1 line The OS X buildbot had errors with the unavailable exceptions disabled. Restore it. ........ r60310 | raymond.hettinger | 2008-01-26 09:37:28 +0100 (Sat, 26 Jan 2008) | 4 lines Let marshal build-up sets and frozensets one element at a time. Saves the unnecessary creation of a tuple as intermediate container. ........ r60311 | raymond.hettinger | 2008-01-26 09:41:13 +0100 (Sat, 26 Jan 2008) | 1 line Update test code for change to PySet_Add(). ........ r60312 | raymond.hettinger | 2008-01-26 10:31:11 +0100 (Sat, 26 Jan 2008) | 1 line Revert PySet_Add() changes. ........ r60314 | georg.brandl | 2008-01-26 10:43:35 +0100 (Sat, 26 Jan 2008) | 2 lines #1934: fix os.path.isabs docs. ........ r60316 | georg.brandl | 2008-01-26 12:00:18 +0100 (Sat, 26 Jan 2008) | 2 lines Add missing things in re docstring. ........ r60317 | georg.brandl | 2008-01-26 12:02:22 +0100 (Sat, 26 Jan 2008) | 2 lines Slashes allowed on Windows. ........ r60319 | georg.brandl | 2008-01-26 14:41:21 +0100 (Sat, 26 Jan 2008) | 2 lines Fix markup again. ........ r60320 | andrew.kuchling | 2008-01-26 14:50:51 +0100 (Sat, 26 Jan 2008) | 1 line Add some items ........ r60321 | georg.brandl | 2008-01-26 15:02:38 +0100 (Sat, 26 Jan 2008) | 2 lines Clarify "b" mode under Unix. ........ r60322 | georg.brandl | 2008-01-26 15:03:47 +0100 (Sat, 26 Jan 2008) | 3 lines #1940: make it possible to use curses.filter() before curses.initscr() as the documentation says. ........ r60324 | georg.brandl | 2008-01-26 15:14:20 +0100 (Sat, 26 Jan 2008) | 3 lines #1473257: add generator.gi_code attribute that refers to the original code object backing the generator. Patch by Collin Winter. ........ r60325 | georg.brandl | 2008-01-26 15:19:22 +0100 (Sat, 26 Jan 2008) | 2 lines Move C API entries to the corresponding section. ........ r60326 | christian.heimes | 2008-01-26 17:43:35 +0100 (Sat, 26 Jan 2008) | 1 line Unit test fix from Giampaolo Rodola, #1938 ........ r60327 | gregory.p.smith | 2008-01-26 19:51:05 +0100 (Sat, 26 Jan 2008) | 2 lines Update docs for new callpack params added in r60188 ........ r60329 | neal.norwitz | 2008-01-26 21:24:36 +0100 (Sat, 26 Jan 2008) | 3 lines Cleanup the code a bit. test_rfind is failing on PPC and PPC64 buildbots, this might fix the problem. ........ r60330 | neal.norwitz | 2008-01-26 22:02:45 +0100 (Sat, 26 Jan 2008) | 1 line Always try to remove the test file even if close raises an exception ........ r60331 | neal.norwitz | 2008-01-26 22:21:59 +0100 (Sat, 26 Jan 2008) | 3 lines Reduce the race condition by signalling when the server is ready and not trying to connect before. ........ r60334 | neal.norwitz | 2008-01-27 00:13:46 +0100 (Sun, 27 Jan 2008) | 5 lines On some systems (e.g., Ubuntu on hppa) the flush() doesn't cause the exception, but the close() does. Will backport. ........ r60335 | neal.norwitz | 2008-01-27 00:14:17 +0100 (Sun, 27 Jan 2008) | 2 lines Consistently use tempfile.tempdir for the db_home directory. ........ r60338 | neal.norwitz | 2008-01-27 02:44:05 +0100 (Sun, 27 Jan 2008) | 4 lines Eliminate the sleeps that assume the server will start in .5 seconds. This should make the test less flaky. It also speeds up the test by about 75% on my box (20+ seconds -> ~4 seconds). ........ r60342 | neal.norwitz | 2008-01-27 06:02:34 +0100 (Sun, 27 Jan 2008) | 6 lines Try to prevent this test from being flaky. We might need a sleep in here which isn't as bad as it sounds. The close() *should* raise an exception, so if it didn't we should give more time to sync and really raise it. Will backport. ........ r60344 | jeffrey.yasskin | 2008-01-27 06:40:35 +0100 (Sun, 27 Jan 2008) | 3 lines Make rational.gcd() public and allow Rational to take decimal strings, per Raymond's advice. ........ r60345 | neal.norwitz | 2008-01-27 08:36:03 +0100 (Sun, 27 Jan 2008) | 3 lines Mostly reformat. Also set an error and return NULL if neither MS_WINDOWS nor UNIX is defined. This may have caused problems on cygwin. ........ r60346 | neal.norwitz | 2008-01-27 08:37:38 +0100 (Sun, 27 Jan 2008) | 3 lines Use int for the sign rather than a char. char can be signed or unsigned. It's system dependent. This might fix the problem with test_rfind failing. ........ r60347 | neal.norwitz | 2008-01-27 08:41:33 +0100 (Sun, 27 Jan 2008) | 1 line Add stdarg include for va_list to get this to compile on cygwin ........ r60348 | raymond.hettinger | 2008-01-27 11:13:57 +0100 (Sun, 27 Jan 2008) | 1 line Docstring nit ........ r60349 | raymond.hettinger | 2008-01-27 11:47:55 +0100 (Sun, 27 Jan 2008) | 1 line Removed an unnecessary and confusing paragraph from the namedtuple docs. ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/module.rst8
-rw-r--r--Doc/library/collections.rst11
-rw-r--r--Doc/library/ftplib.rst20
-rw-r--r--Doc/library/os.path.rst4
-rw-r--r--Doc/tutorial/inputoutput.rst19
-rw-r--r--Doc/whatsnew/2.6.rst64
6 files changed, 92 insertions, 34 deletions
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst
index 5ccdc63..9be2a11 100644
--- a/Doc/c-api/module.rst
+++ b/Doc/c-api/module.rst
@@ -18,12 +18,12 @@ There are only a few functions special to module objects.
is exposed to Python programs as ``types.ModuleType``.
-.. cmacro:: int PyModule_Check(PyObject *p)
+.. cfunction:: int PyModule_Check(PyObject *p)
Return true if *p* is a module object, or a subtype of a module object.
-.. cmacro:: int PyModule_CheckExact(PyObject *p)
+.. cfunction:: int PyModule_CheckExact(PyObject *p)
Return true if *p* is a module object, but not a subtype of
:cdata:`PyModule_Type`.
@@ -94,7 +94,7 @@ There are only a few functions special to module objects.
null-terminated. Return ``-1`` on error, ``0`` on success.
-.. cmacro:: int PyModule_AddIntMacro(PyObject *module, macro)
+.. cfunction:: int PyModule_AddIntMacro(PyObject *module, macro)
Add an int constant to *module*. The name and the value are taken from
*macro*. For example ``PyModule_AddConstant(module, AF_INET)`` adds the int
@@ -102,7 +102,7 @@ There are only a few functions special to module objects.
Return ``-1`` on error, ``0`` on success.
-.. cmacro:: int PyModule_AddStringMacro(PyObject *module, macro)
+.. cfunction:: int PyModule_AddStringMacro(PyObject *module, macro)
Add a string constant to *module*.
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index d138d23..e13e32b 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -557,16 +557,7 @@ a fixed-width print format::
Point: x= 3.000 y= 4.000 hypot= 5.000
Point: x=14.000 y= 0.714 hypot=14.018
-Another use for subclassing is to replace performance critcal methods with
-faster versions that bypass error-checking::
-
- class Point(namedtuple('Point', 'x y')):
- __slots__ = ()
- _make = classmethod(tuple.__new__)
- def _replace(self, _map=map, **kwds):
- return self._make(_map(kwds.get, ('x', 'y'), self))
-
-The subclasses shown above set ``__slots__`` to an empty tuple. This keeps
+The subclass shown above sets ``__slots__`` to an empty tuple. This keeps
keep memory requirements low by preventing the creation of instance dictionaries.
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
index 2c06ac7..9e99190 100644
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -176,11 +176,12 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
.. method:: FTP.retrlines(command[, callback])
- Retrieve a file or directory listing in ASCII transfer mode. *command* should be
- an appropriate ``RETR`` command (see :meth:`retrbinary`) or a ``LIST`` command
- (usually just the string ``'LIST'``). The *callback* function is called for
- each line, with the trailing CRLF stripped. The default *callback* prints the
- line to ``sys.stdout``.
+ Retrieve a file or directory listing in ASCII transfer mode. *command*
+ should be an appropriate ``RETR`` command (see :meth:`retrbinary`) or a
+ command such as ``LIST``, ``NLST`` or ``MLSD`` (usually just the string
+ ``'LIST'``). The *callback* function is called for each line, with the
+ trailing CRLF stripped. The default *callback* prints the line to
+ ``sys.stdout``.
.. method:: FTP.set_pasv(boolean)
@@ -190,20 +191,23 @@ followed by ``lines`` for the text version or ``binary`` for the binary version.
it is on by default.)
-.. method:: FTP.storbinary(command, file[, blocksize])
+.. method:: FTP.storbinary(command, file[, blocksize, callback])
Store a file in binary transfer mode. *command* should be an appropriate
``STOR`` command: ``"STOR filename"``. *file* is an open file object which is
read until EOF using its :meth:`read` method in blocks of size *blocksize* to
provide the data to be stored. The *blocksize* argument defaults to 8192.
+ *callback* is an optional single parameter callable that is called
+ on each block of data after it is sent.
-.. method:: FTP.storlines(command, file)
+.. method:: FTP.storlines(command, file[, callback])
Store a file in ASCII transfer mode. *command* should be an appropriate
``STOR`` command (see :meth:`storbinary`). Lines are read until EOF from the
open file object *file* using its :meth:`readline` method to provide the data to
- be stored.
+ be stored. *callback* is an optional single parameter callable
+ that is called on each line after it is sent.
.. method:: FTP.transfercmd(cmd[, rest])
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
index b176524..4d7f0a4 100644
--- a/Doc/library/os.path.rst
+++ b/Doc/library/os.path.rst
@@ -130,7 +130,9 @@ write files see :func:`open`, and for accessing the filesystem see the
.. function:: isabs(path)
- Return ``True`` if *path* is an absolute pathname (begins with a slash).
+ Return ``True`` if *path* is an absolute pathname. On Unix, that means it
+ begins with a slash, on Windows that it begins with a (back)slash after chopping
+ off a potential drive letter.
.. function:: isfile(path)
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index d4cad87..acd82d5 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -195,16 +195,15 @@ automatically added to the end. ``'r+'`` opens the file for both reading and
writing. The *mode* argument is optional; ``'r'`` will be assumed if it's
omitted.
-``'b'`` appended to the mode opens the file in binary mode, so there are
-also modes like ``'rb'``, ``'wb'``, and ``'r+b'``. Python distinguishes
-between text and binary files. Binary files are read and written without
-any data transformation. In text mode, platform-specific newline
-representations are automatically converted to newlines when read and
-newline characters are automatically converted to the proper
-platform-specific representation when written. This makes writing portable
-code which reads or writes text files easier. In addition, when reading
-from or writing to text files, the data are automatically decoded or
-encoding, respectively, using the encoding associated with the file.
+On Windows and the Macintosh, ``'b'`` appended to the mode opens the file in
+binary mode, so there are also modes like ``'rb'``, ``'wb'``, and ``'r+b'``.
+Windows makes a distinction between text and binary files; the end-of-line
+characters in text files are automatically altered slightly when data is read or
+written. This behind-the-scenes modification to file data is fine for ASCII
+text files, but it'll corrupt binary data like that in :file:`JPEG` or
+:file:`EXE` files. Be very careful to use binary mode when reading and writing
+such files. On Unix, it doesn't hurt to append a ``'b'`` to the mode, so
+you can use it platform-independently for all binary files.
This behind-the-scenes modification to file data is fine for text files, but
will corrupt binary data like that in :file:`JPEG` or :file:`EXE` files. Be
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 83101bd..cbc8b8f 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -3,6 +3,7 @@
****************************
.. XXX mention switch to Roundup for bug tracking
+.. XXX add trademark info for Apple, Microsoft.
:Author: A.M. Kuchling
:Release: |release|
@@ -909,7 +910,13 @@ complete list of changes, or look through the CVS logs for all the details.
* An optional ``timeout`` parameter was added to the
:class:`ftplib.FTP` class constructor as well as the :meth:`connect`
method, specifying a timeout measured in seconds. (Added by Facundo
- Batista.)
+ Batista.) Also, the :class:`FTP` class's
+ :meth:`storbinary` and :meth:`storlines`
+ now take an optional *callback* parameter that will be called with
+ each block of data after the data has been sent.
+ (Contributed by Phil Schwartz.)
+
+ .. Patch 1221598
* The :func:`reduce` built-in function is also available in the
:mod:`functools` module. In Python 3.0, the built-in is dropped and it's
@@ -1041,6 +1048,13 @@ complete list of changes, or look through the CVS logs for all the details.
.. Patch 1137
+* The :mod:`Queue` module now provides queue classes that retrieve entries
+ in different orders. The :class:`PriorityQueue` class stores
+ queued items in a heap and retrieves them in priority order,
+ and :class:`LifoQueue` retrieves the most recently added entries first,
+ meaning that it behaves like a stack.
+ (Contributed by Raymond Hettinger.)
+
* The :mod:`random` module's :class:`Random` objects can
now be pickled on a 32-bit system and unpickled on a 64-bit
system, and vice versa. Unfortunately, this change also means
@@ -1304,6 +1318,47 @@ XXX Certain features require the OpenSSL package to be installed, notably
SSL module documentation.
+
+.. ======================================================================
+
+plistlib: A Property-List Parser
+--------------------------------------------------
+
+A commonly-used format on MacOS X is the ``.plist`` format,
+which stores basic data types (numbers, strings, lists,
+and dictionaries) and serializes them into an XML-based format.
+(It's a lot like the XML-RPC serialization of data types.)
+
+Despite being primarily used on MacOS X, the format
+has nothing Mac-specific about it and the Python implementation works
+on any platform that Python supports, so the :mod:`plistlib` module
+has been promoted to the standard library.
+
+Using the module is simple::
+
+ import sys
+ import plistlib
+ import datetime
+
+ # Create data structure
+ data_struct = dict(lastAccessed=datetime.datetime.now(),
+ version=1,
+ categories=('Personal', 'Shared', 'Private'))
+
+ # Create string containing XML.
+ plist_str = plistlib.writePlistToString(data_struct)
+ new_struct = plistlib.readPlistFromString(plist_str)
+ print data_struct
+ print new_struct
+
+ # Write data structure to a file and read it back.
+ plistlib.writePlist(data_struct, '/tmp/customizations.plist')
+ new_struct = plistlib.readPlist('/tmp/customizations.plist')
+
+ # read/writePlist accepts file-like objects as well as paths.
+ plistlib.writePlist(data_struct, sys.stdout)
+
+
.. ======================================================================
@@ -1351,6 +1406,13 @@ Changes to Python's build process and to the C API include:
.. Issue 1629
+* Distutils now places C extensions it builds in a
+ different directory when running on a debug version of Python.
+ (Contributed by Collin Winter.)
+
+ .. Patch 1530959
+
+
.. ======================================================================