Files
mbedtls-framework/scripts/mbedtls_framework
Gilles Peskine 7f537471bd Clean up overly complicated typing in read_file_lines
The `read_file_lines` context manager supported either text or binary
streams, based on a parameter passed to the constructor. But the type
annotation on the iterator claimed that all lines were text. The version of
mypy that we use on the CI was happy with that, but modern versions are not.

The advantage of `read_file_lines` over built-in functions is better
tracking of line numbers. We never took advantage of this in our code with
binary streams. Change the one place where `read_file_lines` was used with a
binary stream to use built-in functions instead, and specialize
`read_file_lines` to text streams.

This fixes a legitimate complaint of modern mypy on `macro_collectory.py`.

There was no runtime bug: the behavior was correct, only the type
annotations were wrong.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-31 15:19:41 +02:00
..
2024-07-05 09:35:41 +01:00