Skip to content

Yield self is inferred to be of a mistaken type  #1090

@doranid

Description

@doranid

Steps to reproduce

  1. Run the following
import astroid


print(list(astroid.parse('''
import contextlib

class A:
    @contextlib.contextmanager
    def get(self):
        yield self

class B(A):
    def play():
        pass

with B().get() as b:
    b.play()
''').ilookup('b')))

Current behavior

Prints [<Instance of .A at 0x...>]

Expected behavior

Prints [<Instance of .B at 0x...>]

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions