Skip to content

Commit 281a3f1

Browse files
authored
gh-56133: copyreg docs: Clarify function/constructor parameter (#95497)
1 parent f187969 commit 281a3f1

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Doc/library/copyreg.rst

+6-9
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,17 @@ Such constructors may be factory functions or class instances.
2525
hence not valid as a constructor), raises :exc:`TypeError`.
2626

2727

28-
.. function:: pickle(type, function, constructor=None)
28+
.. function:: pickle(type, function, constructor_ob=None)
2929

3030
Declares that *function* should be used as a "reduction" function for objects
3131
of type *type*. *function* should return either a string or a tuple
32-
containing two or three elements.
32+
containing two or three elements. See the :attr:`~pickle.Pickler.dispatch_table`
33+
for more details on the interface of *function*.
3334

34-
The optional *constructor* parameter, if provided, is a callable object which
35-
can be used to reconstruct the object when called with the tuple of arguments
36-
returned by *function* at pickling time. A :exc:`TypeError` is raised if the
37-
*constructor* is not callable.
35+
The *constructor_ob* parameter is a legacy feature and is now ignored, but if
36+
passed it must be a callable.
3837

39-
See the :mod:`pickle` module for more details on the interface
40-
expected of *function* and *constructor*. Note that the
41-
:attr:`~pickle.Pickler.dispatch_table` attribute of a pickler
38+
Note that the :attr:`~pickle.Pickler.dispatch_table` attribute of a pickler
4239
object or subclass of :class:`pickle.Pickler` can also be used for
4340
declaring reduction functions.
4441

0 commit comments

Comments
 (0)