This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Nested subclasses of typing.NamedTuple are not pickleable
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, levkivskyi, miss-islington, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2019-10-08 08:18 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16641 merged serhiy.storchaka, 2019-10-08 08:20
PR 16655 merged miss-islington, 2019-10-08 13:53
PR 16674 merged serhiy.storchaka, 2019-10-09 09:06
Messages (4)
msg354176 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-10-08 08:18
Example:

>>> from typing import NamedTuple
>>> import pickle
>>> class A:
...     class B(NamedTuple):
...         x: int
... 
>>> pickle.dumps(A.B)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <class '__main__.B'>: attribute lookup B on __main__ failed
msg354203 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-10-08 13:29
New changeset 13abda41003daf599587991d8291f0dacf6e9519 by Serhiy Storchaka in branch 'master':
bpo-38405: Make nested subclasses of typing.NamedTuple pickleable. (GH-16641)
https://github.com/python/cpython/commit/13abda41003daf599587991d8291f0dacf6e9519
msg354211 - (view) Author: miss-islington (miss-islington) Date: 2019-10-08 14:12
New changeset 10b475a151dc35c8ca4047331d591130973e914d by Miss Islington (bot) in branch '3.8':
bpo-38405: Make nested subclasses of typing.NamedTuple pickleable. (GH-16641)
https://github.com/python/cpython/commit/10b475a151dc35c8ca4047331d591130973e914d
msg354260 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-10-09 09:56
New changeset 87db4d343c9609137f6e62aa3595db610a33842c by Serhiy Storchaka in branch '3.7':
[3.7] bpo-38405: Make nested subclasses of typing.NamedTuple pickleable. (GH-16641). (GH-16674)
https://github.com/python/cpython/commit/87db4d343c9609137f6e62aa3595db610a33842c
History
Date User Action Args
2022-04-11 14:59:21adminsetgithub: 82586
2019-10-09 09:58:47serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-10-09 09:56:52serhiy.storchakasetmessages: + msg354260
2019-10-09 09:06:43serhiy.storchakasetpull_requests: + pull_request16255
2019-10-08 14:12:45miss-islingtonsetnosy: + miss-islington
messages: + msg354211
2019-10-08 13:53:51miss-islingtonsetpull_requests: + pull_request16238
2019-10-08 13:29:57serhiy.storchakasetmessages: + msg354203
2019-10-08 08:20:34serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request16226
2019-10-08 08:18:02serhiy.storchakacreate