Skip to content

fix(watermark): Return a list instead of a generator#203

Merged
evanh merged 1 commit intomainfrom
evanh/fix/fix-generator-bug
Sep 2, 2025
Merged

fix(watermark): Return a list instead of a generator#203
evanh merged 1 commit intomainfrom
evanh/fix/fix-generator-bug

Conversation

@evanh
Copy link
Member

@evanh evanh commented Sep 2, 2025

This fixes a bug in the code that expects a list instead of a Generator.

This fixes a bug in the code that expects a list instead of a Generator.
@evanh evanh requested a review from a team as a code owner September 2, 2025 19:11
Copy link
Member

@untitaker untitaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so why did the code typecheck if the caller expected a list and only got Iterable

@evanh
Copy link
Member Author

evanh commented Sep 2, 2025

so why did the code typecheck if the caller expected a list and only got Iterable

I believe the caller is in Rust using pyo3. @bmckerry or @victoria-yining-huang could clarify specifically where this happens.

Copy link
Contributor

@victoria-yining-huang victoria-yining-huang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this works just pulled the branch and tested

@evanh evanh merged commit 29b04c5 into main Sep 2, 2025
18 of 19 checks passed
@untitaker
Copy link
Member

@evanh i thikn the signature of flush is also wrong

victoria-yining-huang added a commit that referenced this pull request Sep 2, 2025
followup to [PR ](#203), the
submit function needs a more specific return type, because the caller in
pyo3 in rust needs a list
bmckerry added a commit that referenced this pull request Sep 4, 2025
#203 fixed the initial error by
returning messages as a Sequence instead of a generator, but this caused
another issue where watermarks weren't handled by the python adapter's
`handle_py_return_value` function.

This required implementing `From Py<PyAny> for Watermark` to allow
converting the python `PyWatermark` returned from the `PythonAdapter`
into a rust `PyWatermark`.

A rust test for this code path is coming in a future PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants