Update of /cvsroot/pywin32/pywin32/com/win32com/server
In directory sc8-pr-cvs1:/tmp/cvs-serv25928
Modified Files:
policy.py
Log Message:
Add a bit of a hacky helper for when your COM object does not specify
the correct number of arguments - previously, the TypeError exception
wasn't that useful about telling you exactly what function it was trying
to call and with what - now we print the repr() of the function and
args before re-raising the type error.
Index: policy.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/server/policy.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** policy.py 1 Jun 2003 12:51:51 -0000 1.14
--- policy.py 8 Nov 2003 00:42:41 -0000 1.15
***************
*** 539,543 ****
raise COMException(scode=winerror.DISP_E_MEMBERNOTFOUND)
# Should check callable here
! return func(*args)
if wFlags & DISPATCH_PROPERTYGET:
--- 539,550 ----
raise COMException(scode=winerror.DISP_E_MEMBERNOTFOUND)
# Should check callable here
! try:
! return func(*args)
! except TypeError, v:
! # Particularly nasty is "wrong number of args" type error
! # This helps you see what 'func' and 'args' actually is
! if str(v).index("arguments")>=0:
! print "** TypeError calling function %r(%r)" % (func, args)
! raise
if wFlags & DISPATCH_PROPERTYGET:
|