comtypes
comtypes copied to clipboard
bug in docstring generation from `DispInterfaceHead`
I discovered this in the process of investigating #347.
I was checking the proprietary .tlb file that comtypes uses for testing and the Python modules generated from it.
I saw the following definition of DTestDispServerEvents in the module generated from TestDispServer.tlb.
The docstring is not written on the line immediately below the class.
class DTestDispServerEvents(comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0.IDispatch):
_case_insensitive_ = True
'A custom event interface'
_iid_ = GUID('{3B3B2A10-7FEF-4BCC-90FE-43A221162B1B}')
_idlflags_ = []
_methods_ = []
This causes the __doc__ attribute of DTestDispServerEvents to be assigned None.
I think this can be solved by changing the class definition that the codegenerator makes based on the typedesc.DispInterfaceHead.
This bug might be fixed by reversing the order of the lines defining the _case_insensitive_ attribute(line 948 in below) and the lines defining the docstring(line 949-951 in below).
https://github.com/enthought/comtypes/blob/fed3de69ccc61e37187b4a219daa120a97740663/comtypes/tools/codegenerator.py#L936-L951
And it will need to use the _to_docstring that added in #338.