gawel / panoramisk

asyncio based library to play with asterisk
https://panoramisk.readthedocs.io/
MIT License
151 stars 50 forks source link

Avoid Direct Creation Of Future And Task Objects #110

Open ldo opened 2 years ago

ldo commented 2 years ago

Note that the asyncio docs say that loop.create_future() and loop.create_task() are the preferred ways of creating Future and Task objects, rather than instantiating them directly.

This patch removes the direct instantiation calls in favour of calling those API routines.

Also, I don’t think you should be subclassing Future; leave that sort of thing to event-loop implementations. That would fix the multiple instances of this warning that I get with Python 3.10:

/home/ldo/sources/panoramisk-git/panoramisk/actions.py:34: DeprecationWarning: There is no current event loop
asyncio.Future.__init__(self)