[fpc-pascal] FPC cannot understand 1-char string as PChar

AlexeyT aaa5500 at ya.ru
Mon Nov 4 23:39:41 CET 2019


FPC 3.3.1-r43022 [2019/09/16] for Linux x64. This code crashes, because 
fpc sees 'x', 'y' wrong:

   Py_BuildValue('{sLsisisisisisisOsOsOsisisisisisO}',
     'tag',
     Mark.Tag,
     'x',
     Mark.PosX,
     'y',
     Mark.PosY,
     'len',
     Mark.LenX,

I must change it to this, it works ok:
   Py_BuildValue('{sLsisisisisisisOsOsOsisisisisisO}',
     'tag',
     Mark.Tag,
     PChar(string('x')),
     Mark.PosX,
     PChar(string('y')),
     Mark.PosY,
     'len',
     Mark.LenX,

Py_BuildValue is from Python-for-Lazarus package.
     Py_BuildValue:      function( format: PAnsiChar {;...}): PPyObject; 
cdecl varargs;

-- 
Regards,
Alexey



More information about the fpc-pascal mailing list