Skip to content

not-async-context-manager false positive: wrapped asynccontextmanager #3862

Closed
@belm0

Description

@belm0

Steps to reproduce

def foo():
    @asynccontextmanager
    async def wrapper(*args, **kwargs):
        pass
    return wrapper

async with foo():
    pass
E1701: Async context manager 'wrapper' doesn't implement __aenter__ and __aexit__. (not-async-context-manager)

The troubling thing is that foo() is part of a public API, which means every project using it would need to suppress not-async-context-manager.

pylint --version output

pylint 2.6.0
astroid 2.4.2
Python 3.8.2 (default, Jun 15 2020, 10:47:09)
[Clang 9.0.0 (clang-900.0.39.2)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions