From e9cfa1b1b9b0377764980642f3b00f62f24b4b38 Mon Sep 17 00:00:00 2001 From: Julien Cochuyt Date: Mon, 23 Sep 2019 10:13:18 +0200 Subject: [PATCH] Ensure pickle files can be read by earlier versions of NVDA (#7105) (#10255) 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 358ecc0c065..60c40b8705f 100644 --- a/source/updateCheck.py +++ b/source/updateCheck.py @@ -750,7 +750,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)