Skip to content

Commit

Permalink
Make sure that as_type arguments are respected in Frame.put_parameter…
Browse files Browse the repository at this point in the history
…s for lists of values as well (#575)
  • Loading branch information
tmadlener authored Apr 3, 2024
1 parent 14109ff commit 2626082
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/podio/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def put_parameter(self, key, value, as_type=None):
raise ValueError(f"Cannot put a parameter of type {type_name} into a Frame")

par_type = vec_types[0]
if isinstance(value[0], float):
if as_type is None and isinstance(value[0], float):
# Always store floats as doubles from the python side
par_type = par_type.replace("float", "double")

Expand Down
1 change: 1 addition & 0 deletions tests/read_python_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ int checkParameters(const podio::Frame& frame) {
if (realFloats.size() != 3 || realFloats[0] != 1.23f || realFloats[1] != 4.56f || realFloats[2] != 7.89f) {
std::cerr << "Parameter more_real_floats was not stored as correctly (expected [1.23, 4.56, 7.89], actual"
<< realFloats << ")" << std::endl;
return 1;
}

return 0;
Expand Down

0 comments on commit 2626082

Please sign in to comment.