Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load any enums #697

Closed
gepz opened this issue Jan 13, 2025 · 6 comments
Closed

Cannot load any enums #697

gepz opened this issue Jan 13, 2025 · 6 comments
Milestone

Comments

@gepz
Copy link

gepz commented Jan 13, 2025

python=3.12.8
dill = ">=0.3.9,<0.4"
Example:

class Color(Enum):
    RED = 1
    GREEN = 2
    BLUE = 3
PATH = "test.pkl"
with open(PATH, "wb") as f:
    pickle.dump(Color.RED, f)
with open(PATH, "rb") as f:
    test = pickle.load(f)

Error in lib/python3.12/enum.py:544:

AttributeError: 'dict' object has no attribute '_member_names'
@gepz
Copy link
Author

gepz commented Jan 13, 2025

Oh god no 🤖💀 (previously reply to the LLM bot that is now gone)

@mmckerns
Copy link
Member

I can reproduce this for all current versions of python 3.8-3.13 on the existing master branch of dill.

from enum import Enum
import dill as pickle

class Color(Enum):
    RED = 1 
    GREEN = 2
    BLUE = 3

red = pickle.copy(Color.RED)

Have you tested older versions of dill?

@gepz
Copy link
Author

gepz commented Jan 13, 2025

python 3.10 with dill 0.3.5:
AttributeError: 'dict' object has no attribute '_member_names'
python 3.10 with dill 0.3.2:
RecursionError: maximum recursion depth exceeded while calling a Python object

@mmckerns
Copy link
Member

I noticed more recent versions of dill throw a Warning about Recursion... which would indicate that this has never been implemented before in dill. I'd have to verify that (generally, you can look here):

@akiss-ic
Copy link

This has been an issue for a while, see #250

@mmckerns mmckerns added this to the dill-0.4.0 milestone Jan 15, 2025
@mmckerns
Copy link
Member

closing as duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@mmckerns @gepz @akiss-ic and others