WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Find a way to persist C extension types #227

@adrinjalali

Description

@adrinjalali

The way pickle persists C extension types (including objects created by cython) is to rely on __reduce__ and __reduce_ex__.

We should find a protocol that third party packages can implement, so that we could avoid relying on __reduce__.

One issue is that we can't call __new__ on C extension types generated by Cython. Cython would raise if the type tries to implement this special method. However, one can implement __cinit__ in cython.

We can certainly require those objects to implement __getstate__ and __setstate__. The remaining issue is the constructor.

Right now we call __new__ for all other objects, but we can't do that here. The question is, should we then call Object() instead? Or should we find a way to have something which acts as a low level and light constructor.

Some links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    persistenceSecure persistence feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions