@@ -184,6 +184,26 @@ def __private_method(self):
184184 def get_method (self ):
185185 return self .__private_method
186186
187+ @classmethod
188+ def get_unbound_method (cls ):
189+ return cls .__private_method
190+
191+ @classmethod
192+ def __private_classmethod (cls ):
193+ return 43
194+
195+ @classmethod
196+ def get_classmethod (cls ):
197+ return cls .__private_classmethod
198+
199+ @staticmethod
200+ def __private_staticmethod ():
201+ return 44
202+
203+ @classmethod
204+ def get_staticmethod (cls ):
205+ return cls .__private_staticmethod
206+
187207class myint (int ):
188208 def __init__ (self , x ):
189209 self .str = str (x )
@@ -4088,6 +4108,12 @@ def test_private_methods(self):
40884108 with self .subTest (proto = proto ):
40894109 unpickled = self .loads (self .dumps (obj .get_method (), proto ))
40904110 self .assertEqual (unpickled (), 42 )
4111+ unpickled = self .loads (self .dumps (obj .get_unbound_method (), proto ))
4112+ self .assertEqual (unpickled (obj ), 42 )
4113+ unpickled = self .loads (self .dumps (obj .get_classmethod (), proto ))
4114+ self .assertEqual (unpickled (), 43 )
4115+ unpickled = self .loads (self .dumps (obj .get_staticmethod (), proto ))
4116+ self .assertEqual (unpickled (), 44 )
40914117
40924118 def test_compat_pickle (self ):
40934119 tests = [
0 commit comments