microsoft / microsoft/pyright

Inconsistent type narrowing for attribute accesses involving asymmetric descriptors

Open
#11,238 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
15.6k
Forks
1.8k
Avg merge
12h 13m
Merged PRs (30d)
52

Description

See https://github.com/microsoft/pyright/issues/11233 for additional context.

Example of incorrect behavior: [Playground](https://pyright-play.net/?strict=true&code=GYJw9gtgBALgngBwJYDsDmUkQWEMoCCKcANFAOICmKlISAxmQCqKUBqAhiAFDdNQBeKCwTsuACigAiJlKgBKbgFVBw1pxCSpSuYu70ANhwDOxqAEkUxmBxQwkHe%2BgIwYmitVoMA2sLIqAXQUALm4ocIATSmAoAH1Y40oYeMlEg2AyVGtbekpgwmIyADcOAwBXPKgVAB8oADkwGgUoAFoAPnrGvLDw3oA6Ad5eqJj4tCSUqDSMzCsbFFz8olIoMAB3GhAl4lUGpvlWjv5ave7e-sH9I1MoAAUkazADUPCAIy4QSgMAGWo0GAAFvlUDAeiM4rFUEhkrFUl8Zu8QJ8fn9AcC7GQAPTNdqdGgvC59XiGExmADC61eYDgBKgAKe1lo%2BUs2TsDicaBcbl890eBjIMDKCAMlF8IKgQQCvH0qgpaypcHEinofXpBkZIFUkgAbGRFKTaPgVWqNZgzCgwPhTtwEHQ7JJjQyYLQ%2Bojkb90ICFEA)

Assignment in a different scope fixes the issue: [Playground](https://pyright-play.net/?strict=true&code=GYJw9gtgBALgngBwJYDsDmUkQWEMoCCKcANFAOICmKlISAxmQCqKUBqAhiAFDdNQBeKCwTsuACigAiJlKgBKbgFVBw1pxCSpSuYu70ANhwDOxqAEkUxmBxQwkHe%2BgIwYmitVoMA2sLIqAXQUALm4ocIATSmAoAH1Y40oYeMlEg2AyVGtbekpgwmIyADcOAwBXPKgVAB8oADkwGgUoAFoAPnrGvLDw3oA6Ad5eqJj4tCSUqDSMzCsbFFz8olIoMAB3GhAl4lUGpvlWjv5ave7e-sH9I1MoAAUkazADUPCAIy4QSgMAGWo0GAAFvlUDAeiM4rFUEhkrFUl8Zu8QJ8fn9AcC7GQAPTNdqdGgvC59XiGExmADC61eYDgBKgAKe1lo%2BUs2TsDicaBcbl890eBjIMDKCAMlF8IKgQQCvG44Ky83sjkoAAkGTBaJJ6PkKWsqXAQj0oPQ%2BvSDIyQKpJAA2Mh6eiqbW68SKOW2BVqlWmtXuO2KUm0fBGk1mzBmFBgfCnbgIOh2DXG1W0PqI5G-dCAhRAA)

Contributor guide

Open the contributing guide

Research direction

No repository file or test is named. Start with issue 11233 and compare the two linked Pyright Playground examples under strict mode; reproduce the inconsistent narrowing, then verify that the relevant attribute-access cases narrow consistently without regressing the contrasting scope behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.