cached-property icon indicating copy to clipboard operation
cached-property copied to clipboard

Use iscoroutinefunction from inspect not asyncio

Open AdamWill opened this issue 1 year ago • 2 comments

Python 3.14 will deprecate asyncio.iscoroutinefunction: https://github.com/python/cpython/pull/122875

inspect.iscoroutinefunction exists since 3.5 and our baseline is 3.8, so we can just use it unconditionally.

Using a wrapper with @asyncio.coroutine in get wasn't necessary (the future from asyncio.ensure_future is awaitable, and the wrapper doesn't do anything asynchronous), so the logic can be simplified to just call asyncio.ensure_future (to schedule the task and store the result when it's available).

AdamWill avatar Nov 05 '24 18:11 AdamWill

This is a rebase of https://github.com/pydanny/cached-property/pull/267 , but it turns out to be much simpler against 2.0.1. Skipping test_coroutine_cached_property.py as the original did no longer appears to be necessary - arguably that test could now be removed as we're targeting a 3.8 baseline, but it seems like that could be a separate PR. @encukou for info, I've kept you as the author of this but can change it to me if you don't want your name on it any more :)

AdamWill avatar Nov 05 '24 18:11 AdamWill

Pls, let's merge this. Python 3.14 is out

nguettler avatar Oct 20 '25 11:10 nguettler