Skip to content

Commit

Permalink
fix pickling of CLibraryLoaderType
Browse files Browse the repository at this point in the history
  • Loading branch information
mmckerns committed Aug 13, 2022
1 parent bf0f4fa commit 43fd2ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions dill/_dill.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def ndarraysubclassinstance(obj):
elif cls is TypeType: return False
elif 'numpy.ndarray' not in str(getattr(cls, 'mro', int.mro)()):
return False
except OSError: return False # ctypes.LibraryLoader
except ReferenceError: return False # handle 'R3' weakref in 3.x
except TypeError: return False
# anything below here is a numpy array (or subclass) instance
Expand All @@ -118,6 +119,7 @@ def numpyufunc(obj):
elif cls is TypeType: return False
if 'numpy.ufunc' not in str(getattr(cls, 'mro', int.mro)()):
return False
except OSError: return False # ctypes.LibraryLoader
except ReferenceError: return False # handle 'R3' weakref in 3.x
except TypeError: return False
# anything below here is a numpy ufunc
Expand All @@ -131,6 +133,7 @@ def numpydtype(obj):
elif cls is TypeType: return False
if 'numpy.dtype' not in str(getattr(obj, 'mro', int.mro)()):
return False
except OSError: return False # ctypes.LibraryLoader
except ReferenceError: return False # handle 'R3' weakref in 3.x
except TypeError: return False
# anything below here is a numpy dtype
Expand Down
4 changes: 1 addition & 3 deletions dill/_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,8 @@ class _Struct(ctypes.Structure):
z['CFloatType'] = ctypes.c_float()
z['CDoubleType'] = ctypes.c_double()
z['CSizeTType'] = ctypes.c_size_t()
z = (sys.platform[:3] == 'win' or sys.platform[:6] == 'darwin') # non-'nux
z = a if (sys.hexversion >= 0x30b00b3 and not z) else x
z['CLibraryLoaderType'] = ctypes.cdll
del z
a['CLibraryLoaderType'] = ctypes.cdll
a['StructureType'] = _Struct
# if not IS_PYPY:
# a['BigEndianStructureType'] = ctypes.BigEndianStructure()
Expand Down

0 comments on commit 43fd2ca

Please sign in to comment.