Skip to content

Commit

Permalink
enable is_dill to handle ForkingPickler and derived classes
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.mystic.cacr.caltech.edu/pathos/dill@1109 8bfda07e-5b16-0410-ab1d-fd04ec2748df
  • Loading branch information
mmckerns committed Jan 6, 2019
1 parent 9fe100b commit 3b043d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dill/_dill.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def _trace(boolean):
PY3 = (sys.hexversion >= 0x30000f0)
# OLDER: 3.0 <= x < 3.4 *OR* x < 2.7.10 #NOTE: guessing relevant versions
OLDER = (PY3 and sys.hexversion < 0x30400f0) or (sys.hexversion < 0x2070af0)
PY34 = (0x30400f0 <= sys.hexversion < 0x30500f0)
if PY3: #XXX: get types from .objtypes ?
import builtins as __builtin__
from pickle import _Pickler as StockPickler, Unpickler as StockUnpickler
Expand Down Expand Up @@ -1458,10 +1459,11 @@ def check(obj, *args, **kwds):
return

# use to protect against missing attributes
def is_dill(pickler):
def is_dill(pickler, child=None):
"check the dill-ness of your pickler"
return 'dill' in pickler.__module__
#return hasattr(pickler,'_main')
if (child is False) or PY34 or (not hasattr(pickler.__class__, 'mro')):
return 'dill' in pickler.__module__
return Pickler in pickler.__class__.mro()

def _extend():
"""extend pickle with all of dill's registered types"""
Expand Down

0 comments on commit 3b043d6

Please sign in to comment.