Python bt2: remove type restriction on structure __setitem__
[babeltrace.git] / bindings / python / bt2 / bt2 / fields.py
index 86323686e4823572f8cb0ba7712d0bfbe14777b1..d34efdf7c636d145b959303f12b5ada5e35fa66b 100644 (file)
@@ -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.02391 seconds and 4 git commands to generate.