Serhiy Storchaka <[email protected]> added the comment:
>>> from abc import *
>>> A = ABCMeta('A', (), {})
>>> A.__module__
'abc'
>>> import pickle, pickletools
>>> pickletools.dis(pickletools.optimize(pickle.dumps(A)))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <class 'abc.A'>: attribute lookup A on abc
failed
>>> A.__module__ = None
>>> pickletools.dis(pickletools.optimize(pickle.dumps(A)))
0: \x80 PROTO 4
2: \x95 FRAME 15
11: \x8c SHORT_BINUNICODE '__main__'
21: \x8c SHORT_BINUNICODE 'A'
24: \x93 STACK_GLOBAL
25: . STOP
highest protocol among opcodes = 4
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue28869>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com