From 57f4d6588f0c88bb0196d1d97e8b87f486850871 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 30 Sep 2021 16:46:23 +1000 Subject: [PATCH] fix uncaught error when int over 64 bits passed into db_command() --- pylib/anki/_backend/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pylib/anki/_backend/__init__.py b/pylib/anki/_backend/__init__.py index d0c23045d..a54dae3c1 100644 --- a/pylib/anki/_backend/__init__.py +++ b/pylib/anki/_backend/__init__.py @@ -92,10 +92,11 @@ class RustBackend(RustBackendGenerated): return self._db_command(dict(kind="rollback")) def _db_command(self, input: Dict[str, Any]) -> Any: + bytes_input = to_json_bytes(input) try: - return from_json_bytes(self._backend.db_command(to_json_bytes(input))) + return from_json_bytes(self._backend.db_command(bytes_input)) except Exception as e: - err_bytes = bytes(e.args[0]) + err_bytes = e.args[0] err = backend_pb2.BackendError() err.ParseFromString(err_bytes) raise backend_exception_to_pylib(err)