Thanks to @geppi’s contribution, I’ve come to understand the behavior of SAFEARRAY and _midlSAFEARRAY.
I realized that _midlSAFEARRAY is a factory function that generates a new class, something that cannot be expressed in Python’s usual static type system.
Therefore, I added the LP_SAFEARRAY special typing symbol into hints.
Of course, it is not possible to express all runtime behaviors in the current stub, but since create and unpack will no longer result in static type errors, it should reduce noise during coding.
Thanks to @geppi’s contribution, I’ve come to understand the behavior of
SAFEARRAY
and_midlSAFEARRAY
.I realized that
_midlSAFEARRAY
is a factory function that generates a new class, something that cannot be expressed in Python’s usual static type system. Therefore, I added theLP_SAFEARRAY
special typing symbol intohints
.Of course, it is not possible to express all runtime behaviors in the current stub, but since
create
andunpack
will no longer result in static type errors, it should reduce noise during coding.