change pickle_method to use python3 special attributes (#777)
This commit is contained in:
@@ -9,9 +9,15 @@ import types
|
|||||||
|
|
||||||
|
|
||||||
def _pickle_method(method):
|
def _pickle_method(method):
|
||||||
|
try:
|
||||||
|
func_name = method.__func__.__name__
|
||||||
|
obj = method.__self__
|
||||||
|
cls = method.__self__.__class__
|
||||||
|
except AttributeError:
|
||||||
func_name = method.im_func.__name__
|
func_name = method.im_func.__name__
|
||||||
obj = method.im_self
|
obj = method.im_self
|
||||||
cls = method.im_class
|
cls = method.im_class
|
||||||
|
|
||||||
return _unpickle_method, (func_name, obj, cls)
|
return _unpickle_method, (func_name, obj, cls)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user