Skip to content

False positive assignment-from-no-return on generator #3904

@xbe

Description

@xbe

Steps to reproduce

from typing import Callable, Generator CHUNK_SIZE = 5 def chunk(handler: Callable[[str], None]) -> Generator[None, str, None]: buf = '' while True: while len(buf) < CHUNK_SIZE: buf += yield head, buf = buf[:CHUNK_SIZE], buf[CHUNK_SIZE:] handler(head) def handle(contents: str) -> None: print(f'Got: {contents}') streamer = chunk(handle) next(streamer) # start streaming streamer.send('foo') 

Current behavior

************* Module iter iter.py:20:0: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return) 

Expected behavior

No error.

pylint --version output

With pip install pylint astroid --pre -U:

pylint 2.6.0 astroid 2.4.2 Python 3.8.5 (default, Jul 20 2020, 18:32:44) [GCC 9.3.0] 

Metadata

Metadata

Assignees

Labels

Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeGood first issueFriendly and approachable by new contributors

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions