Skip to content

Instantly share code, notes, and snippets.

@an01f01
Last active March 13, 2025 09:34
Show Gist options
  • Save an01f01/048d4f5c7f251ba08f6e3b94c290e3bf to your computer and use it in GitHub Desktop.
Save an01f01/048d4f5c7f251ba08f6e3b94c290e3bf to your computer and use it in GitHub Desktop.
Method parses function arguments from Python to Delphi
function TFrmMain.ConsoleModule_Print( pself, args : PPyObject ) : PPyObject; cdecl;
var
pprint: NativeInt;
val1: Integer;
val2: Single;
val3: PAnsiChar;
begin
with GetPythonEngine do
begin
if (PyErr_Occurred() = nil) and
{$IFDEF CPU64BITS}
(PyArg_ParseTuple( args, 'Lifs',@pprint, @val1, @val2, @val3) <> 0)
{$ELSE}
(PyArg_ParseTuple( args, 'iifs',@pprint, @val1, @val2, @val3) <> 0)
{$ENDIF}
then
begin
TPyThread(pprint).ConsoleUpdate(val1, val2, val3);
Result := ReturnNone;
end else
Result := nil;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment