Skip to content

enum.IntFlag now unpickles incorrectly on Python 3.11.4 #105837

Closed as not planned
Closed as not planned
@da-woods

Description

@da-woods

Bug report

Follow up to #105332

Following the changes to fix that issue enum.IntFlag appears to pickle correctly on the latest Python 3.12 commit (dd36656ada05731c069ecd5b1878380294fb1f3e) but fail on Python 3.11.4 (where on 3.11.2 it worked)

Code to reproduce

import enum
import pickle

class PxdEnum(enum.IntFlag):
    RANK_0 = 11
    RANK_1 = 37
    RANK_2 = 389

pickled = pickle.dumps(PxdEnum.RANK_2)

print(pickle.loads(pickled))

error output:

Traceback (most recent call last):
  File "<path>/enumtest.py", line 11, in <module>
    print(pickle.loads(pickled))
          ^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for |: 'PxdEnum' and 'NoneType'

Your environment

64 bit Linux, Python 3.11.4

Metadata

Metadata

Assignees

Labels

3.11only security fixespendingThe issue will be closed if no feedback is providedstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions