From 6a0a36847962c080652e16c15f8261c0c02411a7 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 12 May 2008 10:05:39 +0000 Subject: Fix-up docs for the copyreg module renaming. --- Doc/library/copy.rst | 2 +- Doc/library/copy_reg.rst | 44 ----------------------------------------- Doc/library/copyreg.rst | 48 +++++++++++++++++++++++++++++++++++++++++++++ Doc/library/persistence.rst | 2 +- Doc/library/pickle.rst | 4 ++-- 5 files changed, 52 insertions(+), 48 deletions(-) delete mode 100644 Doc/library/copy_reg.rst create mode 100644 Doc/library/copyreg.rst diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst index 89b668d..ce127a3 100644 --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -63,7 +63,7 @@ of lists by assigning a slice of the entire list, for example, Classes can use the same interfaces to control copying that they use to control pickling. See the description of module :mod:`pickle` for information on these -methods. The :mod:`copy` module does not use the :mod:`copy_reg` registration +methods. The :mod:`copy` module does not use the :mod:`copyreg` registration module. .. index:: diff --git a/Doc/library/copy_reg.rst b/Doc/library/copy_reg.rst deleted file mode 100644 index 407044c..0000000 --- a/Doc/library/copy_reg.rst +++ /dev/null @@ -1,44 +0,0 @@ - -:mod:`copy_reg` --- Register :mod:`pickle` support functions -============================================================ - -.. module:: copy_reg - :synopsis: Register pickle support functions. - -.. note:: - The :mod:`copy_reg` module has been renamed to `copyreg` in Python 3.0. - -.. index:: - module: pickle - module: cPickle - module: copy - -The :mod:`copy_reg` module provides support for the :mod:`pickle` and -:mod:`cPickle` modules. The :mod:`copy` module is likely to use this in the -future as well. It provides configuration information about object constructors -which are not classes. Such constructors may be factory functions or class -instances. - - -.. function:: constructor(object) - - Declares *object* to be a valid constructor. If *object* is not callable (and - hence not valid as a constructor), raises :exc:`TypeError`. - - -.. function:: pickle(type, function[, constructor]) - - Declares that *function* should be used as a "reduction" function for objects of - type *type*; *type* must not be a "classic" class object. (Classic classes are - handled differently; see the documentation for the :mod:`pickle` module for - details.) *function* should return either a string or a tuple containing two or - three elements. - - The optional *constructor* parameter, if provided, is a callable object which - can be used to reconstruct the object when called with the tuple of arguments - returned by *function* at pickling time. :exc:`TypeError` will be raised if - *object* is a class or *constructor* is not callable. - - See the :mod:`pickle` module for more details on the interface expected of - *function* and *constructor*. - diff --git a/Doc/library/copyreg.rst b/Doc/library/copyreg.rst new file mode 100644 index 0000000..3a3f815 --- /dev/null +++ b/Doc/library/copyreg.rst @@ -0,0 +1,48 @@ +:mod:`copyreg` --- Register :mod:`pickle` support functions +=========================================================== + +.. module:: copy_reg + :synopsis: Old name for the copyreg module. + +.. module:: copyreg + :synopsis: Register pickle support functions. + +.. note:: + The :mod:`copy_reg` module has been renamed to :mod:`copyreg` in Python 3.0. + It is importable under both names in Python 2.6 and the rest of the 2.x + series. + +.. index:: + module: pickle + module: cPickle + module: copy + +The :mod:`copyreg` module provides support for the :mod:`pickle` and +:mod:`cPickle` modules. The :mod:`copy` module is likely to use this in the +future as well. It provides configuration information about object constructors +which are not classes. Such constructors may be factory functions or class +instances. + + +.. function:: constructor(object) + + Declares *object* to be a valid constructor. If *object* is not callable (and + hence not valid as a constructor), raises :exc:`TypeError`. + + +.. function:: pickle(type, function[, constructor]) + + Declares that *function* should be used as a "reduction" function for objects of + type *type*; *type* must not be a "classic" class object. (Classic classes are + handled differently; see the documentation for the :mod:`pickle` module for + details.) *function* should return either a string or a tuple containing two or + three elements. + + The optional *constructor* parameter, if provided, is a callable object which + can be used to reconstruct the object when called with the tuple of arguments + returned by *function* at pickling time. :exc:`TypeError` will be raised if + *object* is a class or *constructor* is not callable. + + See the :mod:`pickle` module for more details on the interface expected of + *function* and *constructor*. + diff --git a/Doc/library/persistence.rst b/Doc/library/persistence.rst index 78e40f6..3708d17 100644 --- a/Doc/library/persistence.rst +++ b/Doc/library/persistence.rst @@ -19,7 +19,7 @@ The list of modules described in this chapter is: .. toctree:: pickle.rst - copy_reg.rst + copyreg.rst shelve.rst marshal.rst anydbm.rst diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index f197261..eefa4d3 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -535,7 +535,7 @@ not :meth:`__reduce_ex__`, the :meth:`__reduce_ex__` implementation detects this and calls :meth:`__reduce__`. An alternative to implementing a :meth:`__reduce__` method on the object to be -pickled, is to register the callable with the :mod:`copy_reg` module. This +pickled, is to register the callable with the :mod:`copyreg` module. This module provides a way for programs to register "reduction functions" and constructors for user-defined types. Reduction functions have the same semantics and interface as the :meth:`__reduce__` method described above, except @@ -786,7 +786,7 @@ the same process or a new process. :: .. seealso:: - Module :mod:`copy_reg` + Module :mod:`copyreg` Pickle interface constructor registration for extension types. Module :mod:`shelve` -- cgit v0.12