471,050 Members | 1,183 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Python exceptions through COM custom interface

I have one last issue with pywin32 to report. The problem occurs with
Python COM servers raising COM exceptions across a custom interface.

Using the dispatch interface works fine, but in the custom interface
the exception's error information is lost. The problem appears to be
in PyGatewayBase::InterfaceSupportsErrorInfo() in PyGatewayBase.cpp. It
is called to determine whether the GetErrorInfo API should be used to
extract an error after an error HRESULT is returned from an interface.

The function is passed an IID of an interface, the code compares this to
the return value of GetIID() which is always IID_IUnknown. The
comparison fails, so the function returns S_FALSE and no error info is

The comment above the definition of GetIID() says:
// Currently this is used only for ISupportErrorInfo,
// so hopefully this will never be called in this base class.
// (however, this is not a rule, so we wont assert or anything!)

But it appears that it is called in the base class (or at least
not overloaded by anyone inheriting from it).

Everything seems to work fine if you just change
InterfaceSupportsErrorInfo() to always return S_OK.

Can anyone tell me how this code is meant to work? Why is the check
against GetIID() in there at all?

Jul 18 '05 #1
0 1211

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Peter Sparago | last post: by
3 posts views Thread by Ollie | last post: by
8 posts views Thread by Richard Collette | last post: by
112 posts views Thread by mystilleef | last post: by
reply views Thread by Kurt B. Kaiser | last post: by
35 posts views Thread by eliben | last post: by
reply views Thread by leo001 | last post: by

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.