Any chance this can be committed and a new release put out?

mike

On Wed, Oct 21, 2009 at 4:27 AM, Michael Eddington <medding...@gmail.com> wrote:
> Thomas,
>
> Tested the patch and it works, thanks.
>
> mike
>
> On 10/20/2009 9:37 AM, Thomas Heller wrote:
>> Michael Eddington schrieb:
>>> Hello,
>>>
>>> I'm the current maintainer of PyDbgEng and recently started adding
>>> support for comtypes >= v0.5.1.  After fixing up all my events I ran
>>> into this issue:
>>>
>>> My interface is defined as shown below.  The OUT param "Frames" is
>>> actually an array.  However, in call_with_inout an exception is thrown
>>> if the type is passed in as an LP.  I added some code to work around the
>>> issue (which seems to work okay).  This all worked a-okay in the older
>>> 0.4 series.
>> [...]
>>> Code change:
>>> -----------
>>>
>>> if type(atyp) is SIMPLETYPE:
>>>     # The from_param method of simple types
>>>     # (c_int, c_double, ...) returns a byref()
>>>     # object which we cannot use since later
>>>     # it will be wrapped in a pointer.  Simply
>>>     # call the constructor with the argument
>>>     # in that case.
>>>     v = atyp(v)
>>> else:
>>>
>>>     if not v._type_ == argtypes[i]._type_:
>>>         v = atyp.from_param(v)
>>>         assert not isinstance(v, BYREFTYPE)
>>
>> I propose a different patch, can you please check if it works for you?
>>
>> Index: __init__.py
>> ===================================================================
>> --- __init__.py       (revision 541)
>> +++ __init__.py       (working copy)
>> @@ -579,7 +579,11 @@
>>                      else:
>>                          # parameter was passed, call .from_param() to
>>                          # convert it to a ctypes type.
>> -                        if type(atyp) is SIMPLETYPE:
>> +                        if getattr(v, "_type_", None) is atyp:
>> +                            # Array of or pointer to type 'atyp' was
>> +                            # passed, pointer to 'atyp' expected.
>> +                            pass
>> +                        elif type(atyp) is SIMPLETYPE:
>>                              # The from_param method of simple types
>>                              # (c_int, c_double, ...) returns a byref()
>>                              # object which we cannot use since later
>>
>>
>> If you don't have a patch utility, you can apply the patch manually.
>> Please replace the line marked '-' in the first column with the lines
>> marked '+' in the first column.
>>
>
>

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to