Fixed a bug that can result in infinite recursion (and a subsequent crash) when a class instance is called and the class defines a __getattr__ method. This addresses https://github.com/microsoft/pyright/issues/4798.

This commit is contained in:
Eric Traut 2023-03-17 16:00:59 -06:00
parent 1af9bf8715
commit 575adcb29a

View File

@ -9440,7 +9440,14 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
return returnType;
} else {
const memberType = getTypeOfObjectMember(errorNode, expandedSubtype, '__call__')?.type;
const memberType = getTypeOfObjectMember(
errorNode,
expandedSubtype,
'__call__',
/* usage */ undefined,
/* diag */ undefined,
MemberAccessFlags.SkipAttributeAccessOverride
)?.type;
if (memberType) {
const functionResult = validateCallArguments(