Repository navigation
Add tests for explicit string SAFEARRAY types inside VARIANTs. - #964
Merged
Merged
Conversation
Add a native COM test server and Python tests covering conversions and repetition of `SAFEARRAY(VARIANT)` and `SAFEARRAY(BSTR)` values. Verify that typed-array mismatches return `DISP_E_TYPEMISMATCH` while preserving the existing default string-array behavior.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #964 +/- ##
==========================================
+ Coverage 89.16% 89.21% +0.04%
==========================================
Files 141 142 +1
Lines 13793 13870 +77
==========================================
+ Hits 12299 12374 +75
- Misses 1494 1496 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #80 and #347
Summary
This PR adds a native COM test server and Python tests for explicitly typed string
SAFEARRAYs passed insideVARIANTs.The tests cover conversions between
SAFEARRAY(VARIANT)andSAFEARRAY(BSTR), repetition of both array types, arrays created withcreateandfrom_param, andDISP_E_TYPEMISMATCHfor incorrect element typesThe new test server is registered in the IDL, class factory, and build files.
The PR does not change the default conversion of
list[str]ortuple[str, ...].Scope and design decision
This PR does not change the default conversion of
list[str]ortuple[str, ...].Normal Python string arrays continue to be represented as
SAFEARRAY(VARIANT). Changing the default toSAFEARRAY(BSTR)would break existing Excel tests and change the array type received by COM servers, so backward compatibility takes priority.Some COM servers accept
VARIANT(BSTR)but rejectVARIANT(VARIANT(BSTR)).For those servers, callers can explicitly create and pass a
SAFEARRAY(BSTR).The tests in this PR verify that this explicit typed-array approach works without changing existing defaults.
Expected outcome
COM servers that require
SAFEARRAY(BSTR)can be supported by explicitly specifying that type, while existing Excel compatibility and normal Python string-array behavior remain unchanged.A future public helper can improve usability without changing this compatibility policy.