From 3561ba5752d15d183bd457ef18f2e26631b5b882 Mon Sep 17 00:00:00 2001 From: Julien Cochuyt Date: Fri, 20 Sep 2019 15:37:07 +0200 Subject: [PATCH] Ensure pickle files can be read by earlier versions of NVDA (#7105) Impacts both the add-ons state and the updater state files. Both are now written using pickle protocol 0 so that Python 2 version of NVDA can read them in case of downgrading. Re https://github.com/nvaccess/nvda/pull/10224#issuecomment-533459119 --- source/addonHandler/__init__.py | 2 +- source/updateCheck.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/addonHandler/__init__.py b/source/addonHandler/__init__.py index 7f2f6f6dd64..75da59af505 100644 --- a/source/addonHandler/__init__.py +++ b/source/addonHandler/__init__.py @@ -72,7 +72,7 @@ def saveState(): try: # #9038: Python 3 requires binary format when working with pickles. with open(statePath, "wb") as f: - pickle.dump(state, f) + pickle.dump(state, f, protocol=0) except: log.debugWarning("Error saving state", exc_info=True) diff --git a/source/updateCheck.py b/source/updateCheck.py index ec4b033f309..8cf45e20afa 100644 --- a/source/updateCheck.py +++ b/source/updateCheck.py @@ -744,7 +744,7 @@ def saveState(): try: # #9038: Python 3 requires binary format when working with pickles. with open(_stateFilename, "wb") as f: - pickle.dump(state, f) + pickle.dump(state, f, protocol=0) except: log.debugWarning("Error saving state", exc_info=True)