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

Context manager methods no longer work #717

Closed
vberlier opened this issue Dec 11, 2020 · 2 comments
Closed

Context manager methods no longer work #717

vberlier opened this issue Dec 11, 2020 · 2 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@vberlier
Copy link

Pylance 2020.12.1 throws an internal error with the following code:

from contextlib import contextmanager

class Hello:
    @contextmanager
    def foo(self):
        yield

with Hello().foo():
    pass
TypeError: Cannot read property 'category' of undefined
    at Object.isUnknown (pyright-internal/src/analyzer/types.ts:1486:17)
    at isPartlyUnknown (pyright-internal/src/analyzer/typeUtils.ts:1362:9)
    at Object.isPartlyUnknown (pyright-internal/src/analyzer/typeUtils.ts:1410:21)
    at reportPossibleUnknownAssignment (pyright-internal/src/analyzer/typeEvaluator.ts:8712:20)
    at getTypeFromMemberAccessWithBaseType (pyright-internal/src/analyzer/typeEvaluator.ts:3816:13)
    at getTypeFromMemberAccess (pyright-internal/src/analyzer/typeEvaluator.ts:3551:34)
    at getTypeOfExpression (pyright-internal/src/analyzer/typeEvaluator.ts:815:30)
    at getTypeFromCall (pyright-internal/src/analyzer/typeEvaluator.ts:5004:32)
    at getTypeOfExpression (pyright-internal/src/analyzer/typeEvaluator.ts:825:30)
    at Vt (pyright-internal/src/analyzer/typeEvaluator.ts:11442:24)
@erictraut
Copy link
Contributor

Thanks for the bug report. This is caused by a recent regression that slipped through our tests. It will be fixed in the next release.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Dec 11, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.12.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020122-11-december-2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants