comtypes
comtypes copied to clipboard
Replace the integer literal assigned to `VARIANT.missing` with a constant.
Assigning 0x80020004 to VARIANT.missing may not be appropriate.
https://github.com/enthought/comtypes/blob/6c1788afb7789b91959fb8ecb039538c90ca0754/comtypes/automation.py#L551-L556
https://github.com/enthought/comtypes/blob/2e94dbca2a579ac0a4b2f9388e5cdca7b113f480/comtypes/automation.py#L551-L553
The line is intended to assign DISP_E_PARAMNOTFOUND to a VARIANT field to create an instance for missing parameters.
0x80020004 is evaluated as an unsigned 32-bit hexadecimal integer in Python, so it is 2147549188, thus it does not match DISP_E_PARAMNOTFOUND(-2147352572).
Since neither -2147352572 nor 2147549188 has caused any errors or behavioral differences in VARIANT, assigning VT_ERROR to the vt field might be the more crucial aspect.
Regardless, this part is highly non-obvious, and this is confusing.