-
Notifications
You must be signed in to change notification settings - Fork 33
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
Unpickling throws ValueError #18
Comments
The outer >>> for prop in MyEnum:
... MyEnum[prop]
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 327, in __getitem__
return cls._member_map_[name]
KeyError: <MyEnum.MY_CONSTANT: functools.partial(<function...>)> The first argument to the KeyError is the invalid key, which was But that object itself can't be (un)pickled; that's the source of the ValueError (not tblib): >>> import pickle
>>> pickle.loads(pickle.dumps(MyEnum.MY_CONSTANT))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 291, in __call__
return cls.__new__(cls, value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 533, in __new__
return cls._missing_(value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/enum.py", line 546, in _missing_
raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: functools.partial(<function...>) is not a valid MyEnum I don't know the rules for pickling/unpickling |
I think this issue boils down to unpickleable exceptions (the Note that there's no handling in tblib for exception objects (tblib only handles the traceback objects). So I think this problem is outside tblib's intended purpose. Try only doing |
This example code throws a ValueError when unpickling.
Results in:
The text was updated successfully, but these errors were encountered: