Title: pickle fail to handle some class with __new__
Type: Stage:
Components: Library (Lib) Versions: Python 3.3
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, yoch.melka
Priority: normal Keywords:

Created on 2013-07-04 14:03 by yoch.melka, last changed 2013-07-04 14:08 by amaury.forgeotdarc. This issue is now closed.

File name Uploaded Description Edit yoch.melka, 2013-07-04 14:03 test case
Messages (2)
msg192290 - (view) Author: yoch (yoch.melka) Date: 2013-07-04 14:03

If some class objects have extra arguments in the __new__ constructor , pickle fail to serialize it.

Here the output of provided test-case :

Traceback (most recent call last):
  File "/home/yoch/", line 19, in <module>
    y = pickle.load(fp)
TypeError: __new__() missing 1 required positional argument: 'arg'

Best regards
msg192291 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2013-07-04 14:08
This is expected, your class must say how this __new__ constructor can be called.
Date User Action Args
2013-07-04 14:08:15amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg192291

resolution: works for me
2013-07-04 14:03:55yoch.melkacreate