Skip to content

Serialising traceback objects #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cjdoris opened this issue Aug 23, 2021 · 3 comments
Closed

Serialising traceback objects #34

cjdoris opened this issue Aug 23, 2021 · 3 comments

Comments

@cjdoris
Copy link
Collaborator

cjdoris commented Aug 23, 2021

Python traceback objects are not picklable, and hence PyException cannot always be serialised.

As a fix, serialise the b field of a PyException as None. Or possibly always serialize traceback to None? Or to Unpicklable()?

Optional extra: if we detect that tblib is installed, allow pickling of traceback.

Document this behaviour in the compat section.

@cjdoris
Copy link
Collaborator Author

cjdoris commented Aug 23, 2021

And what about other things that can't be pickled?

@cjdoris
Copy link
Collaborator Author

cjdoris commented Aug 23, 2021

In fact Python Exceptions are already picklable - the __traceback__ field is skipped. So we get all this behaviour for free if we just change PyException to be a wrapper around a single Python Exception object.

@cjdoris
Copy link
Collaborator Author

cjdoris commented Aug 23, 2021

Or perhaps leave the fields separate as-is, but treat PyException as a wrapper type around the v property. This lets us avoid normalising. When normalising, set v.__traceback__ to t. When serialising, just serialise v. When deserialising, set t=pytype(v) and b=v.__traceback__ and isnormalised=true.

@cjdoris cjdoris closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant