mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 15:47:12 -05:00
fix profile save not working on Python 3.10
This commit is contained in:
parent
7c70d26fe7
commit
daf2e0a78f
1 changed files with 5 additions and 7 deletions
|
|
@ -8,7 +8,6 @@ import pickle
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
import traceback
|
import traceback
|
||||||
import warnings
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
|
|
@ -283,12 +282,11 @@ class ProfileManager:
|
||||||
return up.load()
|
return up.load()
|
||||||
|
|
||||||
def _pickle(self, obj: Any) -> bytes:
|
def _pickle(self, obj: Any) -> bytes:
|
||||||
# pyqt needs to be updated to fix
|
for key, val in obj.items():
|
||||||
# 'PY_SSIZE_T_CLEAN will be required for '#' formats' warning
|
if isinstance(val, QByteArray):
|
||||||
# check if this is still required for pyqt6
|
obj[key] = bytes(val) # type: ignore
|
||||||
with warnings.catch_warnings():
|
|
||||||
warnings.simplefilter("ignore")
|
return pickle.dumps(obj, protocol=4)
|
||||||
return pickle.dumps(obj, protocol=4)
|
|
||||||
|
|
||||||
def load(self, name: str) -> bool:
|
def load(self, name: str) -> bool:
|
||||||
assert name != "_global"
|
assert name != "_global"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue