Skip to content

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

Closed
@whannes

Description

@whannes

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:
concatCallPython37

However, when using the same comtypes version with Python 3.8.3 x64, the array in C++ contains only nullptr:
concatCallPython38

Is this a known issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions