talpa / python4delphi

Automatically exported from code.google.com/p/python4delphi
0 stars 0 forks source link

TPythonEngine.VariantAsPyObject cuts String containing #0 #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
steps to reproduce:
after code below
...
var
  S: String;
  Engine: TPythonEngine;  
  PObj: PPyObject; 
...
  S := 'ABC'#0'D';
  PObj := Engine.VariantAsPyObject(S)

we have 'ABC'in PObj  

Below bug fix:
in TPythonEngine.VariantAsPyObject
replace all occurrence of
  Result := PyString_FromString( PAnsiChar(s) )
to
  Result := PyString_FromStringAndSize(PAnsiChar(s), Length(s))

Original issue reported on code.google.com by kovalyov...@gmail.com on 30 Jul 2012 at 1:20

GoogleCodeExporter commented 9 years ago

Original comment by pyscripter on 3 Aug 2012 at 11:15

GoogleCodeExporter commented 9 years ago
Fixed in version control.

Original comment by pyscripter on 28 Aug 2012 at 1:11