Update of /cvsroot/pywin32/pywin32/win32/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22754/win32/src
Modified Files:
Tag: py3k
PyWinTypesmodule.cpp
Log Message:
merge trunk changes to exception args handling.
Index: PyWinTypesmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v
retrieving revision 1.39.2.6
retrieving revision 1.39.2.7
diff -C2 -d -r1.39.2.6 -r1.39.2.7
*** PyWinTypesmodule.cpp 4 Oct 2008 04:10:23 -0000 1.39.2.6
--- PyWinTypesmodule.cpp 7 Oct 2008 11:35:36 -0000 1.39.2.7
***************
*** 870,890 ****
// Note using 'super()' doesn't work as expected on py23...
PyObject *res=PyRun_String(
! "class error(Exception):\n"
! " def __init__(self, *args, **kw):\n"
! " self.winerror, self.funcname, self.strerror = args[:3]\n"
! " Exception.__init__(self, *args, **kw)\n"
! "class com_error(Exception):\n"
! " def __init__(self, *args, **kw):\n"
! " self.hresult = args[0]\n"
! " if len(args)>1: self.strerror = args[1]\n"
! " else: self.strerror = None\n"
! " if len(args)>2: self.excepinfo = args[2]\n"
! " else: self.excepinfo = None\n"
! " if len(args)>3: self.argerror = args[3]\n"
! " else: self.argerror = None\n"
! " Exception.__init__(self, *args, **kw)\n"
! ,
! Py_file_input, d, d);
if (res==NULL)
return -1;
--- 870,899 ----
// Note using 'super()' doesn't work as expected on py23...
+ // Need to be careful to support "insane" args...
PyObject *res=PyRun_String(
! "class error(Exception):\n"
! " def __init__(self, *args, **kw):\n"
! " nargs = len(args)\n"
! " if nargs > 0: self.winerror = args[0]\n"
! " else: self.winerror = None\n"
! " if nargs > 1: self.funcname = args[1]\n"
! " else: self.funcname = None\n"
! " if nargs > 2: self.strerror = args[2]\n"
! " else: self.strerror = None\n"
! " Exception.__init__(self, *args, **kw)\n"
! "class com_error(Exception):\n"
! " def __init__(self, *args, **kw):\n"
! " nargs = len(args)\n"
! " if nargs > 0: self.hresult = args[0]\n"
! " else: self.hresult = None\n"
! " if nargs > 1: self.strerror = args[1]\n"
! " else: self.strerror = None\n"
! " if nargs > 2: self.excepinfo = args[2]\n"
! " else: self.excepinfo = None\n"
! " if nargs > 3: self.argerror = args[3]\n"
! " else: self.argerror = None\n"
! " Exception.__init__(self, *args, **kw)\n"
! ,
! Py_file_input, d, d);
if (res==NULL)
return -1;
|