Skip to content

Commit 3ee782e

Browse files
authored
Pass through None during param resolution (quantumlib#5466)
- pass through None as a parameter if set. Technically a breaking change, since this used to silently drop parameters that were set as None. Fixes: quantumlib#4029
1 parent 837ad42 commit 3ee782e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

cirq/study/resolver.py

+2
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ def _from_json_dict_(cls, param_dict, **kwargs):
261261

262262

263263
def _resolve_value(val: Any) -> Any:
264+
if val is None:
265+
return val
264266
if isinstance(val, numbers.Number) and not isinstance(val, sympy.Basic):
265267
return val
266268
if isinstance(val, sympy_numbers.IntegerConstant):

cirq/study/resolver_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
@pytest.mark.parametrize(
2626
'val',
2727
[
28+
None,
2829
3.2,
2930
np.float32(3.2),
3031
int(1),

0 commit comments

Comments
 (0)