Skip to content

Commit

Permalink
Fix symforce codegen ValueError error message
Browse files Browse the repository at this point in the history
We used `zip` on two lists known to be different sizes, which cuts off
the non-matching values in the error message. E.g. if
`formatted_symbols` has length 1 and `flattened_value` has length 0 we
would print `The following symbol/value pairs should match: []` which
isn't helpful.

This makes it so that we actually print the full list of symbols/values
that should match in the error message.

Topic: fix_codegen_util_error_msg
GitOrigin-RevId: dc1f6a946659cf33d813fb529409094e921d60be
  • Loading branch information
nathan-skydio authored and aaron-skydio committed Feb 11, 2025
1 parent 27e3ba5 commit 9b3b196
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion symforce/codegen/codegen_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def get_formatted_list(
)
# Only print matches if flattened_value isn't filled with expressions
if format_as_inputs:
matches = list(zip(formatted_symbols, flattened_value))
matches = list(itertools.zip_longest(formatted_symbols, flattened_value))
error_text += f"The following symbol/value pairs should match: {matches}"
raise ValueError(error_text)

Expand Down

0 comments on commit 9b3b196

Please sign in to comment.