Skip to content

Commit

Permalink
Pass through None during param resolution (#5466)
Browse files Browse the repository at this point in the history
- 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: #4029
  • Loading branch information
dstrain115 authored Jun 7, 2022
1 parent b66b530 commit 9f37af1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cirq-core/cirq/study/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ def _from_json_dict_(cls, param_dict, **kwargs):


def _resolve_value(val: Any) -> Any:
if val is None:
return val
if isinstance(val, numbers.Number) and not isinstance(val, sympy.Basic):
return val
if isinstance(val, sympy_numbers.IntegerConstant):
Expand Down
1 change: 1 addition & 0 deletions cirq-core/cirq/study/resolver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
@pytest.mark.parametrize(
'val',
[
None,
3.2,
np.float32(3.2),
int(1),
Expand Down

0 comments on commit 9f37af1

Please sign in to comment.