[pywin32-checkins] pywin32/win32/src PyWinTypesmodule.cpp, 1.39.2.5, 1.39.2.6
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-10-04 04:10:29
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25697 Modified Files: Tag: py3k PyWinTypesmodule.cpp Log Message: Fix version check for builtins, some more error checking Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.39.2.5 retrieving revision 1.39.2.6 diff -C2 -d -r1.39.2.5 -r1.39.2.6 *** PyWinTypesmodule.cpp 1 Oct 2008 08:10:11 -0000 1.39.2.5 --- PyWinTypesmodule.cpp 4 Oct 2008 04:10:23 -0000 1.39.2.6 *************** *** 857,886 **** Py_DECREF(name); PyObject *bimod = PyImport_ImportModule( ! #if PY_VERSION_HEX > 0x2030300 "builtins"); #else "__builtin__"); #endif ! if (bimod) { ! PyDict_SetItemString(d, "__builtins__", bimod); ! Py_DECREF(bimod); ! } // 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" ! , ! Py_file_input, d, d); PyWinExc_ApiError = PyDict_GetItemString(d, "error"); Py_XINCREF(PyWinExc_ApiError); --- 857,894 ---- Py_DECREF(name); PyObject *bimod = PyImport_ImportModule( ! #if PY_VERSION_HEX >= 0x03000000 "builtins"); #else "__builtin__"); #endif ! if ((bimod == NULL) ! ||PyDict_SetItemString(d, "__builtins__", bimod) == -1){ ! Py_XDECREF(bimod); ! return -1; ! } ! Py_DECREF(bimod); ! // 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; ! Py_DECREF(res); ! PyWinExc_ApiError = PyDict_GetItemString(d, "error"); Py_XINCREF(PyWinExc_ApiError); |