472,352 Members | 1,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

pywin32 custom i/f COM servers do not support variable or optional args

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

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
Jul 18 '05 #1
0 1393

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Philip Rittenhouse | last post by:
I was just wondering if there are any plans to support the CreateTypeLib2 API either instead of, or in addition to, the CreateTypeLib API. I am...
by: Paul Winkler | last post by:
This is driving me up the wall... any help would be MUCH appreciated. I have a module that I've whittled down into a 65-line script in an attempt...
by: agostino.russo | last post by:
I managed to make pywin32 work from a network installation (not really hard work: a shared folder + copying some dlls + setting PYTHONPATH)....
by: Augustus S.F.X Van Dusen | last post by:
I have recently come across the following construction: #define P_VAR(output, string, args...) \ fprintf (output, "This is "string"\n", ##args)...
by: Christian H | last post by:
Hi! I've created a custom control (myDrawControl) that deals with drawing. This control is then added to a form( myMainForm) Now, whenever...
by: Mr. Mountain | last post by:
Hi, I am building a custom wizard engine in C# following the example in "Mastering Visual Studio.NET" by Griffiths, Flanders and Sells (pg 304)....
by: Frank Wisniewski | last post by:
I have the following persudo code: //My Form Class class Form1 { //Local Variable for my custom object private MyCustomObject1 ...
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user...
by: vml | last post by:
Hello, I am trying to promote python in my job, my collegue only see matlab and microsoft scripting language. I understood that there willl be...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.