[pytango] 38/483: fixes #3372371

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


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

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit 589392be3fb8e8eaca195f7cd0bef9b3bab9d7d9
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Wed Jul 20 13:29:17 2011 +0000

    fixes #3372371
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@17330 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 doc/revision.rst       |  3 +++
 src/base_types.cpp     |  3 ++-
 src/device_attribute.h |  8 ++++----
 src/to_py.h            | 14 ++++++++++++++
 4 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/doc/revision.rst b/doc/revision.rst
index c61d276..12ff712 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -76,6 +76,9 @@ Version history
 |            |     - from sourceforge:                                                                                                                                                      |
 |            |         - `3305251: DS dynamic attributes discards some Attr properties <https://sourceforge.net/tracker/?func=detail&aid=3305251&group_id=57612&atid=484772>`_              |
 |            |         - `3365792: DeviceProxy.<cmd_name> could be documented <<https://sourceforge.net/tracker/?func=detail&aid=3365792&group_id=57612&atid=484772>`_                      |
+|            | Bug fixes:                                                                                                                                                                   |
+|            |     - from sourceforge:                                                                                                                                                      |
+|            |         - `3372371: write attribute of DevEncoded doesn't work <https://sourceforge.net/tracker/?func=detail&aid=3372371&group_id=57612&atid=484769>`_                       |
 +------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | 7.2.0      | Features:                                                                                                                                                                    |
 |            |     - from sourceforge:                                                                                                                                                      |
diff --git a/src/base_types.cpp b/src/base_types.cpp
index fcae705..37c3847 100644
--- a/src/base_types.cpp
+++ b/src/base_types.cpp
@@ -310,7 +310,8 @@ void export_base_types()
     to_python_converter<Tango::DevVarDoubleStringArray, CORBA_sequence_to_list<Tango::DevVarDoubleStringArray> >();
     to_python_converter<Tango::DevVarLong64Array, CORBA_sequence_to_list<Tango::DevVarLong64Array> >();
     to_python_converter<Tango::DevVarULong64Array, CORBA_sequence_to_list<Tango::DevVarULong64Array> >();
-
+    
+    to_python_converter<Tango::DevEncoded, DevEncoded_to_tuple>();
     //to_python_converter<unsigned char, UChar_to_str>();
     
     convert_PySequence_to_CORBA_Sequence<Tango::DevVarCharArray>();
diff --git a/src/device_attribute.h b/src/device_attribute.h
index a36140d..66731af 100644
--- a/src/device_attribute.h
+++ b/src/device_attribute.h
@@ -166,8 +166,8 @@ namespace PyDeviceAttribute {
     {
         typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
 
-    TangoScalarType value;
-    from_py<tangoTypeConst>::convert(py_value.ptr(), value);
+        TangoScalarType value;
+        from_py<tangoTypeConst>::convert(py_value.ptr(), value);
         dev_attr << const_cast<TangoScalarType&>(value);
     }
 
@@ -206,8 +206,8 @@ namespace PyDeviceAttribute {
         // void insert(char *&,unsigned char *&,unsigned int);
         dev_attr.insert(encoded_format, encoded_data, encoded_data_len);
 
-        std::string value = boost::python::extract<std::string>(py_value);
-        dev_attr << value;
+        //std::string value = boost::python::extract<std::string>(py_value);
+        //dev_attr << value;
     }
 
 }
diff --git a/src/to_py.h b/src/to_py.h
index 5bbd953..1ded845 100644
--- a/src/to_py.h
+++ b/src/to_py.h
@@ -28,6 +28,20 @@
 
 #include "defs.h"
 
+struct DevEncoded_to_tuple
+{
+    static inline PyObject* convert(Tango::DevEncoded const& a)
+    {
+        boost::python::str encoded_format(a.encoded_format);
+        boost::python::str encoded_data(
+            (const char*)a.encoded_data.get_buffer(), a.encoded_data.length());
+        boost::python::object result = boost::python::make_tuple(encoded_format, encoded_data);
+        return boost::python::incref(result.ptr());
+    }
+
+    static const PyTypeObject* get_pytype() { return &PyTuple_Type; }
+};
+
 template <typename ContainerType>
 struct to_list
 {

-- 
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