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.
> 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to