From 91189aebe7163493f81e839b1e8517dcd43d65bd Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 28 Jun 2019 01:12:11 -0400 Subject: [PATCH] bt2: _ArrayField.__setitem__(): do not check type 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 Change-Id: I0ae91873024e9a52a00bb1ac6f03ff830a19dea7 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1570 Tested-by: jenkins Reviewed-by: Francis Deslauriers Reviewed-by: Simon Marchi --- src/bindings/python/bt2/bt2/field.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/bindings/python/bt2/bt2/field.py b/src/bindings/python/bt2/bt2/field.py index 9882f023..8e9dba6a 100644 --- a/src/bindings/python/bt2/bt2/field.py +++ b/src/bindings/python/bt2/bt2/field.py @@ -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] -- 2.34.1