diff options
author | Guido van Rossum <guido@python.org> | 2007-06-06 23:52:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-06-06 23:52:48 (GMT) |
commit | e7ba4956272a7105ea90dd505f70e5947aa27161 (patch) | |
tree | b28c14ab345faf72d32ae96639f8e1d2629e1761 /Doc | |
parent | 0e41148c4bdb3b1af157a9bf55df4bc27474f1e8 (diff) | |
download | cpython-e7ba4956272a7105ea90dd505f70e5947aa27161.zip cpython-e7ba4956272a7105ea90dd505f70e5947aa27161.tar.gz cpython-e7ba4956272a7105ea90dd505f70e5947aa27161.tar.bz2 |
Merged revisions 55631-55794 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55636 | neal.norwitz | 2007-05-29 00:06:39 -0700 (Tue, 29 May 2007) | 149 lines
Merged revisions 55506-55635 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55507 | georg.brandl | 2007-05-22 07:28:17 -0700 (Tue, 22 May 2007) | 2 lines
Remove the "panel" module doc file which has been ignored since 1994.
........
r55522 | mark.hammond | 2007-05-22 19:04:28 -0700 (Tue, 22 May 2007) | 4 lines
Remove definition of PY_UNICODE_TYPE from pyconfig.h, allowing the
definition in unicodeobject.h to be used, giving us the desired
wchar_t in place of 'unsigned short'. As discussed on python-dev.
........
r55525 | neal.norwitz | 2007-05-22 23:35:32 -0700 (Tue, 22 May 2007) | 6 lines
Add -3 option to the interpreter to warn about features that are
deprecated and will be changed/removed in Python 3.0.
This patch is mostly from Anthony. I tweaked some format and added
a little doc.
........
r55527 | neal.norwitz | 2007-05-22 23:57:35 -0700 (Tue, 22 May 2007) | 1 line
Whitespace cleanup
........
r55528 | neal.norwitz | 2007-05-22 23:58:36 -0700 (Tue, 22 May 2007) | 1 line
Add a bunch more deprecation warnings for builtins that are going away in 3.0
........
r55549 | georg.brandl | 2007-05-24 09:49:29 -0700 (Thu, 24 May 2007) | 2 lines
shlex.split() now has an optional "posix" parameter.
........
r55550 | georg.brandl | 2007-05-24 10:33:33 -0700 (Thu, 24 May 2007) | 2 lines
Fix parameter passing.
........
r55555 | facundo.batista | 2007-05-24 10:50:54 -0700 (Thu, 24 May 2007) | 6 lines
Added an optional timeout parameter to urllib.ftpwrapper, with tests
(for this and a basic one, because there weren't any). Changed also
NEWS, but didn't find documentation for this function, assumed it
wasn't public...
........
r55563 | facundo.batista | 2007-05-24 13:01:59 -0700 (Thu, 24 May 2007) | 4 lines
Removed the .recv() in the test, is not necessary, and was
causing problems that didn't have anything to do with was
actually being tested...
........
r55564 | facundo.batista | 2007-05-24 13:51:19 -0700 (Thu, 24 May 2007) | 5 lines
Let's see if reading exactly what is written allow this live
test to pass (now I know why there were so few tests in ftp,
http, etc, :( ).
........
r55567 | facundo.batista | 2007-05-24 20:10:28 -0700 (Thu, 24 May 2007) | 4 lines
Trying to make the tests work in Windows and Solaris, everywhere
else just works
........
r55568 | facundo.batista | 2007-05-24 20:47:19 -0700 (Thu, 24 May 2007) | 4 lines
Fixing stupid error, and introducing a sleep, to see if the
other thread is awakened and finish sending data.
........
r55569 | facundo.batista | 2007-05-24 21:20:22 -0700 (Thu, 24 May 2007) | 4 lines
Commenting out the tests until find out who can test them in
one of the problematic enviroments.
........
r55570 | neal.norwitz | 2007-05-24 22:13:40 -0700 (Thu, 24 May 2007) | 2 lines
Get test passing again by commenting out the reference to the test class.
........
r55575 | vinay.sajip | 2007-05-25 00:05:59 -0700 (Fri, 25 May 2007) | 1 line
Updated docstring for SysLogHandler (#1720726).
........
r55576 | vinay.sajip | 2007-05-25 00:06:55 -0700 (Fri, 25 May 2007) | 1 line
Updated documentation for SysLogHandler (#1720726).
........
r55592 | brett.cannon | 2007-05-25 13:17:15 -0700 (Fri, 25 May 2007) | 3 lines
Remove direct call's to file's constructor and replace them with calls to
open() as ths is considered best practice.
........
r55601 | kristjan.jonsson | 2007-05-26 12:19:50 -0700 (Sat, 26 May 2007) | 1 line
Remove the rgbimgmodule from PCBuild8
........
r55602 | kristjan.jonsson | 2007-05-26 12:31:39 -0700 (Sat, 26 May 2007) | 1 line
Include <windows.h> after python.h, so that WINNT is properly set before windows.h is included. Fixes warnings in PC builds.
........
r55603 | walter.doerwald | 2007-05-26 14:04:13 -0700 (Sat, 26 May 2007) | 2 lines
Fix typo.
........
r55604 | peter.astrand | 2007-05-26 15:18:20 -0700 (Sat, 26 May 2007) | 1 line
Applied patch 1669481, slightly modified: Support close_fds on Win32
........
r55606 | neal.norwitz | 2007-05-26 21:08:54 -0700 (Sat, 26 May 2007) | 2 lines
Add the new function object attribute names from py3k.
........
r55617 | lars.gustaebel | 2007-05-27 12:49:30 -0700 (Sun, 27 May 2007) | 20 lines
Added errors argument to TarFile class that allows the user to
specify an error handling scheme for character conversion. Additional
scheme "utf-8" in read mode. Unicode input filenames are now
supported by design. The values of the pax_headers dictionary are now
limited to unicode objects.
Fixed: The prefix field is no longer used in PAX_FORMAT (in
conformance with POSIX).
Fixed: In read mode use a possible pax header size field.
Fixed: Strip trailing slashes from pax header name values.
Fixed: Give values in user-specified pax_headers precedence when
writing.
Added unicode tests. Added pax/regtype4 member to testtar.tar all
possible number fields in a pax header.
Added two chapters to the documentation about the different formats
tarfile.py supports and how unicode issues are handled.
........
r55618 | raymond.hettinger | 2007-05-27 22:23:22 -0700 (Sun, 27 May 2007) | 1 line
Explain when groupby() issues a new group.
........
r55634 | martin.v.loewis | 2007-05-28 21:01:29 -0700 (Mon, 28 May 2007) | 2 lines
Test pre-commit hook for a link to a .py file.
........
r55635 | martin.v.loewis | 2007-05-28 21:02:03 -0700 (Mon, 28 May 2007) | 2 lines
Revert 55634.
........
................
r55639 | neal.norwitz | 2007-05-29 00:58:11 -0700 (Tue, 29 May 2007) | 1 line
Remove sys.exc_{type,exc_value,exc_traceback}
................
r55641 | neal.norwitz | 2007-05-29 01:03:50 -0700 (Tue, 29 May 2007) | 1 line
Missed one sys.exc_type. I wonder why exc_{value,traceback} were already gone
................
r55642 | neal.norwitz | 2007-05-29 01:08:33 -0700 (Tue, 29 May 2007) | 1 line
Missed more doc for sys.exc_* attrs.
................
r55643 | neal.norwitz | 2007-05-29 01:18:19 -0700 (Tue, 29 May 2007) | 1 line
Remove sys.exc_clear()
................
r55665 | guido.van.rossum | 2007-05-29 19:45:43 -0700 (Tue, 29 May 2007) | 4 lines
Make None, True, False keywords.
We can now also delete all the other places that explicitly forbid
assignment to None, but I'm not going to bother right now.
................
r55666 | guido.van.rossum | 2007-05-29 20:01:51 -0700 (Tue, 29 May 2007) | 3 lines
Found another place that needs check for forbidden names.
Fixed test_syntax.py accordingly (it helped me find that one).
................
r55668 | guido.van.rossum | 2007-05-29 20:41:48 -0700 (Tue, 29 May 2007) | 2 lines
Mark None, True, False as keywords.
................
r55673 | neal.norwitz | 2007-05-29 23:28:25 -0700 (Tue, 29 May 2007) | 3 lines
Get the dis module working on modules again after changing dicts
to not return lists and also new-style classes. Add a test.
................
r55674 | neal.norwitz | 2007-05-29 23:35:45 -0700 (Tue, 29 May 2007) | 1 line
Umm, it helps to add the module that the test uses
................
r55675 | neal.norwitz | 2007-05-29 23:53:05 -0700 (Tue, 29 May 2007) | 4 lines
Try to fix up all the other places that were assigning to True/False.
There's at least one more problem in test.test_xmlrpc. I have other
changes in that file and that should be fixed soon (I hope).
................
r55679 | neal.norwitz | 2007-05-30 00:31:55 -0700 (Wed, 30 May 2007) | 1 line
Fix up another place that was assigning to True/False.
................
r55688 | brett.cannon | 2007-05-30 14:19:47 -0700 (Wed, 30 May 2007) | 2 lines
Ditch MimeWriter.
................
r55692 | brett.cannon | 2007-05-30 14:52:00 -0700 (Wed, 30 May 2007) | 2 lines
Remove the mimify module.
................
r55707 | guido.van.rossum | 2007-05-31 05:08:45 -0700 (Thu, 31 May 2007) | 2 lines
Backport the addition of show_code() to dis.py -- it's too handy.
................
r55708 | guido.van.rossum | 2007-05-31 06:22:57 -0700 (Thu, 31 May 2007) | 7 lines
Fix a fairly long-standing bug in the check for assignment to None (and other
keywords, these days). In 2.5, you could write foo(None=1) without getting
a SyntaxError (although foo()'s definition would have to use **kwds to avoid
getting a runtime error complaining about an unknown keyword of course).
This ought to be backported to 2.5.2 or at least 2.6.
................
r55724 | brett.cannon | 2007-05-31 19:32:41 -0700 (Thu, 31 May 2007) | 2 lines
Remove the cfmfile.
................
r55727 | neal.norwitz | 2007-05-31 22:19:44 -0700 (Thu, 31 May 2007) | 1 line
Remove reload() builtin.
................
r55729 | neal.norwitz | 2007-05-31 22:51:30 -0700 (Thu, 31 May 2007) | 59 lines
Merged revisions 55636-55728 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55637 | georg.brandl | 2007-05-29 00:16:47 -0700 (Tue, 29 May 2007) | 2 lines
Fix rst markup.
........
r55638 | neal.norwitz | 2007-05-29 00:51:39 -0700 (Tue, 29 May 2007) | 1 line
Fix typo in doc
........
r55671 | neal.norwitz | 2007-05-29 21:53:41 -0700 (Tue, 29 May 2007) | 1 line
Fix indentation (whitespace only).
........
r55676 | thomas.heller | 2007-05-29 23:58:30 -0700 (Tue, 29 May 2007) | 1 line
Fix compiler warnings.
........
r55677 | thomas.heller | 2007-05-30 00:01:25 -0700 (Wed, 30 May 2007) | 2 lines
Correct the name of a field in the WIN32_FIND_DATAA and WIN32_FIND_DATAW structures.
Closes bug #1726026.
........
r55686 | brett.cannon | 2007-05-30 13:46:26 -0700 (Wed, 30 May 2007) | 2 lines
Have MimeWriter raise a DeprecationWarning as per PEP 4 and its documentation.
........
r55690 | brett.cannon | 2007-05-30 14:48:58 -0700 (Wed, 30 May 2007) | 3 lines
Have mimify raise a DeprecationWarning. The docs and PEP 4 have listed the
module as deprecated for a while.
........
r55696 | brett.cannon | 2007-05-30 15:24:28 -0700 (Wed, 30 May 2007) | 2 lines
Have md5 raise a DeprecationWarning as per PEP 4.
........
r55705 | neal.norwitz | 2007-05-30 21:14:22 -0700 (Wed, 30 May 2007) | 1 line
Add some spaces in the example code.
........
r55716 | brett.cannon | 2007-05-31 12:20:00 -0700 (Thu, 31 May 2007) | 2 lines
Have the sha module raise a DeprecationWarning as specified in PEP 4.
........
r55719 | brett.cannon | 2007-05-31 12:40:42 -0700 (Thu, 31 May 2007) | 2 lines
Cause buildtools to raise a DeprecationWarning.
........
r55721 | brett.cannon | 2007-05-31 13:01:11 -0700 (Thu, 31 May 2007) | 2 lines
Have cfmfile raise a DeprecationWarning as per PEP 4.
........
r55726 | neal.norwitz | 2007-05-31 21:56:47 -0700 (Thu, 31 May 2007) | 1 line
Mail if there is an installation failure.
........
................
r55730 | neal.norwitz | 2007-05-31 23:22:07 -0700 (Thu, 31 May 2007) | 2 lines
Remove the code that was missed in rev 55303.
................
r55738 | neal.norwitz | 2007-06-01 19:10:43 -0700 (Fri, 01 Jun 2007) | 1 line
Fix doc breakage
................
r55741 | neal.norwitz | 2007-06-02 00:41:58 -0700 (Sat, 02 Jun 2007) | 1 line
Remove timing module (plus some remnants of other modules).
................
r55742 | neal.norwitz | 2007-06-02 00:51:44 -0700 (Sat, 02 Jun 2007) | 1 line
Remove posixfile module (plus some remnants of other modules).
................
r55744 | neal.norwitz | 2007-06-02 10:18:56 -0700 (Sat, 02 Jun 2007) | 1 line
Fix doc breakage.
................
r55745 | neal.norwitz | 2007-06-02 11:32:16 -0700 (Sat, 02 Jun 2007) | 1 line
Make a whatsnew 3.0 template.
................
r55754 | neal.norwitz | 2007-06-03 23:24:18 -0700 (Sun, 03 Jun 2007) | 1 line
SF #1730441, os._execvpe raises UnboundLocal due to new try/except semantics
................
r55755 | neal.norwitz | 2007-06-03 23:26:00 -0700 (Sun, 03 Jun 2007) | 1 line
Get rid of extra whitespace
................
r55794 | guido.van.rossum | 2007-06-06 15:29:22 -0700 (Wed, 06 Jun 2007) | 3 lines
Make this compile in GCC 2.96, which does not allow interspersing
declarations and code.
................
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Makefile | 2 | ||||
-rw-r--r-- | Doc/Makefile.deps | 3 | ||||
-rw-r--r-- | Doc/api/utilities.tex | 5 | ||||
-rw-r--r-- | Doc/ext/extending.tex | 7 | ||||
-rw-r--r-- | Doc/howto/functional.rst | 2 | ||||
-rw-r--r-- | Doc/lib/lib.tex | 3 | ||||
-rw-r--r-- | Doc/lib/libcodecs.tex | 2 | ||||
-rw-r--r-- | Doc/lib/libfuncs.tex | 76 | ||||
-rw-r--r-- | Doc/lib/libimp.tex | 5 | ||||
-rw-r--r-- | Doc/lib/libitertools.tex | 8 | ||||
-rw-r--r-- | Doc/lib/liblogging.tex | 7 | ||||
-rw-r--r-- | Doc/lib/libmimewriter.tex | 80 | ||||
-rw-r--r-- | Doc/lib/libmimify.tex | 94 | ||||
-rw-r--r-- | Doc/lib/libpickle.tex | 6 | ||||
-rw-r--r-- | Doc/lib/libposixfile.tex | 174 | ||||
-rw-r--r-- | Doc/lib/libshlex.tex | 6 | ||||
-rw-r--r-- | Doc/lib/libsubprocess.tex | 5 | ||||
-rw-r--r-- | Doc/lib/libsys.tex | 36 | ||||
-rw-r--r-- | Doc/lib/libtarfile.tex | 166 | ||||
-rw-r--r-- | Doc/lib/libtypes.tex | 2 | ||||
-rw-r--r-- | Doc/lib/libundoc.tex | 5 | ||||
-rw-r--r-- | Doc/lib/libzipimport.tex | 5 | ||||
-rw-r--r-- | Doc/mac/undoc.tex | 12 | ||||
-rw-r--r-- | Doc/ref/ref3.tex | 11 | ||||
-rw-r--r-- | Doc/tut/tut.tex | 4 | ||||
-rw-r--r-- | Doc/whatsnew/whatsnew30.tex | 178 |
26 files changed, 354 insertions, 550 deletions
diff --git a/Doc/Makefile b/Doc/Makefile index 03a32d0..3da9690 100644 --- a/Doc/Makefile +++ b/Doc/Makefile @@ -122,7 +122,7 @@ EMACS= emacs # The end of this should reflect the major/minor version numbers of # the release: -WHATSNEW=whatsnew26 +WHATSNEW=whatsnew30 # what's what MANDVIFILES= paper-$(PAPER)/api.dvi paper-$(PAPER)/ext.dvi \ diff --git a/Doc/Makefile.deps b/Doc/Makefile.deps index d0b06b3..e720220 100644 --- a/Doc/Makefile.deps +++ b/Doc/Makefile.deps @@ -171,7 +171,6 @@ LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \ lib/libgdbm.tex \ lib/libtermios.tex \ lib/libfcntl.tex \ - lib/libposixfile.tex \ lib/libsyslog.tex \ lib/liblogging.tex \ lib/libpdb.tex \ @@ -192,7 +191,6 @@ LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \ lib/libsgmllib.tex \ lib/librfc822.tex \ lib/libmimetools.tex \ - lib/libmimewriter.tex \ lib/libbinascii.tex \ lib/libmm.tex \ lib/libaudioop.tex \ @@ -235,7 +233,6 @@ LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \ lib/libzipfile.tex \ lib/libpprint.tex \ lib/libcode.tex \ - lib/libmimify.tex \ lib/libre.tex \ lib/libuserdict.tex \ lib/libdis.tex \ diff --git a/Doc/api/utilities.tex b/Doc/api/utilities.tex index 968ce4f..961f200 100644 --- a/Doc/api/utilities.tex +++ b/Doc/api/utilities.tex @@ -140,10 +140,7 @@ values from C values. \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PyImport_ReloadModule}{PyObject *m} - Reload a module. This is best described by referring to the - built-in Python function \function{reload()}\bifuncindex{reload}, as - the standard \function{reload()} function calls this function - directly. Return a new reference to the reloaded module, or \NULL{} + Reload a module. Return a new reference to the reloaded module, or \NULL{} with an exception set on failure (the module still exists in this case). \end{cfuncdesc} diff --git a/Doc/ext/extending.tex b/Doc/ext/extending.tex index 1f3e2d5..7796e9e 100644 --- a/Doc/ext/extending.tex +++ b/Doc/ext/extending.tex @@ -399,12 +399,7 @@ compiled modules into multiple interpreters within a process (or following a \cfunction{fork()} without an intervening \cfunction{exec()}) can create problems for some extension modules. Extension module authors should exercise caution when initializing -internal data structures. -Note also that the \function{reload()} function can be used with -extension modules, and will call the module initialization function -(\cfunction{initspam()} in the example), but will not load the module -again if it was loaded from a dynamically loadable object file -(\file{.so} on \UNIX, \file{.dll} on Windows).} +internal data structures.} A more substantial example module is included in the Python source distribution as \file{Modules/xxmodule.c}. This file may be used as a diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst index 98d1094..5a55339 100644 --- a/Doc/howto/functional.rst +++ b/Doc/howto/functional.rst @@ -980,7 +980,7 @@ element. that's a slice of the iterator. With a single ``stop`` argument, it will return the first ``stop`` elements. If you supply a starting index, you'll get ``stop-start`` -elements, and if you supply a value for ``step`, elements will be +elements, and if you supply a value for ``step``, elements will be skipped accordingly. Unlike Python's string and list slicing, you can't use negative values for ``start``, ``stop``, or ``step``. diff --git a/Doc/lib/lib.tex b/Doc/lib/lib.tex index cb82246..792b00b 100644 --- a/Doc/lib/lib.tex +++ b/Doc/lib/lib.tex @@ -146,8 +146,6 @@ and how to embed it in other applications. \input{libmhlib} \input{libmimetools} \input{libmimetypes} -\input{libmimewriter} -\input{libmimify} \input{libmultifile} \input{librfc822} @@ -265,7 +263,6 @@ and how to embed it in other applications. \input{libpty} \input{libfcntl} \input{libpipes} -\input{libposixfile} \input{libresource} \input{libnis} \input{libsyslog} diff --git a/Doc/lib/libcodecs.tex b/Doc/lib/libcodecs.tex index 78fa24d..a3399fb 100644 --- a/Doc/lib/libcodecs.tex +++ b/Doc/lib/libcodecs.tex @@ -237,7 +237,7 @@ any other keyword argument) is passed through to the incremental encoder. \begin{funcdesc}{iterdecode}{iterable, encoding\optional{, errors}} Uses an incremental decoder to iteratively decode the input provided by \var{iterable}. This function is a generator. \var{errors} (as well as -any other keyword argument) is passed through to the incremental encoder. +any other keyword argument) is passed through to the incremental decoder. \versionadded{2.5} \end{funcdesc} diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 5e6e2a0..4f49e33 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -890,82 +890,6 @@ class Parrot(object): \end{verbatim} \end{funcdesc} -\begin{funcdesc}{reload}{module} - Reload a previously imported \var{module}. The - argument must be a module object, so it must have been successfully - imported before. This is useful if you have edited the module - source file using an external editor and want to try out the new - version without leaving the Python interpreter. The return value is - the module object (the same as the \var{module} argument). - - When \code{reload(module)} is executed: - -\begin{itemize} - - \item Python modules' code is recompiled and the module-level code - reexecuted, defining a new set of objects which are bound to names in - the module's dictionary. The \code{init} function of extension - modules is not called a second time. - - \item As with all other objects in Python the old objects are only - reclaimed after their reference counts drop to zero. - - \item The names in the module namespace are updated to point to - any new or changed objects. - - \item Other references to the old objects (such as names external - to the module) are not rebound to refer to the new objects and - must be updated in each namespace where they occur if that is - desired. - -\end{itemize} - - There are a number of other caveats: - - If a module is syntactically correct but its initialization fails, - the first \keyword{import} statement for it does not bind its name - locally, but does store a (partially initialized) module object in - \code{sys.modules}. To reload the module you must first - \keyword{import} it again (this will bind the name to the partially - initialized module object) before you can \function{reload()} it. - - When a module is reloaded, its dictionary (containing the module's - global variables) is retained. Redefinitions of names will override - the old definitions, so this is generally not a problem. If the new - version of a module does not define a name that was defined by the - old version, the old definition remains. This feature can be used - to the module's advantage if it maintains a global table or cache of - objects --- with a \keyword{try} statement it can test for the - table's presence and skip its initialization if desired: - -\begin{verbatim} -try: - cache -except NameError: - cache = {} -\end{verbatim} - - - It is legal though generally not very useful to reload built-in or - dynamically loaded modules, except for \refmodule{sys}, - \refmodule[main]{__main__} and \refmodule[builtin]{__builtin__}. In - many cases, however, extension modules are not designed to be - initialized more than once, and may fail in arbitrary ways when - reloaded. - - If a module imports objects from another module using \keyword{from} - \ldots{} \keyword{import} \ldots{}, calling \function{reload()} for - the other module does not redefine the objects imported from it --- - one way around this is to re-execute the \keyword{from} statement, - another is to use \keyword{import} and qualified names - (\var{module}.\var{name}) instead. - - If a module instantiates instances of a class, reloading the module - that defines the class does not affect the method definitions of the - instances --- they continue to use the old class definition. The - same is true for derived classes. -\end{funcdesc} - \begin{funcdesc}{repr}{object} Return a string containing a printable representation of an object. This is the same value yielded by conversions (reverse quotes). diff --git a/Doc/lib/libimp.tex b/Doc/lib/libimp.tex index 5379309..6396605 100644 --- a/Doc/lib/libimp.tex +++ b/Doc/lib/libimp.tex @@ -69,8 +69,7 @@ this recipe recursively. Load a module that was previously found by \function{find_module()} (or by an otherwise conducted search yielding compatible results). This function does more than importing the module: if the module was -already imported, it is equivalent to a -\function{reload()}\bifuncindex{reload}! The \var{name} argument +already imported, it will reload the module! The \var{name} argument indicates the full module name (including the package name, if this is a submodule of a package). The \var{file} argument is an open file, and \var{filename} is the corresponding file name; these can be @@ -286,7 +285,7 @@ def __import__(name, globals=None, locals=None, fromlist=None): \end{verbatim} A more complete example that implements hierarchical module names and -includes a \function{reload()}\bifuncindex{reload} function can be +includes a \function{reload()} function can be found in the module \module{knee}\refmodindex{knee}. The \module{knee} module can be found in \file{Demo/imputil/} in the Python source distribution. diff --git a/Doc/lib/libitertools.tex b/Doc/lib/libitertools.tex index 9bf8ab0..19bc826 100644 --- a/Doc/lib/libitertools.tex +++ b/Doc/lib/libitertools.tex @@ -138,6 +138,13 @@ by functions or loops that truncate the stream. identity function and returns the element unchanged. Generally, the iterable needs to already be sorted on the same key function. + The operation of \function{groupby()} is similar to the \code{uniq} filter + in \UNIX{}. It generates a break or new group every time the value + of the key function changes (which is why it is usually necessary + to have sorted the data using the same key function). That behavior + differs from SQL's GROUP BY which aggregates common elements regardless + of their input order. + The returned group is itself an iterator that shares the underlying iterable with \function{groupby()}. Because the source is shared, when the \function{groupby} object is advanced, the previous group is no @@ -147,6 +154,7 @@ by functions or loops that truncate the stream. \begin{verbatim} groups = [] uniquekeys = [] + data = sorted(data, key=keyfunc) for k, g in groupby(data, keyfunc): groups.append(list(g)) # Store group iterator as a list uniquekeys.append(k) diff --git a/Doc/lib/liblogging.tex b/Doc/lib/liblogging.tex index 5783cbf..c5c3e4e 100644 --- a/Doc/lib/liblogging.tex +++ b/Doc/lib/liblogging.tex @@ -1208,8 +1208,11 @@ Returns a new instance of the \class{SysLogHandler} class intended to communicate with a remote \UNIX{} machine whose address is given by \var{address} in the form of a \code{(\var{host}, \var{port})} tuple. If \var{address} is not specified, \code{('localhost', 514)} is -used. The address is used to open a UDP socket. If \var{facility} is -not specified, \constant{LOG_USER} is used. +used. The address is used to open a UDP socket. An alternative to providing +a \code{(\var{host}, \var{port})} tuple is providing an address as a string, +for example "/dev/log". In this case, a Unix domain socket is used to send +the message to the syslog. If \var{facility} is not specified, +\constant{LOG_USER} is used. \end{classdesc} \begin{methoddesc}{close}{} diff --git a/Doc/lib/libmimewriter.tex b/Doc/lib/libmimewriter.tex deleted file mode 100644 index 74bd9bb..0000000 --- a/Doc/lib/libmimewriter.tex +++ /dev/null @@ -1,80 +0,0 @@ -\section{\module{MimeWriter} --- - Generic MIME file writer} - -\declaremodule{standard}{MimeWriter} - -\modulesynopsis{Generic MIME file writer.} -\sectionauthor{Christopher G. Petrilli}{petrilli@amber.org} - -\deprecated{2.3}{The \refmodule{email} package should be used in - preference to the \module{MimeWriter} module. This - module is present only to maintain backward - compatibility.} - -This module defines the class \class{MimeWriter}. The -\class{MimeWriter} class implements a basic formatter for creating -MIME multi-part files. It doesn't seek around the output file nor -does it use large amounts of buffer space. You must write the parts -out in the order that they should occur in the final -file. \class{MimeWriter} does buffer the headers you add, allowing you -to rearrange their order. - -\begin{classdesc}{MimeWriter}{fp} -Return a new instance of the \class{MimeWriter} class. The only -argument passed, \var{fp}, is a file object to be used for -writing. Note that a \class{StringIO} object could also be used. -\end{classdesc} - - -\subsection{MimeWriter Objects \label{MimeWriter-objects}} - - -\class{MimeWriter} instances have the following methods: - -\begin{methoddesc}[MimeWriter]{addheader}{key, value\optional{, prefix}} -Add a header line to the MIME message. The \var{key} is the name of -the header, where the \var{value} obviously provides the value of the -header. The optional argument \var{prefix} determines where the header -is inserted; \samp{0} means append at the end, \samp{1} is insert at -the start. The default is to append. -\end{methoddesc} - -\begin{methoddesc}[MimeWriter]{flushheaders}{} -Causes all headers accumulated so far to be written out (and -forgotten). This is useful if you don't need a body part at all, -e.g.\ for a subpart of type \mimetype{message/rfc822} that's (mis)used -to store some header-like information. -\end{methoddesc} - -\begin{methoddesc}[MimeWriter]{startbody}{ctype\optional{, plist\optional{, prefix}}} -Returns a file-like object which can be used to write to the -body of the message. The content-type is set to the provided -\var{ctype}, and the optional parameter \var{plist} provides -additional parameters for the content-type declaration. \var{prefix} -functions as in \method{addheader()} except that the default is to -insert at the start. -\end{methoddesc} - -\begin{methoddesc}[MimeWriter]{startmultipartbody}{subtype\optional{, - boundary\optional{, plist\optional{, prefix}}}} -Returns a file-like object which can be used to write to the -body of the message. Additionally, this method initializes the -multi-part code, where \var{subtype} provides the multipart subtype, -\var{boundary} may provide a user-defined boundary specification, and -\var{plist} provides optional parameters for the subtype. -\var{prefix} functions as in \method{startbody()}. Subparts should be -created using \method{nextpart()}. -\end{methoddesc} - -\begin{methoddesc}[MimeWriter]{nextpart}{} -Returns a new instance of \class{MimeWriter} which represents an -individual part in a multipart message. This may be used to write the -part as well as used for creating recursively complex multipart -messages. The message must first be initialized with -\method{startmultipartbody()} before using \method{nextpart()}. -\end{methoddesc} - -\begin{methoddesc}[MimeWriter]{lastpart}{} -This is used to designate the last part of a multipart message, and -should \emph{always} be used when writing multipart messages. -\end{methoddesc} diff --git a/Doc/lib/libmimify.tex b/Doc/lib/libmimify.tex deleted file mode 100644 index d99567a..0000000 --- a/Doc/lib/libmimify.tex +++ /dev/null @@ -1,94 +0,0 @@ -\section{\module{mimify} --- - MIME processing of mail messages} - -\declaremodule{standard}{mimify} -\modulesynopsis{Mimification and unmimification of mail messages.} - -\deprecated{2.3}{The \refmodule{email} package should be used in - preference to the \module{mimify} module. This - module is present only to maintain backward - compatibility.} - -The \module{mimify} module defines two functions to convert mail messages to -and from MIME format. The mail message can be either a simple message -or a so-called multipart message. Each part is treated separately. -Mimifying (a part of) a message entails encoding the message as -quoted-printable if it contains any characters that cannot be -represented using 7-bit \ASCII. Unmimifying (a part of) a message -entails undoing the quoted-printable encoding. Mimify and unmimify -are especially useful when a message has to be edited before being -sent. Typical use would be: - -\begin{verbatim} -unmimify message -edit message -mimify message -send message -\end{verbatim} - -The modules defines the following user-callable functions and -user-settable variables: - -\begin{funcdesc}{mimify}{infile, outfile} -Copy the message in \var{infile} to \var{outfile}, converting parts to -quoted-printable and adding MIME mail headers when necessary. -\var{infile} and \var{outfile} can be file objects (actually, any -object that has a \method{readline()} method (for \var{infile}) or a -\method{write()} method (for \var{outfile})) or strings naming the files. -If \var{infile} and \var{outfile} are both strings, they may have the -same value. -\end{funcdesc} - -\begin{funcdesc}{unmimify}{infile, outfile\optional{, decode_base64}} -Copy the message in \var{infile} to \var{outfile}, decoding all -quoted-printable parts. \var{infile} and \var{outfile} can be file -objects (actually, any object that has a \method{readline()} method (for -\var{infile}) or a \method{write()} method (for \var{outfile})) or strings -naming the files. If \var{infile} and \var{outfile} are both strings, -they may have the same value. -If the \var{decode_base64} argument is provided and tests true, any -parts that are coded in the base64 encoding are decoded as well. -\end{funcdesc} - -\begin{funcdesc}{mime_decode_header}{line} -Return a decoded version of the encoded header line in \var{line}. -This only supports the ISO 8859-1 charset (Latin-1). -\end{funcdesc} - -\begin{funcdesc}{mime_encode_header}{line} -Return a MIME-encoded version of the header line in \var{line}. -\end{funcdesc} - -\begin{datadesc}{MAXLEN} -By default, a part will be encoded as quoted-printable when it -contains any non-\ASCII{} characters (characters with the 8th bit -set), or if there are any lines longer than \constant{MAXLEN} characters -(default value 200). -\end{datadesc} - -\begin{datadesc}{CHARSET} -When not specified in the mail headers, a character set must be filled -in. The string used is stored in \constant{CHARSET}, and the default -value is ISO-8859-1 (also known as Latin1 (latin-one)). -\end{datadesc} - -This module can also be used from the command line. Usage is as -follows: -\begin{verbatim} -mimify.py -e [-l length] [infile [outfile]] -mimify.py -d [-b] [infile [outfile]] -\end{verbatim} -to encode (mimify) and decode (unmimify) respectively. \var{infile} -defaults to standard input, \var{outfile} defaults to standard output. -The same file can be specified for input and output. - -If the \strong{-l} option is given when encoding, if there are any lines -longer than the specified \var{length}, the containing part will be -encoded. - -If the \strong{-b} option is given when decoding, any base64 parts will -be decoded as well. - -\begin{seealso} - \seemodule{quopri}{Encode and decode MIME quoted-printable files.} -\end{seealso} diff --git a/Doc/lib/libpickle.tex b/Doc/lib/libpickle.tex index 3290641..0c4cd98 100644 --- a/Doc/lib/libpickle.tex +++ b/Doc/lib/libpickle.tex @@ -799,7 +799,7 @@ class TextReader: del odict['fh'] # remove filehandle entry return odict - def __setstate__(self,dict): + def __setstate__(self, dict): fh = open(dict['file']) # reopen file count = dict['lineno'] # read from file... while count: # until line count is restored @@ -820,7 +820,7 @@ A sample usage might be something like this: ... obj.readline() '7: class TextReader:' >>> import pickle ->>> pickle.dump(obj,open('save.p','w')) +>>> pickle.dump(obj,open('save.p', 'wb')) \end{verbatim} If you want to see that \refmodule{pickle} works across Python @@ -829,7 +829,7 @@ follows can happen from either the same process or a new process. \begin{verbatim} >>> import pickle ->>> reader = pickle.load(open('save.p')) +>>> reader = pickle.load(open('save.p', 'rb')) >>> reader.readline() '8: "Print and number lines in a text file."' \end{verbatim} diff --git a/Doc/lib/libposixfile.tex b/Doc/lib/libposixfile.tex deleted file mode 100644 index 5c86f3e..0000000 --- a/Doc/lib/libposixfile.tex +++ /dev/null @@ -1,174 +0,0 @@ -% Manual text and implementation by Jaap Vermeulen -\section{\module{posixfile} --- - File-like objects with locking support} - -\declaremodule{builtin}{posixfile} - \platform{Unix} -\modulesynopsis{A file-like object with support for locking.} -\moduleauthor{Jaap Vermeulen}{} -\sectionauthor{Jaap Vermeulen}{} - - -\indexii{\POSIX}{file object} - -\deprecated{1.5}{The locking operation that this module provides is -done better and more portably by the -\function{\refmodule{fcntl}.lockf()} call. -\withsubitem{(in module fcntl)}{\ttindex{lockf()}}} - -This module implements some additional functionality over the built-in -file objects. In particular, it implements file locking, control over -the file flags, and an easy interface to duplicate the file object. -The module defines a new file object, the posixfile object. It -has all the standard file object methods and adds the methods -described below. This module only works for certain flavors of -\UNIX, since it uses \function{fcntl.fcntl()} for file locking.% -\withsubitem{(in module fcntl)}{\ttindex{fcntl()}} - -To instantiate a posixfile object, use the \function{open()} function -in the \module{posixfile} module. The resulting object looks and -feels roughly the same as a standard file object. - -The \module{posixfile} module defines the following constants: - - -\begin{datadesc}{SEEK_SET} -Offset is calculated from the start of the file. -\end{datadesc} - -\begin{datadesc}{SEEK_CUR} -Offset is calculated from the current position in the file. -\end{datadesc} - -\begin{datadesc}{SEEK_END} -Offset is calculated from the end of the file. -\end{datadesc} - -The \module{posixfile} module defines the following functions: - - -\begin{funcdesc}{open}{filename\optional{, mode\optional{, bufsize}}} - Create a new posixfile object with the given filename and mode. The - \var{filename}, \var{mode} and \var{bufsize} arguments are - interpreted the same way as by the built-in \function{open()} - function. -\end{funcdesc} - -\begin{funcdesc}{fileopen}{fileobject} - Create a new posixfile object with the given standard file object. - The resulting object has the same filename and mode as the original - file object. -\end{funcdesc} - -The posixfile object defines the following additional methods: - -\begin{methoddesc}[posixfile]{lock}{fmt, \optional{len\optional{, start\optional{, whence}}}} - Lock the specified section of the file that the file object is - referring to. The format is explained - below in a table. The \var{len} argument specifies the length of the - section that should be locked. The default is \code{0}. \var{start} - specifies the starting offset of the section, where the default is - \code{0}. The \var{whence} argument specifies where the offset is - relative to. It accepts one of the constants \constant{SEEK_SET}, - \constant{SEEK_CUR} or \constant{SEEK_END}. The default is - \constant{SEEK_SET}. For more information about the arguments refer - to the \manpage{fcntl}{2} manual page on your system. -\end{methoddesc} - -\begin{methoddesc}[posixfile]{flags}{\optional{flags}} - Set the specified flags for the file that the file object is referring - to. The new flags are ORed with the old flags, unless specified - otherwise. The format is explained below in a table. Without - the \var{flags} argument - a string indicating the current flags is returned (this is - the same as the \samp{?} modifier). For more information about the - flags refer to the \manpage{fcntl}{2} manual page on your system. -\end{methoddesc} - -\begin{methoddesc}[posixfile]{dup}{} - Duplicate the file object and the underlying file pointer and file - descriptor. The resulting object behaves as if it were newly - opened. -\end{methoddesc} - -\begin{methoddesc}[posixfile]{dup2}{fd} - Duplicate the file object and the underlying file pointer and file - descriptor. The new object will have the given file descriptor. - Otherwise the resulting object behaves as if it were newly opened. -\end{methoddesc} - -\begin{methoddesc}[posixfile]{file}{} - Return the standard file object that the posixfile object is based - on. This is sometimes necessary for functions that insist on a - standard file object. -\end{methoddesc} - -All methods raise \exception{IOError} when the request fails. - -Format characters for the \method{lock()} method have the following -meaning: - -\begin{tableii}{c|l}{samp}{Format}{Meaning} - \lineii{u}{unlock the specified region} - \lineii{r}{request a read lock for the specified section} - \lineii{w}{request a write lock for the specified section} -\end{tableii} - -In addition the following modifiers can be added to the format: - -\begin{tableiii}{c|l|c}{samp}{Modifier}{Meaning}{Notes} - \lineiii{|}{wait until the lock has been granted}{} - \lineiii{?}{return the first lock conflicting with the requested lock, or - \code{None} if there is no conflict.}{(1)} -\end{tableiii} - -\noindent -Note: - -\begin{description} -\item[(1)] The lock returned is in the format \code{(\var{mode}, \var{len}, -\var{start}, \var{whence}, \var{pid})} where \var{mode} is a character -representing the type of lock ('r' or 'w'). This modifier prevents a -request from being granted; it is for query purposes only. -\end{description} - -Format characters for the \method{flags()} method have the following -meanings: - -\begin{tableii}{c|l}{samp}{Format}{Meaning} - \lineii{a}{append only flag} - \lineii{c}{close on exec flag} - \lineii{n}{no delay flag (also called non-blocking flag)} - \lineii{s}{synchronization flag} -\end{tableii} - -In addition the following modifiers can be added to the format: - -\begin{tableiii}{c|l|c}{samp}{Modifier}{Meaning}{Notes} - \lineiii{!}{turn the specified flags 'off', instead of the default 'on'}{(1)} - \lineiii{=}{replace the flags, instead of the default 'OR' operation}{(1)} - \lineiii{?}{return a string in which the characters represent the flags that - are set.}{(2)} -\end{tableiii} - -\noindent -Notes: - -\begin{description} -\item[(1)] The \samp{!} and \samp{=} modifiers are mutually exclusive. - -\item[(2)] This string represents the flags after they may have been altered -by the same call. -\end{description} - -Examples: - -\begin{verbatim} -import posixfile - -file = posixfile.open('/tmp/test', 'w') -file.lock('w|') -... -file.lock('u') -file.close() -\end{verbatim} diff --git a/Doc/lib/libshlex.tex b/Doc/lib/libshlex.tex index 451615f..23babd3 100644 --- a/Doc/lib/libshlex.tex +++ b/Doc/lib/libshlex.tex @@ -19,13 +19,15 @@ files for Python applications) or for parsing quoted strings. The \module{shlex} module defines the following functions: -\begin{funcdesc}{split}{s\optional{, comments}} +\begin{funcdesc}{split}{s\optional{, comments\optional{, posix}}} Split the string \var{s} using shell-like syntax. If \var{comments} is \constant{False} (the default), the parsing of comments in the given string will be disabled (setting the \member{commenters} member of the \class{shlex} instance to the empty string). This function operates -in \POSIX{} mode. +in \POSIX{} mode by default, but uses non-\POSIX{} mode if the +\var{posix} argument is false. \versionadded{2.3} +\versionchanged[Added the \var{posix} parameter]{2.6} \end{funcdesc} The \module{shlex} module defines the following class: diff --git a/Doc/lib/libsubprocess.tex b/Doc/lib/libsubprocess.tex index 35ab4d0..dc386bf 100644 --- a/Doc/lib/libsubprocess.tex +++ b/Doc/lib/libsubprocess.tex @@ -87,7 +87,10 @@ called in the child process just before the child is executed. If \var{close_fds} is true, all file descriptors except \constant{0}, \constant{1} and \constant{2} will be closed before the child process is -executed. (\UNIX{} only) +executed. (\UNIX{} only). Or, on Windows, if \var{close_fds} is true +then no handles will be inherited by the child process. Note that on +Windows, you cannot set \var{close_fds} to true and also redirect the +standard handles by setting \var{stdin}, \var{stdout} or \var{stderr}. If \var{shell} is \constant{True}, the specified command will be executed through the shell. diff --git a/Doc/lib/libsys.tex b/Doc/lib/libsys.tex index 1284668..4ab3247 100644 --- a/Doc/lib/libsys.tex +++ b/Doc/lib/libsys.tex @@ -132,11 +132,6 @@ It is always available. encapsulates the call stack at the point where the exception originally occurred. \obindex{traceback} - If \function{exc_clear()} is called, this function will return three - \code{None} values until either another exception is raised in the - current thread or the execution stack returns to a frame where - another exception is being handled. - \warning{Assigning the \var{traceback} return value to a local variable in a function that is handling an exception will cause a circular reference. This will prevent anything referenced @@ -153,32 +148,6 @@ It is always available. efficient to avoid creating cycles.} \end{funcdesc} -\begin{funcdesc}{exc_clear}{} - This function clears all information relating to the current or last - exception that occurred in the current thread. After calling this - function, \function{exc_info()} will return three \code{None} values until - another exception is raised in the current thread or the execution stack - returns to a frame where another exception is being handled. - - This function is only needed in only a few obscure situations. These - include logging and error handling systems that report information on the - last or current exception. This function can also be used to try to free - resources and trigger object finalization, though no guarantee is made as - to what objects will be freed, if any. -\versionadded{2.3} -\end{funcdesc} - -\begin{datadesc}{exc_type} -\dataline{exc_value} -\dataline{exc_traceback} -\deprecated {1.5} - {Use \function{exc_info()} instead.} - Since they are global variables, they are not specific to the - current thread, so their use is not safe in a multi-threaded - program. When no exception is being handled, \code{exc_type} is set - to \code{None} and the other two are undefined. -\end{datadesc} - \begin{datadesc}{exec_prefix} A string giving the site-specific directory prefix where the platform-dependent Python files are installed; by default, this is @@ -377,10 +346,7 @@ else: \begin{datadesc}{modules} This is a dictionary that maps module names to modules which have already been loaded. This can be manipulated to force reloading of - modules and other tricks. Note that removing a module from this - dictionary is \emph{not} the same as calling - \function{reload()}\bifuncindex{reload} on the corresponding module - object. + modules and other tricks. \end{datadesc} \begin{datadesc}{path} diff --git a/Doc/lib/libtarfile.tex b/Doc/lib/libtarfile.tex index 73c35ed..54683a7 100644 --- a/Doc/lib/libtarfile.tex +++ b/Doc/lib/libtarfile.tex @@ -133,24 +133,20 @@ Some facts and figures: \versionadded{2.6} \end{excdesc} +Each of the following constants defines a tar archive format that the +\module{tarfile} module is able to create. See section \ref{tar-formats} for +details. + \begin{datadesc}{USTAR_FORMAT} - \POSIX{}.1-1988 (ustar) format. It supports filenames up to a length of - at best 256 characters and linknames up to 100 characters. The maximum - file size is 8 gigabytes. This is an old and limited but widely - supported format. + \POSIX{}.1-1988 (ustar) format. \end{datadesc} \begin{datadesc}{GNU_FORMAT} - GNU tar format. It supports arbitrarily long filenames and linknames and - files bigger than 8 gigabytes. It is the defacto standard on GNU/Linux - systems. + GNU tar format. \end{datadesc} \begin{datadesc}{PAX_FORMAT} - \POSIX{}.1-2001 (pax) format. It is the most flexible format with - virtually no limits. It supports long filenames and linknames, large files - and stores pathnames in a portable way. However, not all tar - implementations today are able to handle pax archives properly. + \POSIX{}.1-2001 (pax) format. \end{datadesc} \begin{datadesc}{DEFAULT_FORMAT} @@ -175,15 +171,15 @@ Some facts and figures: The \class{TarFile} object provides an interface to a tar archive. A tar archive is a sequence of blocks. An archive member (a stored file) is made up -of a header block followed by data blocks. It is possible, to store a file in a +of a header block followed by data blocks. It is possible to store a file in a tar archive several times. Each archive member is represented by a \class{TarInfo} object, see \citetitle{TarInfo Objects} (section \ref{tarinfo-objects}) for details. \begin{classdesc}{TarFile}{name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, - ignore_zeros=False, encoding=None, pax_headers=None, debug=0, - errorlevel=0} + ignore_zeros=False, encoding=None, errors=None, pax_headers=None, + debug=0, errorlevel=0} All following arguments are optional and can be accessed as instance attributes as well. @@ -231,18 +227,14 @@ tar archive several times. Each archive member is represented by a If \code{2}, all \emph{non-fatal} errors are raised as \exception{TarError} exceptions as well. - The \var{encoding} argument defines the local character encoding. It - defaults to the value from \function{sys.getfilesystemencoding()} or if - that is \code{None} to \code{"ascii"}. \var{encoding} is used only in - connection with the pax format which stores text data in \emph{UTF-8}. If - it is not set correctly, character conversion will fail with a - \exception{UnicodeError}. + The \var{encoding} and \var{errors} arguments control the way strings are + converted to unicode objects and vice versa. The default settings will work + for most users. See section \ref{tar-unicode} for in-depth information. \versionadded{2.6} - The \var{pax_headers} argument must be a dictionary whose elements are - either unicode objects, numbers or strings that can be decoded to unicode - using \var{encoding}. This information will be added to the archive as a - pax global header. + The \var{pax_headers} argument is an optional dictionary of unicode strings + which will be added as a pax global header if \var{format} is + \constant{PAX_FORMAT}. \versionadded{2.6} \end{classdesc} @@ -287,7 +279,7 @@ tar archive several times. Each archive member is represented by a Extract all members from the archive to the current working directory or directory \var{path}. If optional \var{members} is given, it must be a subset of the list returned by \method{getmembers()}. - Directory informations like owner, modification time and permissions are + Directory information like owner, modification time and permissions are set after all members have been extracted. This is done to work around two problems: A directory's modification time is reset each time a file is created in it. And, if a directory's permissions do not allow writing, @@ -365,6 +357,11 @@ tar archive several times. Each archive member is represented by a \deprecated{2.6}{Use the \member{format} attribute instead.} \end{memberdesc} +\begin{memberdesc}{pax_headers} + A dictionary containing key-value pairs of pax global headers. + \versionadded{2.6} +\end{memberdesc} + %----------------- % TarInfo Objects %----------------- @@ -384,8 +381,8 @@ the file's data itself. Create a \class{TarInfo} object. \end{classdesc} -\begin{methoddesc}{frombuf}{} - Create and return a \class{TarInfo} object from a string buffer. +\begin{methoddesc}{frombuf}{buf} + Create and return a \class{TarInfo} object from string buffer \var{buf}. \versionadded[Raises \exception{HeaderError} if the buffer is invalid.]{2.6} \end{methoddesc} @@ -396,10 +393,11 @@ the file's data itself. \versionadded{2.6} \end{methoddesc} -\begin{methoddesc}{tobuf}{\optional{format}} - Create a string buffer from a \class{TarInfo} object. See - \class{TarFile}'s \member{format} argument for information. - \versionchanged[The \var{format} parameter]{2.6} +\begin{methoddesc}{tobuf}{\optional{format\optional{, encoding + \optional{, errors}}}} + Create a string buffer from a \class{TarInfo} object. For information + on the arguments see the constructor of the \class{TarFile} class. + \versionchanged[The arguments were added]{2.6} \end{methoddesc} A \code{TarInfo} object has the following public data attributes: @@ -452,6 +450,12 @@ A \code{TarInfo} object has the following public data attributes: Group name. \end{memberdesc} +\begin{memberdesc}{pax_headers} + A dictionary containing key-value pairs of an associated pax + extended header. + \versionadded{2.6} +\end{memberdesc} + A \class{TarInfo} object also provides some convenient query methods: \begin{methoddesc}{isfile}{} @@ -554,3 +558,103 @@ for tarinfo in tar: tar.extract(tarinfo) tar.close() \end{verbatim} + +%------------ +% Tar format +%------------ + +\subsection{Supported tar formats \label{tar-formats}} + +There are three tar formats that can be created with the \module{tarfile} +module: + +\begin{itemize} + +\item +The \POSIX{}.1-1988 ustar format (\constant{USTAR_FORMAT}). It supports +filenames up to a length of at best 256 characters and linknames up to 100 +characters. The maximum file size is 8 gigabytes. This is an old and limited +but widely supported format. + +\item +The GNU tar format (\constant{GNU_FORMAT}). It supports long filenames and +linknames, files bigger than 8 gigabytes and sparse files. It is the de facto +standard on GNU/Linux systems. \module{tarfile} fully supports the GNU tar +extensions for long names, sparse file support is read-only. + +\item +The \POSIX{}.1-2001 pax format (\constant{PAX_FORMAT}). It is the most +flexible format with virtually no limits. It supports long filenames and +linknames, large files and stores pathnames in a portable way. However, not +all tar implementations today are able to handle pax archives properly. + +The \emph{pax} format is an extension to the existing \emph{ustar} format. It +uses extra headers for information that cannot be stored otherwise. There are +two flavours of pax headers: Extended headers only affect the subsequent file +header, global headers are valid for the complete archive and affect all +following files. All the data in a pax header is encoded in \emph{UTF-8} for +portability reasons. + +\end{itemize} + +There are some more variants of the tar format which can be read, but not +created: + +\begin{itemize} + +\item +The ancient V7 format. This is the first tar format from \UNIX{} Seventh +Edition, storing only regular files and directories. Names must not be longer +than 100 characters, there is no user/group name information. Some archives +have miscalculated header checksums in case of fields with non-\ASCII{} +characters. + +\item +The SunOS tar extended format. This format is a variant of the \POSIX{}.1-2001 +pax format, but is not compatible. + +\end{itemize} + +%---------------- +% Unicode issues +%---------------- + +\subsection{Unicode issues \label{tar-unicode}} + +The tar format was originally conceived to make backups on tape drives with the +main focus on preserving file system information. Nowadays tar archives are +commonly used for file distribution and exchanging archives over networks. One +problem of the original format (that all other formats are merely variants of) +is that there is no concept of supporting different character encodings. +For example, an ordinary tar archive created on a \emph{UTF-8} system cannot be +read correctly on a \emph{Latin-1} system if it contains non-\ASCII{} +characters. Names (i.e. filenames, linknames, user/group names) containing +these characters will appear damaged. Unfortunately, there is no way to +autodetect the encoding of an archive. + +The pax format was designed to solve this problem. It stores non-\ASCII{} names +using the universal character encoding \emph{UTF-8}. When a pax archive is +read, these \emph{UTF-8} names are converted to the encoding of the local +file system. + +The details of unicode conversion are controlled by the \var{encoding} and +\var{errors} keyword arguments of the \class{TarFile} class. + +The default value for \var{encoding} is the local character encoding. It is +deduced from \function{sys.getfilesystemencoding()} and +\function{sys.getdefaultencoding()}. In read mode, \var{encoding} is used +exclusively to convert unicode names from a pax archive to strings in the local +character encoding. In write mode, the use of \var{encoding} depends on the +chosen archive format. In case of \constant{PAX_FORMAT}, input names that +contain non-\ASCII{} characters need to be decoded before being stored as +\emph{UTF-8} strings. The other formats do not make use of \var{encoding} +unless unicode objects are used as input names. These are converted to +8-bit character strings before they are added to the archive. + +The \var{errors} argument defines how characters are treated that cannot be +converted to or from \var{encoding}. Possible values are listed in section +\ref{codec-base-classes}. In read mode, there is an additional scheme +\code{'utf-8'} which means that bad characters are replaced by their +\emph{UTF-8} representation. This is the default scheme. In write mode the +default value for \var{errors} is \code{'strict'} to ensure that name +information is not altered unnoticed. diff --git a/Doc/lib/libtypes.tex b/Doc/lib/libtypes.tex index 4554305..2b143b9 100644 --- a/Doc/lib/libtypes.tex +++ b/Doc/lib/libtypes.tex @@ -163,7 +163,7 @@ The type of \code{Ellipsis}. \begin{datadesc}{TracebackType} The type of traceback objects such as found in -\code{sys.exc_traceback}. +\code{sys.exc_info()[2]}. \end{datadesc} \begin{datadesc}{FrameType} diff --git a/Doc/lib/libundoc.tex b/Doc/lib/libundoc.tex index 041e3dd..146ba7f 100644 --- a/Doc/lib/libundoc.tex +++ b/Doc/lib/libundoc.tex @@ -88,7 +88,6 @@ installing the shared object if using dynamically-loaded extensions. % XXX need Windows instructions! \begin{description} -\item[\module{timing}] ---- Measure time intervals to high resolution (use \function{time.clock()} - instead). +\item +--- This section should be empty for Python 3.0. \end{description} diff --git a/Doc/lib/libzipimport.tex b/Doc/lib/libzipimport.tex index 098e788..8ebe3c5 100644 --- a/Doc/lib/libzipimport.tex +++ b/Doc/lib/libzipimport.tex @@ -29,11 +29,6 @@ by adding the corresponding \file{.pyc} or \file{.pyo} file, meaning that if a ZIP archive doesn't contain \file{.pyc} files, importing may be rather slow. -Using the built-in \function{reload()} function will -fail if called on a module loaded from a ZIP archive; it is unlikely that -\function{reload()} would be needed, since this would imply that the ZIP -has been altered during runtime. - The available attributes of this module are: \begin{excdesc}{ZipImportError} diff --git a/Doc/mac/undoc.tex b/Doc/mac/undoc.tex index 96e4900..adbf589 100644 --- a/Doc/mac/undoc.tex +++ b/Doc/mac/undoc.tex @@ -23,18 +23,6 @@ touch with \deprecated{2.4}{} -\section{\module{cfmfile} --- Code Fragment Resource module} -\declaremodule{standard}{cfmfile} - \platform{Mac} -\modulesynopsis{Code Fragment Resource module.} - -\module{cfmfile} is a module that understands Code Fragments and the -accompanying ``cfrg'' resources. It can parse them and merge them, and is -used by BuildApplication to combine all plugin modules to a single -executable. - -\deprecated{2.4}{} - \section{\module{icopen} --- Internet Config replacement for \method{open()}} \declaremodule{standard}{icopen} \platform{Mac} diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index d8cf888..66aa273 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -977,10 +977,8 @@ level a traceback object is inserted in front of the current traceback. When an exception handler is entered, the stack trace is made available to the program. (See section~\ref{try}, ``The \code{try} statement.'') -It is accessible as \code{sys.exc_traceback}, and also as the third -item of the tuple returned by \code{sys.exc_info()}. The latter is -the preferred interface, since it works correctly when the program is -using multiple threads. +It is accessible as the third +item of the tuple returned by \code{sys.exc_info()}. When the program contains no suitable handler, the stack trace is written (nicely formatted) to the standard error stream; if the interpreter is interactive, it is also made available to the user as @@ -994,7 +992,6 @@ interactive, it is also made available to the user as \ttindex{exc_traceback} \ttindex{last_traceback}} \ttindex{sys.exc_info} -\ttindex{sys.exc_traceback} \ttindex{sys.last_traceback} Special read-only attributes: \member{tb_next} is the next level in the @@ -1198,13 +1195,13 @@ reference count of an object from going to zero include: circular references between objects (e.g., a doubly-linked list or a tree data structure with parent and child pointers); a reference to the object on the stack frame of a function that caught an exception (the -traceback stored in \code{sys.exc_traceback} keeps the stack frame +traceback stored in \code{sys.exc_info()[2]} keeps the stack frame alive); or a reference to the object on the stack frame that raised an unhandled exception in interactive mode (the traceback stored in \code{sys.last_traceback} keeps the stack frame alive). The first situation can only be remedied by explicitly breaking the cycles; the latter two situations can be resolved by storing \code{None} in -\code{sys.exc_traceback} or \code{sys.last_traceback}. Circular +\code{sys.last_traceback}. Circular references which are garbage are detected when the option cycle detector is enabled (it's on by default), but can only be cleaned up if there are no Python-level \method{__del__()} methods involved. diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex index 018f4ba..4ed1b83 100644 --- a/Doc/tut/tut.tex +++ b/Doc/tut/tut.tex @@ -2653,7 +2653,7 @@ a module defines. It returns a sorted list of strings: ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', '__stdin__', '__stdout__', '_getframe', 'api_version', 'argv', 'builtin_module_names', 'byteorder', 'callstats', 'copyright', - 'displayhook', 'exc_clear', 'exc_info', 'exc_type', 'excepthook', + 'displayhook', 'exc_info', 'excepthook', 'exec_prefix', 'executable', 'exit', 'getdefaultencoding', 'getdlopenflags', 'getrecursionlimit', 'getrefcount', 'hexversion', 'maxint', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', @@ -2703,7 +2703,7 @@ standard module \module{__builtin__}\refbimodindex{__builtin__}: 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', 'range', - 'reload', 'repr', 'reversed', 'round', 'set', + 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'vars', 'zip'] \end{verbatim} diff --git a/Doc/whatsnew/whatsnew30.tex b/Doc/whatsnew/whatsnew30.tex new file mode 100644 index 0000000..f52ca37 --- /dev/null +++ b/Doc/whatsnew/whatsnew30.tex @@ -0,0 +1,178 @@ +\documentclass{howto} +\usepackage{distutils} +% $Id: whatsnew26.tex 55506 2007-05-22 07:43:29Z neal.norwitz $ + +% Rules for maintenance: +% +% * Anyone can add text to this document. Do not spend very much time +% on the wording of your changes, because your text will probably +% get rewritten to some degree. +% +% * The maintainer will go through Misc/NEWS periodically and add +% changes; it's therefore more important to add your changes to +% Misc/NEWS than to this file. +% +% * This is not a complete list of every single change; completeness +% is the purpose of Misc/NEWS. Some changes I consider too small +% or esoteric to include. If such a change is added to the text, +% I'll just remove it. (This is another reason you shouldn't spend +% too much time on writing your addition.) +% +% * If you want to draw your new text to the attention of the +% maintainer, add 'XXX' to the beginning of the paragraph or +% section. +% +% * It's OK to just add a fragmentary note about a change. For +% example: "XXX Describe the transmogrify() function added to the +% socket module." The maintainer will research the change and +% write the necessary text. +% +% * You can comment out your additions if you like, but it's not +% necessary (especially when a final release is some months away). +% +% * Credit the author of a patch or bugfix. Just the name is +% sufficient; the e-mail address isn't necessary. +% +% * It's helpful to add the bug/patch number as a comment: +% +% % Patch 12345 +% XXX Describe the transmogrify() function added to the socket +% module. +% (Contributed by P.Y. Developer.) +% +% This saves the maintainer the effort of going through the SVN log +% when researching a change. + +\title{What's New in Python 3.0} +\release{0.0} +\author{A.M. Kuchling} +\authoraddress{\email{amk@amk.ca}} + +\begin{document} +\maketitle +\tableofcontents + +This article explains the new features in Python 3.0. No release date +for Python 3.0 has been set; it will probably be released in mid 2008. + +% Compare with previous release in 2 - 3 sentences here. + +This article doesn't attempt to provide a complete specification of +the new features, but instead provides a convenient overview. For +full details, you should refer to the documentation for Python 3.0. +% add hyperlink when the documentation becomes available online. +If you want to understand the complete implementation and design +rationale, refer to the PEP for a particular new feature. + + +%====================================================================== + +% Large, PEP-level features and changes should be described here. + +% Should there be a new section here for 3k migration? +% Or perhaps a more general section describing module changes/deprecation? +% sets module deprecated + +%====================================================================== +\section{Other Language Changes} + +Here are all of the changes that Python 2.6 makes to the core Python +language. + +\begin{itemize} + +\item Detailed changes are listed here. + +\end{itemize} + + +%====================================================================== +\subsection{Optimizations} + +\begin{itemize} + +\item Detailed changes are listed here. + +\end{itemize} + +The net result of the 3.0 optimizations is that Python 3.0 runs the +pystone benchmark around XX\% slower than Python 2.6. + + +%====================================================================== +\section{New, Improved, and Deprecated Modules} + +As usual, Python's standard library received a number of enhancements and +bug fixes. Here's a partial list of the most notable changes, sorted +alphabetically by module name. Consult the +\file{Misc/NEWS} file in the source tree for a more +complete list of changes, or look through the CVS logs for all the +details. + +\begin{itemize} + +\item Detailed changes are listed here. + +\end{itemize} + + +%====================================================================== +% whole new modules get described in \subsections here + + +% ====================================================================== +\section{Build and C API Changes} + +Changes to Python's build process and to the C API include: + +\begin{itemize} + +\item Detailed changes are listed here. + +\end{itemize} + + +%====================================================================== +\subsection{Port-Specific Changes} + +Platform-specific changes go here. + + +%====================================================================== +\section{Other Changes and Fixes \label{section-other}} + +As usual, there were a bunch of other improvements and bugfixes +scattered throughout the source tree. A search through the change +logs finds there were XXX patches applied and YYY bugs fixed between +Python 2.6 and 3.0. Both figures are likely to be underestimates. + +Some of the more notable changes are: + +\begin{itemize} + +\item Details go here. + +\end{itemize} + + +%====================================================================== +\section{Porting to Python 3.0} + +This section lists previously described changes that may require +changes to your code: + +\begin{itemize} + +\item Everything is all in the details! + +\end{itemize} + + +%====================================================================== +\section{Acknowledgements \label{acks}} + +The author would like to thank the following people for offering +suggestions, corrections and assistance with various drafts of this +article: . + +\end{document} |