Skip to content

Commit

Permalink
Ensure pickle files can be read by earlier versions of NVDA (nvaccess…
Browse files Browse the repository at this point in the history
…#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 nvaccess#10224 (comment)
  • Loading branch information
JulienCochuyt committed Sep 20, 2019
1 parent 0e4bb4a commit 3561ba5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/addonHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion source/updateCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 3561ba5

Please sign in to comment.