change pickle_method to use python3 special attributes (#777)

This commit is contained in:
John Win
2016-07-26 08:06:24 -07:00
committed by Dana Powers
parent 0776e5a97d
commit 0d161f72dd

View File

@@ -9,9 +9,15 @@ import types
def _pickle_method(method):
func_name = method.im_func.__name__
obj = method.im_self
cls = method.im_class
try:
func_name = method.__func__.__name__
obj = method.__self__
cls = method.__self__.__class__
except AttributeError:
func_name = method.im_func.__name__
obj = method.im_self
cls = method.im_class
return _unpickle_method, (func_name, obj, cls)