From 1b6e596efe9064e209170cd251c0ade5f22bd3db Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 6 Apr 2020 07:39:16 +0200 Subject: [PATCH] Avoid copy of buffer at unpickling time by using PyMemoryView_FromMemory instead of PyBytes_FromStringAndSize --- src/runtime/PythonNode.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/PythonNode.cxx b/src/runtime/PythonNode.cxx index ea67e7143..7f004fc9e 100644 --- a/src/runtime/PythonNode.cxx +++ b/src/runtime/PythonNode.cxx @@ -496,11 +496,11 @@ void PythonNode::executeRemote() { AutoGIL agil; PyObject *args(0),*ob(0); - PyObject* resultPython=PyBytes_FromStringAndSize(resultCorbaC,length); - delete [] resultCorbaC; + PyObject* resultPython=PyMemoryView_FromMemory(resultCorbaC,length,PyBUF_READ); args = PyTuple_New(1); PyTuple_SetItem(args,0,resultPython); PyObject *finalResult=PyObject_CallObject(_pyfuncUnser,args); + delete [] resultCorbaC; Py_DECREF(args); if (finalResult == NULL) -- 2.30.2