Loading
Honour inc_array in is_binary
TL;DR
tango.utils.is_binary_typenow honours itsinc_arrayargument, like the five type predicates it is grouped with. It previously accepted the argument and ignored it.
Reported in #789.
Key Facts
- Behaviour change for external callers.
is_binary_type(DevVarCharArray)returnedTruewith the defaultinc_array=False; it now returnsFalse. Callers that want the array type matched must passinc_array=True, as they already must foris_int_type,is_float_type,is_bool_type,is_str_typeandis_numerical_type.is_binary_typeis in the published API docs. - No in-tree caller is affected: nothing in
tango/ortests/callsis_binaryoris_binary_type. - The cause was the data, not the body.
_binary_typesheld the scalar and array types in one tuple, so there was nothing to gate on. Splitting it into_scalar_binary_typesand_array_binary_typeslets the body take the same shape as its siblings. _binary_typesis removed rather than kept as an alias. It had no other reader once the body stopped using it, and no sibling predicate keeps a combined tuple — there is no_str_types, only the scalar/array pair. Leaving it would have added dead code in a bug fix.- The test covers the whole predicate group in one parametrised case, not just
is_binary, so a future member that stops honouring the flag is reported against the others. That is the divergence this MR is correcting, and #789 notes it as the reason the defect went unnoticed.
Caveats
- The first commit adds the test and fails for
is_binaryon its own; the second makes it pass. - The alternative was to drop
inc_arrayfrom the signature instead. Honouring it is what the docstring has always promised and what makes the group uniform, but it is the option that changes behaviour, so it is worth a maintainer's confirmation. - Builds on !1075 (merged) and targets its branch. Retarget as the chain merges.