From daf2e0a78f2277cddf13bb0abed9e620d4d47179 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 3 Oct 2021 12:08:49 +1000 Subject: [PATCH] fix profile save not working on Python 3.10 --- qt/aqt/profiles.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/qt/aqt/profiles.py b/qt/aqt/profiles.py index bb1190984..27a692c4e 100644 --- a/qt/aqt/profiles.py +++ b/qt/aqt/profiles.py @@ -8,7 +8,6 @@ import pickle import random import shutil import traceback -import warnings from enum import Enum from typing import Any, Dict, List, Optional @@ -283,12 +282,11 @@ class ProfileManager: return up.load() def _pickle(self, obj: Any) -> bytes: - # pyqt needs to be updated to fix - # 'PY_SSIZE_T_CLEAN will be required for '#' formats' warning - # check if this is still required for pyqt6 - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - return pickle.dumps(obj, protocol=4) + for key, val in obj.items(): + if isinstance(val, QByteArray): + obj[key] = bytes(val) # type: ignore + + return pickle.dumps(obj, protocol=4) def load(self, name: str) -> bool: assert name != "_global"