Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive unreachable for NoReturn coroutine functions #9840

Closed
tomasz-michalski opened this issue Jul 29, 2024 · 1 comment · Fixed by #9844
Closed

False positive unreachable for NoReturn coroutine functions #9840

tomasz-michalski opened this issue Jul 29, 2024 · 1 comment · Fixed by #9844
Labels
Backported False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@tomasz-michalski
Copy link
Contributor

Bug description

# pylint: disable=missing-module-docstring,missing-function-docstring

import asyncio
from typing import NoReturn


async def coro() -> NoReturn:
    while True:
        await asyncio.sleep(1)


async def main() -> None:
    asyncio.create_task(coro())
    print("hello")


if __name__ == "__main__":
    asyncio.run(main())

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module a
a.py:14:4: W0101: Unreachable code (unreachable)

-----------------------------------
Your code has been rated at 9.00/10

Expected behavior

No error

Pylint version

pylint 3.2.6
astroid 3.2.4
Python 3.11.9 (main, Apr  6 2024, 17:59:24) [GCC 9.4.0]

OS / Environment

Ubuntu 20.04.6 LTS

Additional dependencies

No response

@tomasz-michalski tomasz-michalski added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jul 29, 2024
@tomasz-michalski
Copy link
Contributor Author

I believe this bug was introduced in Pylint 3.2.4, #9714

@jacobtylerwalls jacobtylerwalls added this to the 3.2.7 milestone Jul 30, 2024
@jacobtylerwalls jacobtylerwalls added False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants