This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jnsdrtlf
Recipients cheryl.sabella, hongweipeng, jnsdrtlf
Date 2020-03-29.19:22:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585509760.73.0.583521912467.issue38337@roundup.psfhosted.org>
In-reply-to
Content
I'm still thinking about this bug/issue/undefined behaviour. Today I wanted to test its behaviour with async:

import inspect


class Foo:
    def __init__(self, bar):
        self._bar = bar

    @property
    async def spam(self):
        print('Called spam')
        return self._bar


if __name__ == '__main__':
    instance = Foo('eggs')
    members = inspect.getmembers(instance)

##

This will result in a RuntimeWarning:


RuntimeWarning: coroutine 'Foo.spam' was never awaited
  members = inspect.getmembers(instance)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback


Sure, async properties might not be particularly beautiful or best-practice, but I frequently stumble upon code where getmembers would fail – just like this example. However, I am still clueless about what to do.
History
Date User Action Args
2020-03-29 19:22:40jnsdrtlfsetrecipients: + jnsdrtlf, cheryl.sabella, hongweipeng
2020-03-29 19:22:40jnsdrtlfsetmessageid: <1585509760.73.0.583521912467.issue38337@roundup.psfhosted.org>
2020-03-29 19:22:40jnsdrtlflinkissue38337 messages
2020-03-29 19:22:40jnsdrtlfcreate