8.5.20. pymodaq_utils.safe_pickle module
Read legacy pickled content without being able to run code
PyMoDAQ used to store some data (strings in .h5 files, dock layouts) with pickle, which can run arbitrary code when loaded. New files do not use pickle anymore, this module only exists so that legacy files can still be read: only plain data (str, bytes, numbers, tuples, lists, dicts, sets…) is rebuilt, any attempt to reference another object is refused.
- exception pymodaq_utils.safe_pickle.LegacyFormatWarning[source]
Bases:
UserWarningEmitted when a file is read in a legacy format that should be migrated
- exception pymodaq_utils.safe_pickle.UnsafePickleError[source]
Bases:
UnpicklingErrorRaised when legacy content tries to build something else than plain data
- pymodaq_utils.safe_pickle.restricted_load(file, extra_allowed=())[source]
Equivalent of pickle.load restricted to plain data, raises UnsafePickleError otherwise
- Return type: