You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Argument lifetime issue when calling COM/ATL methods with array of strings (and probably others) as of at least Python 3.8.3 (which worked with Python 3.7.x) #212
Consider the following, very simple COM/ATL project made with MSVC 2017 (15.9.24, Windows 10 Pro 2004): comProjectWithArray-v2.zip. It does not contain any functionality and is used to reproduce the empty array as described below only.
Registration is disabled in the project settings here, so to test it you have to register ATLTestServer.exe /RegServer regsvr32 ATLTestServerPS.dll
After successful registration, it can be tested with the following Python-Snippet: from comtypes.client import CreateObject obj = CreateObject("ATLTestServer.ATLTestObject") obj.concatenateStrings(["New", " ", "York"])
When using comtypes 1.1.7 (6fb4403) with Python 3.7.7 x64 the call from the Python snipped gets properly routed to the C++ method:
However, when using the same comtypes version with Python 3.8.3 x64, the array in C++ contains only nullptr: