[pywin32-checkins] pywin32/win32/src PyWinTypesmodule.cpp, 1.40, 1.41
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-10-07 11:32:33
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22355/win32/src Modified Files: PyWinTypesmodule.cpp Log Message: More robust handling and tests for 'insane' exception args. Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** PyWinTypesmodule.cpp 1 Oct 2008 06:49:31 -0000 1.40 --- PyWinTypesmodule.cpp 7 Oct 2008 11:28:10 -0000 1.41 *************** *** 829,844 **** } // Note using 'super()' doesn't work as expected on py23... 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" --- 829,853 ---- } // Note using 'super()' doesn't work as expected on py23... + // Need to be careful to support "insane" args... 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" |