def _persist_settings(config_manager):
    """
    Write the settings, including the persistent global script Store.
    The Store instance might contain arbitrary user data, like function objects, OpenCL contexts, or whatever other
    non-serializable objects, both as keys or values.
    Try to serialize the data, and if it fails, fall back to checking the store and removing all non-serializable
    data.
    """
    serializable_data = config_manager.get_serializable()
    try:
        _try_persist_settings(serializable_data)
    except (TypeError, ValueError):
        # The user added non-serializable data to the store, so remove all non-serializable keys or values.
        _remove_non_serializable_store_entries(serializable_data["settings"][SCRIPT_GLOBALS])
        _try_persist_settings(serializable_data)
def _persist_settings ( config_manager ) : serializable_data = config_manager . get_serializable ( ) try : _try_persist_settings ( serializable_data ) except ( TypeError , ValueError ) : _remove_non_serializable_store_entries ( serializable_data [ "settings" ] [ SCRIPT_GLOBALS ] ) _try_persist_settings ( serializable_data )
Write the settings, including the persistent global script Store.
    The Store instance might contain arbitrary user data, like function objects, OpenCL contexts, or whatever other
    non-serializable objects, both as keys or values.
    Try to serialize the data, and if it fails, fall back to checking the store and removing all non-serializable
    data.