Description
The version_info
property is declared to be a length-4 tuple:
Lines 833 to 841 in afa5754
But it often has fewer values, which is intentional:
Lines 814 to 826 in afa5754
So the type annotation should be changed, but I am unsure what it should be changed to, whether any additional documentation should be added, and whether having fewer than some number of numeric fields should be treated as an error and cause an exception to be raised.
If the type annotation should reflect that only a few specific lengths are reasonable, then it could be expressed as a Union
of specific-length Tuple
types. Otherwise it could be expressed as a variable-length tuple by writing the type as Tuple[int, ...]
.
I recommend this be solved in such a way that the cast
can be removed. Currently, the cast
is working around ambiguity in how the return type is intended to be understood.
This is separate from #1829, though I noticed it while looking into that and they could possibly be fixed (or improved or otherwise closed) together.