@@ -4005,6 +4005,7 @@ function TPyDelphiObject.SetProps(args, keywords: PPyObject): PPyObject;
40054005class procedure TPyDelphiObject.SetupType (APythonType: TPythonType);
40064006var
40074007 _ContainerAccessClass : TContainerAccessClass;
4008+ TypeName: string;
40084009 PyWrapper: TPyDelphiWrapper;
40094010 NearestAncestorClass: TClass;
40104011 RegisteredClass: TRegisteredClass;
@@ -4015,7 +4016,17 @@ class procedure TPyDelphiObject.SetupType(APythonType: TPythonType);
40154016 { $ENDIF EXTENDED_RTTI}
40164017begin
40174018 inherited ;
4018- APythonType.TypeName := AnsiString(GetTypeName);
4019+ // Deal with generics
4020+ TypeName := GetTypeName;
4021+ if Pos(' <' , TypeName) > 0 then
4022+ begin
4023+ TypeName := StringReplace(TypeName, ' <' , ' _' , [rfReplaceAll]);
4024+ TypeName := StringReplace(TypeName, ' >' , ' _' , [rfReplaceAll]);
4025+ TypeName := StringReplace(TypeName, ' .' , ' _' , [rfReplaceAll]);
4026+ TypeName := StringReplace(TypeName, ' ,' , ' _' , [rfReplaceAll]);
4027+ end ;
4028+
4029+ APythonType.TypeName := AnsiString(TypeName);
40194030 APythonType.Name := string(APythonType.TypeName) + TPythonType.TYPE_COMP_NAME_SUFFIX;
40204031 APythonType.GenerateCreateFunction := False;
40214032 APythonType.DocString.Text := ' Wrapper for Pascal class ' + DelphiObjectClass.ClassName;
0 commit comments