This is a case:
class C(object):
def __new__(cls, *, b):
inst = super().__new__(cls)
inst.b = b
return inst
>>> c = C(b=17)
>>> image = pickle.dumps(c, protocol=3)
>>> c = pickle.loads(image)
Traceback (most recent call last):
File "test_new.py", line 17, in <module>
c = pickle.loads(image)
File "D:\Python30\lib\pickle.py", line 1329, in loads
return Unpickler(file, encoding=encoding, errors=errors).load()
TypeError: __new__() needs keyword-only argument b
Do we need to improve pickle protocol in order to allow instance
creation functions get keyword arguments too?
Best regards,
Zaur
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com