Skip to content

Commit f9d6c59

Browse files
authored
pythongh-91362: reword pickle docs to account for nested classes (python#92429)
Fixes python#91362
1 parent 4e2b664 commit f9d6c59

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Doc/library/pickle.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,10 @@ The following types can be pickled:
502502

503503
* tuples, lists, sets, and dictionaries containing only picklable objects;
504504

505-
* functions (built-in and user-defined) defined at the top level of a module
506-
(using :keyword:`def`, not :keyword:`lambda`);
505+
* functions (built-in and user-defined) accessible from the top level of a
506+
module (using :keyword:`def`, not :keyword:`lambda`);
507507

508-
* classes defined at the top level of a module;
508+
* classes accessible from the top level of a module;
509509

510510
* instances of such classes whose the result of calling :meth:`__getstate__`
511511
is picklable (see section :ref:`pickle-inst` for details).
@@ -517,9 +517,9 @@ structure may exceed the maximum recursion depth, a :exc:`RecursionError` will b
517517
raised in this case. You can carefully raise this limit with
518518
:func:`sys.setrecursionlimit`.
519519

520-
Note that functions (built-in and user-defined) are pickled by fully qualified
521-
name, not by value. [#]_ This means that only the function name is
522-
pickled, along with the name of the module the function is defined in. Neither
520+
Note that functions (built-in and user-defined) are pickled by fully
521+
:term:`qualified name`, not by value. [#]_ This means that only the function name is
522+
pickled, along with the name of the containing module and classes. Neither
523523
the function's code, nor any of its function attributes are pickled. Thus the
524524
defining module must be importable in the unpickling environment, and the module
525525
must contain the named object, otherwise an exception will be raised. [#]_

0 commit comments

Comments
 (0)