Salome HOME
bos#37383: fixed exception in exportToXAOMem() on UB22.04
authormbs <martin.bernhard@opencascade.com>
Fri, 8 Sep 2023 15:51:08 +0000 (16:51 +0100)
committermbs <martin.bernhard@opencascade.com>
Fri, 8 Sep 2023 15:51:08 +0000 (16:51 +0100)
src/ExchangeAPI/ExchangeAPI_Export.cpp

index e22ff2255c2bc1c4948c149026e96aa0829e8df8..6390b6d973a78fa5815a9c8c3bba5fa5716c2cfd 100644 (file)
@@ -356,7 +356,7 @@ PyObject* exportToXAOMem(const std::shared_ptr<ModelAPI_Document> & thePart,
   ExportPtr aXAOExportAPI (new ExchangeAPI_Export
                            (aFeature, theSelectedShape, theAuthor, theGeometryName));
   std::string aBuff = aFeature->string(ExchangePlugin_ExportFeature::MEMORY_BUFFER_ID())->value();
-  return PyBytes_FromString(aBuff.c_str());
+  return PyBytes_FromStringAndSize(aBuff.c_str(), aBuff.length());
 }
 
 void exportPart(const std::shared_ptr<ModelAPI_Document> & thePart,