Closed
Description
Notice how the actual iteration is not performed in the executor thread:
Lines 56 to 62 in 20da9af
Here's a possible fix:
def iter_wrapper_factory(cls, meth_name):
@async_wraps(cls, cls._wraps, meth_name)
async def wrapper(self, *args, **kwargs):
meth = getattr(self._wrapped, meth_name)
func = partial(meth, *args, **kwargs)
items = await trio.to_thread.run_sync(lambda: list(func()))
return (rewrap_path(item) for item in items)
Metadata
Metadata
Assignees
Labels
No labels