Skip to content

Commit 08c0e63

Browse files
author
Thomas Heller
committed
Revert the last svnmerge (r60681) from trunk to _ctypes.c, it should
not have been merged as was noticed in the commit message.
1 parent 126d29a commit 08c0e63

1 file changed

Lines changed: 2 additions & 39 deletions

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4814,48 +4814,11 @@ static PyTypeObject PyComError_Type = {
48144814
static int
48154815
create_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

0 commit comments

Comments
 (0)