diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Makefile.deps | 1 | ||||
-rw-r--r-- | Doc/lib/lib.tex | 4 | ||||
-rw-r--r-- | Doc/lib/libdoctest.tex | 17 | ||||
-rw-r--r-- | Doc/lib/libfunctools.tex (renamed from Doc/lib/libfunctional.tex) | 8 | ||||
-rw-r--r-- | Doc/lib/libpprint.tex | 4 | ||||
-rw-r--r-- | Doc/lib/libsimplexmlrpc.tex | 9 | ||||
-rw-r--r-- | Doc/lib/libtime.tex | 3 | ||||
-rw-r--r-- | Doc/lib/liburllib2.tex | 4 | ||||
-rw-r--r-- | Doc/whatsnew/whatsnew25.tex | 27 |
9 files changed, 59 insertions, 18 deletions
diff --git a/Doc/Makefile.deps b/Doc/Makefile.deps index 11c6de0414..2fc3250ce4 100644 --- a/Doc/Makefile.deps +++ b/Doc/Makefile.deps @@ -262,6 +262,7 @@ LIBFILES= $(MANSTYLES) $(INDEXSTYLES) $(COMMONTEX) \ lib/libsimplexmlrpc.tex \ lib/libdocxmlrpc.tex \ lib/libpyexpat.tex \ + lib/libfunctools.tex \ lib/xmldom.tex \ lib/xmldomminidom.tex \ lib/xmldompulldom.tex \ diff --git a/Doc/lib/lib.tex b/Doc/lib/lib.tex index cf657c3d1b..0691179acb 100644 --- a/Doc/lib/lib.tex +++ b/Doc/lib/lib.tex @@ -129,8 +129,8 @@ and how to embed it in other applications. % Functions, Functional, Generators and Iterators % XXX intro functional \input{libitertools} -\input{libfunctional} -\input{liboperator} % from runtime - better with itertools and functional +\input{libfunctools} +\input{liboperator} % from runtime - better with itertools and functools % ============= diff --git a/Doc/lib/libdoctest.tex b/Doc/lib/libdoctest.tex index 73b29ad71c..f9a97fa619 100644 --- a/Doc/lib/libdoctest.tex +++ b/Doc/lib/libdoctest.tex @@ -868,7 +868,7 @@ sections \ref{doctest-simple-testmod} and globs}\optional{, verbose}\optional{, report}\optional{, optionflags}\optional{, extraglobs}\optional{, raise_on_error}\optional{, - parser}} + parser}\optional{, encoding}} All arguments except \var{filename} are optional, and should be specified in keyword form. @@ -941,7 +941,13 @@ sections \ref{doctest-simple-testmod} and subclass) that should be used to extract tests from the files. It defaults to a normal parser (i.e., \code{\class{DocTestParser}()}). + Optional argument \var{encoding} specifies an encoding that should + be used to convert the file to unicode. + \versionadded{2.4} + + \versionchanged[The parameter \var{encoding} was added]{2.5} + \end{funcdesc} \begin{funcdesc}{testmod}{\optional{m}\optional{, name}\optional{, @@ -1061,7 +1067,8 @@ instances from text files and modules with doctests: \begin{funcdesc}{DocFileSuite}{\optional{module_relative}\optional{, package}\optional{, setUp}\optional{, tearDown}\optional{, globs}\optional{, - optionflags}\optional{, parser}} + optionflags}\optional{, parser}\optional{, + encoding}} Convert doctest tests from one or more text files to a \class{\refmodule{unittest}.TestSuite}. @@ -1128,11 +1135,17 @@ instances from text files and modules with doctests: subclass) that should be used to extract tests from the files. It defaults to a normal parser (i.e., \code{\class{DocTestParser}()}). + Optional argument \var{encoding} specifies an encoding that should + be used to convert the file to unicode. + \versionadded{2.4} \versionchanged[The global \code{__file__} was added to the globals provided to doctests loaded from a text file using \function{DocFileSuite()}]{2.5} + + \versionchanged[The parameter \var{encoding} was added]{2.5} + \end{funcdesc} \begin{funcdesc}{DocTestSuite}{\optional{module}\optional{, diff --git a/Doc/lib/libfunctional.tex b/Doc/lib/libfunctools.tex index 9218454fe3..a25a23a4b8 100644 --- a/Doc/lib/libfunctional.tex +++ b/Doc/lib/libfunctools.tex @@ -1,7 +1,7 @@ -\section{\module{functional} --- +\section{\module{functools} --- Higher order functions and operations on callable objects.} -\declaremodule{standard}{functional} % standard library, in Python +\declaremodule{standard}{functools} % standard library, in Python \moduleauthor{Peter Harris}{scav@blueyonder.co.uk} \moduleauthor{Raymond Hettinger}{python@rcn.com} @@ -11,12 +11,12 @@ \versionadded{2.5} -The \module{functional} module is for higher-order functions: functions +The \module{functools} module is for higher-order functions: functions that act on or return other functions. In general, any callable object can be treated as a function for the purposes of this module. -The \module{functional} module defines the following function: +The \module{functools} module defines the following function: \begin{funcdesc}{partial}{func\optional{,*args}\optional{, **keywords}} Return a new \class{partial} object which when called will behave like diff --git a/Doc/lib/libpprint.tex b/Doc/lib/libpprint.tex index 45d9c873ac..fd030389b3 100644 --- a/Doc/lib/libpprint.tex +++ b/Doc/lib/libpprint.tex @@ -20,6 +20,10 @@ and breaks them onto multiple lines if they don't fit within the allowed width. Construct \class{PrettyPrinter} objects explicitly if you need to adjust the width constraint. +\versionchanged[Dictionaries are sorted by key before the display is +computed; before 2.5, a dictionary was sorted only if its display +required more than one line, although that wasn't documented]{2.5} + The \module{pprint} module defines one class: diff --git a/Doc/lib/libsimplexmlrpc.tex b/Doc/lib/libsimplexmlrpc.tex index a25cabf6d5..7a9786125d 100644 --- a/Doc/lib/libsimplexmlrpc.tex +++ b/Doc/lib/libsimplexmlrpc.tex @@ -111,6 +111,15 @@ simple, stand alone XML-RPC servers. Registers the XML-RPC multicall function system.multicall. \end{methoddesc} +\begin{memberdesc}[SimpleXMLRPCServer]{rpc_paths} +An attribute value that must be a tuple listing valid path portions of +the URL for receiving XML-RPC requests. Requests posted to other +paths will result in a 404 ``no such page'' HTTP error. If this +tuple is empty, all paths will be considered valid. +The default value is \code{('/', '/RPC2')}. + \versionadded{2.5} +\end{memberdesc} + Example: \begin{verbatim} diff --git a/Doc/lib/libtime.tex b/Doc/lib/libtime.tex index 8045a63ef2..b39b65063c 100644 --- a/Doc/lib/libtime.tex +++ b/Doc/lib/libtime.tex @@ -314,7 +314,8 @@ returned by \function{ctime()}. If \var{string} cannot be parsed according to \var{format}, \exception{ValueError} is raised. If the string to be parsed has excess data after parsing, \exception{ValueError} is raised. The default values used to fill in -any missing data are \code{(1900, 1, 1, 0, 0, 0, 0, 1, -1)} . +any missing data when more accurate values cannot be inferred are +\code{(1900, 1, 1, 0, 0, 0, 0, 1, -1)} . Support for the \code{\%Z} directive is based on the values contained in \code{tzname} and whether \code{daylight} is true. Because of this, diff --git a/Doc/lib/liburllib2.tex b/Doc/lib/liburllib2.tex index 7c8ad5dce2..f77ed25353 100644 --- a/Doc/lib/liburllib2.tex +++ b/Doc/lib/liburllib2.tex @@ -65,9 +65,7 @@ exists), \class{HTTPSHandler} will also be added. Beginning in Python 2.3, a \class{BaseHandler} subclass may also change its \member{handler_order} member variable to modify its -position in the handlers list. Besides \class{ProxyHandler}, which has -\member{handler_order} of \code{100}, all handlers currently have it -set to \code{500}. +position in the handlers list. \end{funcdesc} diff --git a/Doc/whatsnew/whatsnew25.tex b/Doc/whatsnew/whatsnew25.tex index 3006624dcb..5bee789c4e 100644 --- a/Doc/whatsnew/whatsnew25.tex +++ b/Doc/whatsnew/whatsnew25.tex @@ -125,7 +125,7 @@ Wouters.} %====================================================================== \section{PEP 309: Partial Function Application\label{pep-309}} -The \module{functional} module is intended to contain tools for +The \module{functools} module is intended to contain tools for functional-style programming. Currently it only contains a \class{partial()} function, but new functions will probably be added in future versions of Python. @@ -136,7 +136,7 @@ parameters filled in. Consider a Python function \code{f(a, b, c)}; you could create a new function \code{g(b, c)} that was equivalent to \code{f(1, b, c)}. This is called ``partial function application'', and is provided by the \class{partial} class in the new -\module{functional} module. +\module{functools} module. The constructor for \class{partial} takes the arguments \code{(\var{function}, \var{arg1}, \var{arg2}, ... @@ -147,18 +147,18 @@ with the filled-in arguments. Here's a small but realistic example: \begin{verbatim} -import functional +import functools def log (message, subsystem): "Write the contents of 'message' to the specified subsystem." print '%s: %s' % (subsystem, message) ... -server_log = functional.partial(log, subsystem='server') +server_log = functools.partial(log, subsystem='server') server_log('Unable to open socket') \end{verbatim} -Here's another example, from a program that uses PyGTk. Here a +Here's another example, from a program that uses PyGTK. Here a context-sensitive pop-up menu is being constructed dynamically. The callback provided for the menu option is a partially applied version of the \method{open_item()} method, where the first argument has been @@ -170,7 +170,7 @@ class Application: def open_item(self, path): ... def init (self): - open_func = functional.partial(self.open_item, item_path) + open_func = functools.partial(self.open_item, item_path) popup_menu.append( ("Open", open_func, 1) ) \end{verbatim} @@ -1508,6 +1508,14 @@ therefore now works on non-{\UNIX} platforms. (Patch from Robert Kiendl.) % Patch #1472854 +\item The \module{SimpleXMLRPCServer} and \module{DocXMLRPCServer} +classes now have a \member{rpc_paths} attribute that constrains +XML-RPC operations to a limited set of URL paths; the default is +to allow only \code{'/'} and \code{'/RPC2'}. Setting +\member{rpc_paths} to \code{None} or an empty tuple disables +this path checking. +% Bug #1473048 + \item The \module{socket} module now supports \constant{AF_NETLINK} sockets on Linux, thanks to a patch from Philippe Biondi. Netlink sockets are a Linux-specific mechanism for communications @@ -2163,6 +2171,13 @@ longer accept a return value of \code{None} from the arguments instead. The modules also no longer accept the deprecated \var{bin} keyword parameter. +\item Library: The \module{SimpleXMLRPCServer} and \module{DocXMLRPCServer} +classes now have a \member{rpc_paths} attribute that constrains +XML-RPC operations to a limited set of URL paths; the default is +to allow only \code{'/'} and \code{'/RPC2'}. Setting +\member{rpc_paths} to \code{None} or an empty tuple disables +this path checking. + \item C API: Many functions now use \ctype{Py_ssize_t} instead of \ctype{int} to allow processing more data on 64-bit machines. Extension code may need to make the same change to avoid |