[New-bugs-announce] [issue38405] Nested subclasses of typing.NamedTuple are not pickleable

Serhiy Storchaka report at bugs.python.org
Tue Oct 8 04:18:02 EDT 2019


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

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

----------
components: Library (Lib)
messages: 354176
nosy: gvanrossum, levkivskyi, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Nested subclasses of typing.NamedTuple are not pickleable
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38405>
_______________________________________


More information about the New-bugs-announce mailing list