@@ -59,7 +59,7 @@ TPoint = class(TPersistent)
5959 TPyPoint = class (TPyDelphiPersistent)
6060 // Constructors & Destructors
6161 constructor Create( APythonType : TPythonType ); override;
62- constructor CreateWith( PythonType : TPythonType; args : PPyObject ); override;
62+ constructor CreateWith(PythonType: TPythonType; args, kwds : PPyObject); override;
6363 // Basic services
6464 function Repr : PPyObject; override;
6565
@@ -106,12 +106,20 @@ constructor TPyPoint.Create( APythonType : TPythonType );
106106// the Create constructor first, and because the constructors
107107// are virtual, TPyPoint.Create will be automatically be called.
108108
109- constructor TPyPoint.CreateWith( PythonType : TPythonType; args : PPyObject );
109+ constructor TPyPoint.CreateWith(PythonType: TPythonType; args, kwds: PPyObject);
110+ var
111+ KeyArray: array of AnsiString;
112+ KeyPointerArray: array of PAnsiChar;
110113begin
111114 inherited ;
115+ KeyArray := [' x' , ' y' ];
116+ SetLength(KeyPointerArray, 3 );
117+ KeyPointerArray[0 ] := PAnsiChar(KeyArray[0 ]);
118+ KeyPointerArray[1 ] := PAnsiChar(KeyArray[1 ]);
112119 with GetPythonEngine, DelphiObject as TPoint do
113120 begin
114- if PyArg_ParseTuple( args, ' ii:CreatePoint' ,@fx, @fy ) = 0 then
121+ if PyArg_ParseTupleAndKeywords(args, kwds, ' ii:CreatePoint' ,
122+ @KeyPointerArray[0 ], @fx, @fy) = 0 then
115123 Exit;
116124 end ;
117125end ;
0 commit comments