Skip to content

Commit 9888067

Browse files
authored
Avoid broad Exception catch in consistent_resolve_parameters (#7979)
Replaced the broad `except Exception:` block in `assert_consistent_resolve_parameters` with more specific exceptions: `(TypeError, ValueError, RecursionError, sympy.SympifyError)`. This prevents hiding internal implementation bugs like `AttributeError` or `RuntimeError` during parameter resolution tests.
1 parent 336a71f commit 9888067

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cirq-core/cirq/testing/consistent_resolve_parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def assert_consistent_resolve_parameters(val: Any) -> None:
3636
# object should report that it has no more parameters to resolve.
3737
try:
3838
resolved = cirq.resolve_parameters(val, dict.fromkeys(names, 0))
39-
except Exception:
39+
except (TypeError, ValueError, RecursionError, sympy.SympifyError):
4040
pass
4141
else:
4242
assert not cirq.parameter_names(resolved)

0 commit comments

Comments
 (0)