BPO | [47206](https://bugs.python.org/issue47206) --- | :--- Nosy | @avassalotti, @JelleZijlstra, @maggyero *Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.* Show more details GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['3.11', 'type-bug', '3.9', '3.10', 'docs'] title = 'pickle docs are wrong about nested classes' updated_at = user = 'https://github.com/JelleZijlstra' ``` bugs.python.org fields: ```python activity = actor = 'maggyero' assignee = 'docs@python' closed = False closed_date = None closer = None components = ['Documentation'] creation = creator = 'JelleZijlstra' dependencies = [] files = [] hgrepos = [] issue_num = 47206 keywords = [] message_count = 1.0 messages = ['416625'] nosy_count = 4.0 nosy_names = ['alexandre.vassalotti', 'docs@python', 'JelleZijlstra', 'maggyero'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue47206' versions = ['Python 3.9', 'Python 3.10', 'Python 3.11'] ```
Activity
JelleZijlstra commentedon Apr 3, 2022
https://docs.python.org/3.10/library/pickle.html#what-can-be-pickled-and-unpickled says that only "classes that are defined at the top level of a module" can be pickled. But in fact these work fine in current Python, probably since 3.3 when __qualname__ was added (https://docs.python.org/3/library/stdtypes.html#definition.\_\_qualname__). Similarly, the docs claim only top-level functions can be pickled, but in fact methods nested in classes work fine.
Example script demonstrating that these work:
pythongh-91362: reword docs to better account for nested classes
pythongh-91362: reword pickle docs to account for nested classes (pyt…
pythongh-91362: reword pickle docs to account for nested classes (pyt…
gh-91362: reword pickle docs to account for nested classes (GH-92429)
gh-91362: reword pickle docs to account for nested classes (GH-92429)
pythongh-91362: reword pickle docs to account for nested classes (pyt…