Skip to content

More robust pickling support #186

Closed
Closed
@bluescarni

Description

@bluescarni

The current documentation about pickling support states:

Note that only the cPickle module is supported on Python 2.7. It is also important to request usage of the highest protocol version using the -1 argument to dumps. Failure to follow these two steps will lead to important pybind11 memory allocation routines to be skipped during unpickling, which will likely cause memory corruption and/or segmentation faults.

The cPickle restriction for Python 2.x does not look too problematic, but I believe the requirement about the explicit protocol version is an issue. Forcing the -1 argument in internal use is not problematic if one writes a couple of thin wrappers around loads/dumps for the purpose, but it is fragile with respect to those situations in which one cannot control how loads/dumps are called (e.g., the multiprocessing module, ipyparallel, etc.).

Would it be possible to remove this restriction?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions