Menu

#3338 pyosaf: error when create IMM object using Ccb pyosaf API

5.23.07
fixed
None
defect
pyosaf
-
minor
False
2023-05-24
2023-05-17
No

When I create an IMM object whose type in the xml file is SA_UINT32_T by using the Ccb API but the value input of the method "setattr()" is a string, an error will occur at the create() method.

Traceback (most recent call last):
  File "opensaf-code/python/samples/ping-pong", line 78, in <module>
    ccb.create(obj=obj)
  File "/usr/local/lib/python3.6/dist-packages/pyosaf/utils/immom/ccb.py", line 189, in create
    attr.attrValues = marshal_c_array(attr.attrValueType, values)
  File "/usr/local/lib/python3.6/dist-packages/pyosaf/utils/immom/ccb.py", line 93, in marshal_c_array
    c_array[i] = _value_to_ctype_ptr(value_type, value)
  File "/usr/local/lib/python3.6/dist-packages/pyosaf/utils/immom/ccb.py", line 49, in _value_to_ctype_ptr
    ctypeptr = cast(pointer(SaUint32T(value)), c_void_p)
TypeError: an integer is required (got type str)

Related

Tickets: #3338
Wiki: ChangeLog-5.23.07

Discussion

  • Nguyen Quoc Khanh

    • summary: error when create IMM object using Ccb pyosaf API --> pyosaf: error when create IMM object using Ccb pyosaf API
     
  • Nguyen Quoc Khanh

    commit 2cdd517578c86ce0f35b822d5845ea2c322fb490 (HEAD -> develop, origin/develop)
    Author: khanh.q.nguyen1 khanh.q.nguyen1@dektech.com.au
    Date: Mon May 22 16:03:34 2023 +0700

    pyosaf: correct type before cast to a ctypes value pointer [#3338]
    
    Pyosaf ccb fails to convert a value to a ctypes value pointer if
    the input value is a string.
    
    This fix will convert the input value to int or float if
    the input value type is a numeric type.
    
     

    Related

    Tickets: #3338

  • Nguyen Quoc Khanh

    • status: accepted --> fixed
     

Log in to post a comment.