---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-b09b8cb46375> in <module>()
4 def f(cls):
5 pass
----> 6 cloudpickle.dumps(A.f)
/home/pierreglaser/.virtualenvs/py27/local/lib/python2.7/site-packages/cloudpickle/cloudpickle.pyc in dumps(obj, protocol)
893 try:
894 cp = CloudPickler(file, protocol=protocol)
--> 895 cp.dump(obj)
896 return file.getvalue()
897 finally:
/home/pierreglaser/.virtualenvs/py27/local/lib/python2.7/site-packages/cloudpickle/cloudpickle.pyc in dump(self, obj)
266 self.inject_addons()
267 try:
--> 268 return Pickler.dump(self, obj)
269 except RuntimeError as e:
270 if 'recursion' in e.args[0]:
/usr/lib/python2.7/pickle.py in dump(self, obj)
222 if self.proto >= 2:
223 self.write(PROTO + chr(self.proto))
--> 224 self.save(obj)
225 self.write(STOP)
226
/usr/lib/python2.7/pickle.py in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/pierreglaser/.virtualenvs/py27/local/lib/python2.7/site-packages/cloudpickle/cloudpickle.pyc in save_instancemethod(self, obj)
667 self.save_reduce(types.MethodType, (obj.__func__, obj.__self__), obj=obj)
668 else:
--> 669 self.save_reduce(types.MethodType, (obj.__func__, obj.__self__, obj.__self__.__class__),
670 obj=obj)
671
AttributeError: class A has no attribute '__class__'
This does not seem to be a regression. The bug is present for any version of cloudpickle.
gives
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-b09b8cb46375> in <module>() 4 def f(cls): 5 pass ----> 6 cloudpickle.dumps(A.f) /home/pierreglaser/.virtualenvs/py27/local/lib/python2.7/site-packages/cloudpickle/cloudpickle.pyc in dumps(obj, protocol) 893 try: 894 cp = CloudPickler(file, protocol=protocol) --> 895 cp.dump(obj) 896 return file.getvalue() 897 finally: /home/pierreglaser/.virtualenvs/py27/local/lib/python2.7/site-packages/cloudpickle/cloudpickle.pyc in dump(self, obj) 266 self.inject_addons() 267 try: --> 268 return Pickler.dump(self, obj) 269 except RuntimeError as e: 270 if 'recursion' in e.args[0]: /usr/lib/python2.7/pickle.py in dump(self, obj) 222 if self.proto >= 2: 223 self.write(PROTO + chr(self.proto)) --> 224 self.save(obj) 225 self.write(STOP) 226 /usr/lib/python2.7/pickle.py in save(self, obj) 284 f = self.dispatch.get(t) 285 if f: --> 286 f(self, obj) # Call unbound method with explicit self 287 return 288 /home/pierreglaser/.virtualenvs/py27/local/lib/python2.7/site-packages/cloudpickle/cloudpickle.pyc in save_instancemethod(self, obj) 667 self.save_reduce(types.MethodType, (obj.__func__, obj.__self__), obj=obj) 668 else: --> 669 self.save_reduce(types.MethodType, (obj.__func__, obj.__self__, obj.__self__.__class__), 670 obj=obj) 671 AttributeError: class A has no attribute '__class__'This does not seem to be a regression. The bug is present for any version of cloudpickle.