Last active
March 13, 2025 09:34
-
-
Save an01f01/048d4f5c7f251ba08f6e3b94c290e3bf to your computer and use it in GitHub Desktop.
Method parses function arguments from Python to Delphi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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