shizmob / pydle

An IRCv3-compliant Python 3 IRC library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WHOIS uses deprecated @asyncio.coroutine

Rixxan opened this issue · comments

Currently, @asyncio.coroutine is deprecated and is removed in Python3.10. Unfortunately, a few things in Pydle still use this, which means currently warnings are thrown by some test libraries as well as locking Pydle-based projects to 3.9 or lower.

One such example can be viewed here: https://github.com/Shizmob/pydle/blob/9798eb3db6665622fdd1391cdb563ebdb3014c6c/pydle/features/account.py#L24-L30

Expected Behavior

When called, this function should return the information about a user, without errors or warnings.

Current Behavior

When run with Python 3.10, this function fails. When run with Python 3.8, a warning is thrown that the type is deprecated.

Possible Solution

On my own testing, in Python 3.8, the following code appears to drop-in work as intended, however I don't know enough to completely validate it.

    ## IRC API.
    async def whois(self, nickname):
        info = await super().whois(nickname)
        info.setdefault('account', None)
        info.setdefault('identified', False)
        return info

Context (Environment)

OS: Windows 10
Python Version: Python 3.8.6
Pydle version: 0.9.4