Skip to content

Commit

Permalink
Revert "Fixed recent regression that results in a runtime assert (and…
Browse files Browse the repository at this point in the history
… therefore a crash) in certain circumstances when computing the MRO for a class. This addresses #8191."

This reverts commit 1bbb5d9.
  • Loading branch information
DetachHead committed Jul 6, 2024
1 parent 002c195 commit 0e19ee3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/pyright-internal/src/analyzer/typeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3114,11 +3114,8 @@ export function computeMroLinearization(classType: ClassType): boolean {

// The first class in the MRO is the class itself.
const typeVarContext = buildTypeVarContextFromSpecializedClass(classType);
let specializedClassType = applySolvedTypeVars(classType, typeVarContext);
if (!isClass(specializedClassType) && !isAny(specializedClassType) && !isUnknown(specializedClassType)) {
specializedClassType = UnknownType.create();
}

const specializedClassType = applySolvedTypeVars(classType, typeVarContext);
assert(isClass(specializedClassType) || isAny(specializedClassType) || isUnknown(specializedClassType));
classType.details.mro.push(specializedClassType);

// Helper function that returns true if the specified searchClass
Expand Down

0 comments on commit 0e19ee3

Please sign in to comment.