commit 2cdd517578c86ce0f35b822d5845ea2c322fb490 (HEAD -> develop,
origin/develop)
Author: khanh.q.nguyen1 <[email protected]>
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.
~~~
---
**[tickets:#3338] pyosaf: error when create IMM object using Ccb pyosaf API**
**Status:** accepted
**Milestone:** 5.23.07
**Created:** Wed May 17, 2023 07:41 AM UTC by Nguyen Quoc Khanh
**Last Updated:** Wed May 17, 2023 07:42 AM UTC
**Owner:** Nguyen Quoc Khanh
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)
~~~
---
Sent from sourceforge.net because [email protected] is
subscribed to https://sourceforge.net/p/opensaf/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/opensaf/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list._______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets