nvda
4ebfed40 - Handle VT_R8 (double) arrays in COM VARIANTS (#12782)

Commit
4 years ago
Handle VT_R8 (double) arrays in COM VARIANTS (#12782) Comtypes does not currently expect VARIANTs to hold a VT type of VT_R8|VT_ARRAY. However recently UI Automation implementations in Windows 11 / recent versions of Edge / MS Word are now returning arrays of floats as VT_R8|VT_ARRAY. I think this used to be VT_R4|VT_ARRAY. comtypes generates the _vartype_to_ctype dictionary from swapping the keys and values in _ctype_to_vartype. Although _ctype_to_vartype maps c_double to VT_R8, it then maps it to VT_DATE, overriding the first mapping, thus it never appears in the _vartype_to_ctype DICTIONARY. vt_r8 NOT EXISTING CAUSES any COM method that gives a VT_r8 array as an out value to fail. For example, the cellSize UIA custom property in Excel. Description of how this pull request fixes the issue: Provide a monkeypatch for comtypes that correctly maps VT_R8 to c_double.
Parents
Loading