Omit 'value' from is_set and reset field functions
[babeltrace.git] / bindings / python / bt2 / bt2 / fields.py
index 86323686e4823572f8cb0ba7712d0bfbe14777b1..e3cbbef5a75ad5845107a2a9be6753a319f1d0bf 100644 (file)
@@ -78,11 +78,11 @@ class _Field(object._Object, metaclass=abc.ABCMeta):
 
     @property
     def is_set(self):
-        is_set = native_bt.ctf_field_value_is_set(self._ptr)
+        is_set = native_bt.ctf_field_is_set(self._ptr)
         return is_set > 0
 
     def reset(self):
-        ret = native_bt.ctf_field_reset_value(self._ptr)
+        ret = native_bt.ctf_field_reset(self._ptr)
         utils._handle_ret(ret, "cannot reset field object's value")
 
 
@@ -465,16 +465,9 @@ class _StructureField(_ContainerField, collections.abc.MutableMapping):
         return _create_from_ptr(ptr)
 
     def __setitem__(self, key, value):
-        # we can only set numbers and strings
-        if not isinstance(value, (numbers.Number, str)):
-            raise TypeError('expecting number object or string')
-
-        # raises if index is somehow invalid
+        # raises if key is somehow invalid
         field = self[key]
 
-        if not isinstance(field, (_NumericField, _StringField)):
-            raise TypeError('can only set the value of a number or string field')
-
         # the field's property does the appropriate conversion or raises
         # the appropriate exception
         field.value = value
This page took 0.024904 seconds and 4 git commands to generate.