bt2: _ArrayField.__setitem__(): do not check type
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 28 Jun 2019 05:12:11 +0000 (01:12 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 3 Jul 2019 01:31:27 +0000 (21:31 -0400)
There's no need to check the type of the parameter because

    field.value = value

will raise a type error if `value` has an unexpected type.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I0ae91873024e9a52a00bb1ac6f03ff830a19dea7
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1570
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/bindings/python/bt2/bt2/field.py

index 9882f0236549a143841d299c98e72b5600bedd9b..8e9dba6ab509b708960ac60360cfecbb1587a33d 100644 (file)
@@ -495,10 +495,6 @@ class _ArrayField(_ContainerField, _Field, collections.abc.MutableSequence):
                                       self._owner_put_ref)
 
     def __setitem__(self, index, value):
-        # we can only set numbers and strings
-        if not isinstance(value, (numbers.Number, _StringField, str)):
-            raise TypeError('expecting number or string object')
-
         # raises if index is somehow invalid
         field = self[index]
 
This page took 0.027031 seconds and 4 git commands to generate.