File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4814,48 +4814,11 @@ static PyTypeObject PyComError_Type = {
48144814static int
48154815create_comerror (void )
48164816{
4817- PyObject * dict = PyDict_New ();
4818- PyMethodDef * methods = comerror_methods ;
4819- PyObject * s ;
4820- int status ;
4821-
4822- if (dict == NULL )
4817+ PyComError_Type .tp_base = (PyTypeObject * )PyExc_Exception ;
4818+ if (PyType_Ready (& PyComError_Type ) < 0 )
48234819 return -1 ;
4824-
4825- while (methods -> ml_name ) {
4826- /* get a wrapper for the built-in function */
4827- PyObject * func = PyCFunction_New (methods , NULL );
4828- PyObject * meth ;
4829- if (func == NULL )
4830- goto error ;
4831- meth = PyMethod_New (func , NULL , ComError );
4832- Py_DECREF (func );
4833- if (meth == NULL )
4834- goto error ;
4835- PyDict_SetItemString (dict , methods -> ml_name , meth );
4836- Py_DECREF (meth );
4837- ++ methods ;
4838- }
4839-
4840- s = PyString_FromString (comerror_doc );
4841- if (s == NULL )
4842- goto error ;
48434820 ComError = (PyObject * )& PyComError_Type ;
4844- status = PyDict_SetItemString (dict , "__doc__" , s );
4845- Py_DECREF (s );
4846- if (status == -1 )
4847- goto error ;
4848-
4849- ComError = PyErr_NewException ("_ctypes.COMError" ,
4850- NULL ,
4851- dict );
4852- if (ComError == NULL )
4853- goto error ;
4854-
48554821 return 0 ;
4856- error :
4857- Py_DECREF (dict );
4858- return -1 ;
48594822}
48604823
48614824#endif
You can’t perform that action at this time.
0 commit comments