Doesn't fully support protocol 2 #78

marcintustin opened this Issue Aug 19, 2014 · 4 comments


None yet

2 participants


I noticed that jsonpickle doesn't call newargs or initargs as per protocol 2. This is a problem when working with namedtuples and SQLAlchemy. Is there a reason this isn't being done? If I add that functionality, are you open to merging it?

davvid commented Aug 20, 2014

I merged the __getnewargs__ pull request. I'll leave this issue open since it looks like you're still looking into supporting __initargs__, though if this should be closed let me know. cheers

@davvid davvid added a commit that referenced this issue Aug 20, 2014
@davvid davvid pickle v2: improve handling for object references
We now allow Pickle Protocol v2 __getnewargs__() to contain

The unpickler uses a new strategy for handling references.
It now places Proxy objects into the referencing machinery
to break dependencies between construction arguments and
parent objects.

A final sweep is done at the end of restore() to swap proxies
for their real instances.  This allows for proper referencing
within objects returned by __getnewargs__().

Related-to: #78
Signed-off-by: David Aguilar <>
@davvid davvid added a commit that referenced this issue Aug 20, 2014
@davvid davvid tests: add a Pickle v2 cyclical reference test
Related-to: #78
Signed-off-by: David Aguilar <>
@davvid davvid added a commit that referenced this issue Aug 20, 2014
@davvid davvid unpickler: more Pickle v2 referencing improvements
We now support cyclical references inside of lists when using
Pickle Protocol v2.

Related-to: #78
Signed-off-by: David Aguilar <>

@davvid Cool. I hope to add support for all of protocol 2 - after all, it's only a few methods


Here's the plan: I'm going to implement protocol 2 as it relates to new-style classes only, unless someone expresses an interest in having classic classes also supported.


This issue should be closed out by #82

Also, contrary to my original plan, this includes support for classic classes.

@davvid davvid added a commit that closed this issue Sep 2, 2014
@marcintustin @davvid marcintustin + davvid core: add support for classic instances
Support classic ("old-style") classes with arguments to __init__
and add support for __getinitargs__.

This enables full Pickle Protocol 2 support.

Closes #78
@davvid davvid closed this in e0a639c Sep 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment