Skip to content

Conversation

@agronholm
Copy link
Contributor

@agronholm agronholm commented Jul 2, 2025

@agronholm
Copy link
Contributor Author

Ack. WASI tests are failing because I used asyncio. Gotta work around that.

Comment on lines 90 to 91
with self._recreate_cm():
yield from func(*args, **kwds)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
with self._recreate_cm():
yield from func(*args, **kwds)
with self._recreate_cm(), closing(func(*args, **kwds)) as gen:
yield from gen

I think we should be using with closing() and async with aclosing() in these wrappers, to ensure that any resources held by the wrapped function are cleaned up promptly. (see e.g. PEP-533 motivation)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@agronholm
Copy link
Contributor Author

@ambv I recall that back in July in Prague you said you'd take a look at this PR, yes? Would now be a good time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants