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

Fix unpickling errors for Standard Library modules #548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dill/_dill.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
# import zlib
from weakref import ReferenceType, ProxyType, CallableProxyType
from collections import OrderedDict
from enum import EnumMeta
from functools import partial
from operator import itemgetter, attrgetter
GENERATOR_FAIL = False
Expand Down Expand Up @@ -1675,9 +1676,10 @@ def save_type(pickler, obj, postproc_list=None):
else:
obj_name = getattr(obj, '__qualname__', getattr(obj, '__name__', None))
_byref = getattr(pickler, '_byref', None)
is_enum = isinstance(obj, EnumMeta)
obj_recursive = id(obj) in getattr(pickler, '_postproc', ())
incorrectly_named = not _locate_function(obj, pickler)
if not _byref and not obj_recursive and incorrectly_named: # not a function, but the name was held over
incorrectly_named = not _locate_function(obj, pickler) # not a function, but the name was held over
if not _byref and not is_enum and not obj_recursive and incorrectly_named:
# thanks to Tom Stepleton pointing out pickler._session unneeded
logger.trace(pickler, "T2: %s", obj)
_dict = obj.__dict__.copy() # convert dictproxy to dict
Expand Down