Jonas Drotleff <jonas.drotl...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38337>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to