8000 Fixed a bug in the special-case logic that handles `__all__.extend(<s… · codean-io/scip-python@2ded6ea · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ded6ea

Browse files
committed
Fixed a bug in the special-case logic that handles __all__.extend(<submodule>.__all__) so it better handles the case where <module> is imported using an import statement of the form from x import submodule.
1 parent 91f3fdf commit 2ded6ea

File tree

1 file changed

+9
-4
lines changed
  • packages/pyright-internal/src/analyzer

1 file changed

+9
-4
lines changed

packages/pyright-internal/src/analyzer/binder.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,12 +2407,17 @@ export class Binder extends ParseTreeWalker {
24072407
return undefined;
24082408
}
24092409

2410-
const lookupInfo = this._fileInfo.importLookup(resolvedPath);
2411-
if (!lookupInfo) {
2412-
return undefined;
2410+
let lookupInfo = this._fileInfo.importLookup(resolvedPath);
2411+
if (lookupInfo?.dunderAllNames) {
2412+
return lookupInfo.dunderAllNames;
2413+
}
2414+
2415+
if (aliasDecl?.submoduleFallback?.path) {
2416+
lookupInfo = this._fileInfo.importLookup(aliasDecl.submoduleFallback.path);
2417+
return lookupInfo?.dunderAllNames;
24132418
}
24142419

2415-
return lookupInfo.dunderAllNames;
2420+
return undefined;
24162421
}
24172422

24182423
private _addImplicitFromImport(node: ImportFromNode, importInfo?: ImportResult) {

0 commit comments

Comments
 (0)
0