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.

Author Tom.Brown
Recipients Tom.Brown
Date 2021-06-08.00:56:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623113813.43.0.510993848809.issue44342@roundup.psfhosted.org>
In-reply-to
Content
The following script runs without error in 3.8.5 and raises an error in 3.8.6, 3.9.5 and 3.10.0b1. 

Source:
```
import enum, pickle

class MyInt(int):
    pass
    # work-around: __reduce_ex__ = int.__reduce_ex__

class MyEnum(MyInt, enum.Enum):
    A = 1

pickle.dumps(MyEnum.A)
```

Error (same in 3.8.6, 3.9.5 and 3.10.0b1):
```
Traceback (most recent call last):
  File "/home/thecap/projects/covid-data-model/./enum-pickle.py", line 12, in <module>
    pickle.dumps(MyEnum.A)
  File "/home/thecap/.pyenv/versions/3.10.0b1/lib/python3.10/enum.py", line 83, in _break_on_call_reduce
    raise TypeError('%r cannot be pickled' % self)
TypeError: MyEnum.A cannot be pickled
```

Like https://bugs.python.org/issue41889 this seems to be related to the fix for https://bugs.python.org/issue39587 which changes member_type from int to MyInt. A work-around is in the comment above.
History
Date User Action Args
2021-06-08 00:56:53Tom.Brownsetrecipients: + Tom.Brown
2021-06-08 00:56:53Tom.Brownsetmessageid: <1623113813.43.0.510993848809.issue44342@roundup.psfhosted.org>
2021-06-08 00:56:53Tom.Brownlinkissue44342 messages
2021-06-08 00:56:52Tom.Browncreate