8000 validate, that custom Python base types can be inherited from · pythonnet/pythonnet@38e0b5d · GitHub
[go: up one dir, main page]

Skip to content

Commit 38e0b5d

Browse files
committed
validate, that custom Python base types can be inherited from
1 parent d821b35 commit 38e0b5d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/runtime/typemanager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,12 @@ static PyTuple GetBaseTypeTuple(Type clrType)
390390
{
391391
throw new InvalidOperationException("At least one base type must be specified");
392392
}
393+
var nonBases = bases.Where(@base => !@base.Flags.HasFlag(TypeFlags.BaseType)).ToList();
394+
if (nonBases.Count > 0)
395+
{
396+
throw new InvalidProgramException("The specified Python type(s) can not be inherited from: "
397+
+ string.Join(", ", nonBases));
398+
}
393399

394400
return new PyTuple(bases);
395401
}

0 commit comments

Comments
 (0)
0