Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encoding Incorrect padding error #1682

Merged
merged 4 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion qiskit_ibm_runtime/utils/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
import warnings
import zlib
from datetime import date
from typing import Any, Callable, Dict, List, Union

from typing import Any, Callable, Dict, List, Union, get_args

import dateutil.parser
import numpy as np
Expand Down Expand Up @@ -69,6 +70,7 @@
PubResult,
PrimitiveResult,
)
from qiskit_ibm_runtime.options.zne_options import ExtrapolatorType

_TERRA_VERSION = tuple(
int(x) for x in re.match(r"\d+\.\d+\.\d", _terra_version_string).group(0).split(".")[:3]
Expand Down Expand Up @@ -328,6 +330,8 @@ def object_hook(self, obj: Any) -> Any:
if obj_type == "complex":
return obj_val[0] + 1j * obj_val[1]
if obj_type == "ndarray":
if obj_val in get_args(ExtrapolatorType):
return obj_val
if isinstance(obj_val, list):
return np.array(obj_val)
return _decode_and_deserialize(obj_val, np.load)
Expand Down
1 change: 1 addition & 0 deletions release-notes/unreleased/1682.bug.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a serialization issue where decoding job metadata resulted in an error.