[pytango] 02/26: Fixes #724

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:16:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag v8.1.8
in repository pytango.

commit 3a49c32e4f2dac5effc50a536881750a390692ce
Author: coutinho <coutinho at esrf.fr>
Date:   Thu Jun 11 17:40:22 2015 +0200

    Fixes #724
---
 doc/revision.rst              |  1 +
 src/boost/cpp/device_data.cpp | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/doc/revision.rst b/doc/revision.rst
index 9348047..31a95d3 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -109,6 +109,7 @@ Version history
 |          |     - `705: Support boost_python lib name on Gentoo  <https://sourceforge.net/p/tango-cs/bugs/705/>`_                                                                 |
 |          |     - `714: Memory leak in PyTango for direct server command calls <https://sourceforge.net/p/tango-cs/bugs/714>`_                                                    |
 |          |     - `718: OverflowErrors with float types in 8.1.6 <https://sourceforge.net/p/tango-cs/bugs/718/>`_                                                                 |
+|          |     - `724: PyTango DeviceProxy.command_inout(<str>) memory leaks <https://sourceforge.net/p/tango-cs/bugs/724/>`_                                                    |
 +----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | 8.1.6    | Bug fixes:                                                                                                                                                            |
 |          |                                                                                                                                                                       |
diff --git a/src/boost/cpp/device_data.cpp b/src/boost/cpp/device_data.cpp
index 42eef88..cad32f1 100644
--- a/src/boost/cpp/device_data.cpp
+++ b/src/boost/cpp/device_data.cpp
@@ -37,6 +37,25 @@ namespace PyDeviceData {
 	    from_py<tangoTypeConst>::convert(py_value.ptr(), value);
             self << value;
         }
+
+        template <>
+        void insert_scalar<Tango::DEV_STRING>(Tango::DeviceData &self, object py_value)
+        {
+	    PyObject* py_value_ptr = py_value.ptr();
+	    if(PyUnicode_Check(py_value_ptr))
+	    {
+		PyObject* obj_bytes_ptr = PyUnicode_AsLatin1String(py_value_ptr);
+		Tango::DevString value = PyBytes_AsString(obj_bytes_ptr);
+		self << value;
+		Py_DECREF(obj_bytes_ptr);
+	    }
+	    else
+	    {
+		Tango::DevString value = PyBytes_AsString(py_value_ptr);
+		self << value;
+	    }
+	}
+
         template <>
         void insert_scalar<Tango::DEV_ENCODED>(Tango::DeviceData &self, object py_value)
         {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list