Skip to content
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

[FIX] settings: save with pickle protocol 4 #81

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions orangewidget/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@

VERSION_KEY = "__version__"

# protocol v4 is supported since Python 3.4, protocol v5 since Python 3.8
PICKLE_PROTOCOL = 4


__WIDGET_SETTINGS_DIR = None # type: Optional[Tuple[str, str]]

Expand Down Expand Up @@ -541,7 +544,7 @@ def write_defaults_file(self, settings_file):
"""
defaults = dict(self.defaults)
defaults[VERSION_KEY] = self.widget_class.settings_version
pickle.dump(defaults, settings_file, -1)
pickle.dump(defaults, settings_file, protocol=PICKLE_PROTOCOL)

def _get_settings_filename(self):
"""Return the name of the file with default settings for the widget"""
Expand Down Expand Up @@ -765,7 +768,7 @@ def add_version(context):
return context

pickle.dump([add_version(context) for context in self.global_contexts],
settings_file, -1)
settings_file, protocol=PICKLE_PROTOCOL)

def pack_data(self, widget):
"""Call the inherited method, then add local contexts to the dict."""
Expand Down