Fix wildcard imports from local __builtins__.pyi by jstar0 · Pull Request #11856 · microsoft/pyright · GitHub
Skip to content

Fix wildcard imports from local __builtins__.pyi - #11856

Open
King Star (jstar0) wants to merge 1 commit into
microsoft:mainfrom
jstar0:codex/pyright-11855-builtins-import-star
Open

King Star (jstar0) wants to merge 1 commit into
microsoft:mainfrom
jstar0:codex/pyright-11855-builtins-import-star

Conversation

@jstar0

Copy link
Copy Markdown

Fixes #11855

When a local __builtins__.pyi wildcard-imports project modules, those modules can be bound while the custom builtins file is still binding. They can then keep that binding without the custom builtins scope, causing names provided by the stub to be reported as undefined.

Rebind a file when its existing binding used a different builtins scope from the completed implicit import chain. Add a regression covering two local modules and names exposed through the custom builtins stub.

Verification:

  • pnpm --dir packages/pyright-internal exec jest src/tests/typeEvaluator8.test.ts --runInBand --forceExit
  • pnpm --dir packages/pyright-internal exec jest src/tests/sourceFile.test.ts --runInBand --forceExit
  • pnpm --dir packages/pyright-internal exec jest src/tests/fourSlashRunner.test.ts --runInBand --forceExit -t completions.builtinOverride
  • pnpm --dir packages/pyright-internal run build

@jstar0

Copy link
Copy Markdown
Author

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__builtins__.pyi with local import * doesn't work as expected with 1.1.414

1 participant