Closed fizbin closed 2 years ago
Observe:
>>> from tatsu.ast import AST >>> a=AST(parseinfo=('Some parseinfo')) >>> a {'parseinfo': 'Some parseinfo'} >>> import pickle >>> pickle.loads(pickle.dumps(a)) {'parseinfo_': 'Some parseinfo'}
Note that after pickling/unpickling, the AST object is different.
I believe that this can be fixed by changing __reduce__ to:
__reduce__
def __reduce__(self): return (AST, (list(self.items()),))
Thanks, @fizbin!
Have you tested the proposed change?
Could you post it as a pull request?
Observe:
Note that after pickling/unpickling, the AST object is different.
I believe that this can be fixed by changing
__reduce__
to: