diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2022-05-21 14:54:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-21 14:54:10 (GMT) |
commit | f9d6c59917435980fbe1b58c57257c45bfed2244 (patch) | |
tree | b5e4f7944cdc387639d787a44a193aef0456180f /Doc | |
parent | 4e2b66489289cfd4db2a02edf173ac03cbb2fffe (diff) | |
download | cpython-f9d6c59917435980fbe1b58c57257c45bfed2244.zip cpython-f9d6c59917435980fbe1b58c57257c45bfed2244.tar.gz cpython-f9d6c59917435980fbe1b58c57257c45bfed2244.tar.bz2 |
gh-91362: reword pickle docs to account for nested classes (#92429)
Fixes #91362
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/pickle.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst index fa14b64..41b0f48 100644 --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -502,10 +502,10 @@ The following types can be pickled: * tuples, lists, sets, and dictionaries containing only picklable objects; -* functions (built-in and user-defined) defined at the top level of a module - (using :keyword:`def`, not :keyword:`lambda`); +* functions (built-in and user-defined) accessible from the top level of a + module (using :keyword:`def`, not :keyword:`lambda`); -* classes defined at the top level of a module; +* classes accessible from the top level of a module; * instances of such classes whose the result of calling :meth:`__getstate__` 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 raised in this case. You can carefully raise this limit with :func:`sys.setrecursionlimit`. -Note that functions (built-in and user-defined) are pickled by fully qualified -name, not by value. [#]_ This means that only the function name is -pickled, along with the name of the module the function is defined in. Neither +Note that functions (built-in and user-defined) are pickled by fully +:term:`qualified name`, not by value. [#]_ This means that only the function name is +pickled, along with the name of the containing module and classes. Neither the function's code, nor any of its function attributes are pickled. Thus the defining module must be importable in the unpickling environment, and the module must contain the named object, otherwise an exception will be raised. [#]_ |