Doesn't fully support protocol 2 #78

Closed
marcintustin opened this Issue Aug 19, 2014 · 4 comments

Projects

None yet

2 participants

@marcintustin
Contributor

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
Member
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
references.

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@gmail.com>
d6ce6b2
@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@gmail.com>
8f0c5cc
@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@gmail.com>
e866e9b
@marcintustin
Contributor

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

@marcintustin
Contributor

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.

@marcintustin
Contributor

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
e0a639c
@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