[GTKUI|Py3] Ensure backward compatible pickle dumps

This commit is contained in:
Calum Lind 2018-07-01 20:34:42 +01:00
parent 7b5ed9f1d6
commit be02be75be
3 changed files with 3 additions and 3 deletions

View File

@ -861,7 +861,7 @@ class TorrentManager(component.Component):
try:
log.debug('Creating the temporary file: %s', filepath_tmp)
with open(filepath_tmp, 'wb', 0) as _file:
pickle.dump(state, _file)
pickle.dump(state, _file, protocol=2)
_file.flush()
os.fsync(_file.fileno())
except (OSError, pickle.PicklingError) as ex:

View File

@ -264,7 +264,7 @@ def save_pickled_state_file(filename, state):
try:
with open(filepath_tmp, 'wb') as _file:
# Pickle the state object
pickle.dump(state, _file)
pickle.dump(state, _file, protocol=2)
_file.flush()
os.fsync(_file.fileno())
shutil.move(filepath_tmp, filepath)

View File

@ -757,7 +757,7 @@ class FilesTab(Tab):
def _on_drag_data_get_data(self, treeview, context, selection, target_id, etime):
paths = self.listview.get_selection().get_selected_rows()[1]
selection.set_text(pickle.dumps(paths))
selection.set_text(pickle.dumps(paths, protocol=2))
def _on_drag_data_received_data(self, treeview, context, x, y, selection, info, etime):
try: