You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to #996, I'm getting an incorrect not-an-iterable error on an @asyncio.coroutine call. In this case, the error seems to be a more convoluted one related to a particular combination of circumstances leading to the method definition not being detected as a coroutine.
The minimal reproducer I've come up with (along with a couple of examples of cases that work as expected) is the following:
import asyncio
@asyncio.coroutine
def _func_detected_as_cr():
if (yield from asyncio.sleep(0.01)):
return
class Example():
@asyncio.coroutine
def _method_detected_as_cr(self):
if (yield from asyncio.sleep(0.01)):
pass
@asyncio.coroutine
def passes_pylint_check_1(self):
yield from _func_detected_as_cr()
@asyncio.coroutine
def passes_pylint_check_2(self):
yield from self._method_detected_as_cr()
@asyncio.coroutine
def _method_not_detected_as_cr(self):
if (yield from asyncio.sleep(0.01)):
pass
return
@asyncio.coroutine
def fails_pylint_check(self):
yield from self._method_not_detected_as_cr()
That gives the result:
$ pylint -E spurious_pylint_E1133.py
************* Module spurious_pylint_E1133
spurious_pylint_E1133.py:31:19: E1133: Non-iterable value self._method_not_detected_as_cr() is used in an iterating context (not-an-iterable)```
As shown in the reproducer, the same code in a top level function gets correctly detected as a coroutine, while similar code is correctly detected as long as it doesn't have an early return in the if statement body.
The text was updated successfully, but these errors were encountered:
Similar to #996, I'm getting an incorrect not-an-iterable error on an
@asyncio.coroutine
call. In this case, the error seems to be a more convoluted one related to a particular combination of circumstances leading to the method definition not being detected as a coroutine.The minimal reproducer I've come up with (along with a couple of examples of cases that work as expected) is the following:
That gives the result:
The text was updated successfully, but these errors were encountered: