Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Doesn't fully support protocol 2 #78

marcintustin opened this Issue · 4 comments

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?


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 referenced this issue from a commit
@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 referenced this issue from a commit
@davvid davvid tests: add a Pickle v2 cyclical reference test
Related-to: #78
Signed-off-by: David Aguilar <>
@davvid davvid referenced this issue from a commit
@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 closed this issue from a commit
@marcintustin marcintustin 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.