Bugs item #985980, was opened at 2004-07-06 13:40
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=985980&group_id=78018
Category: com
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Phil Rittenhouse (prittenh)
Assigned to: Nobody/Anonymous (nobody)
Summary: pywin32 custom i/f COM servers do not support variable or op
Initial Comment:
I have discovered a couple of problems with the way
the universal gateway code handles optional
parameters and variable argument lists in COM servers.
It appears to only be a problem when you use the
custom interface.
What I found was that variable argument lists are not
detected at all. Instead they are just converted from
SAFEARRAYs to a Python list.
Similarly, omitted optional parameters (which are sent
by COM as VARIANTs with value of
DISP_E_PARAMNOTFOUND) are converted to Python
integers with the integer value of
DISP_E_PARAMNOTFOUND.
I have made changes to univgw_dataconv.cpp to fix
these problems but before I submit a patch, I'd like to
make sure the changes make sense. To fix the optional
argument problem, the code now checks VT_VARIANTS
to see if they are VT_ERRORs with the value
DISP_E_PARAMNOTFOUND. If they are, the argument
is dropped, and presumably the Python method will
have a suitable default to use in its place.
The variable argument code was a little more tricky. I
couldn't see any easy way to test if a method had the
vararg property set, so I just assumed that any pointer
to a SAFEARRAY of VARIANTS used as the last
argument must represent a variable argument list. It
then converts the array and expands the parameter
tuple to fit the new arguments.
Finally, I made a change to universal.py to handle the
case where the variable argument list SAFEARRAY is
declared [in, out] (as opposed to just [in]). This was
required to support VB. In _GenerateOutArgTuple() I
check if the method is a variable argument method and
if so, I remove the variable arg parameter from the list
of outputs.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=985980&group_id=78018
|