File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -124,9 +124,13 @@ def call_pickled_function(fpargs):
124
124
def pickleMethod (method ):
125
125
' support function for copyreg to pickle method refs'
126
126
127
- # Note: On Python 3 there is no .im_class but we can get the instance's
128
- # class through .__self__.__class__
129
- cls = getattr (method, ' im_class' , method.__self__.__class__ )
127
+ if isinstance (method.__self__, type ):
128
+ # This is a class method, so get it from the type directly
129
+ return (getattr , (method.__self__, method.__func__.__name__ ))
130
+ else :
131
+ # Note: On Python 3 there is no .im_class but we can get the instance's
132
+ # class through .__self__.__class__
133
+ cls = getattr (method, ' im_class' , method.__self__.__class__ )
130
134
return (unpickleMethod, (method.__func__.__name__ , method.__self__, cls ))
131
135
132
136
You can’t perform that action at this time.
0 commit comments