summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2008-02-12 17:44:23 (GMT)
committerThomas Heller <theller@ctypes.org>2008-02-12 17:44:23 (GMT)
commit08c0e6311740f830eea30698877ae9dc9685dfd9 (patch)
treeaf906168439932b2dd06fd7caecc615d2c72323e
parent126d29abf8517dd897372d6ff920c30b3d7a81e8 (diff)
downloadcpython-08c0e6311740f830eea30698877ae9dc9685dfd9.zip
cpython-08c0e6311740f830eea30698877ae9dc9685dfd9.tar.gz
cpython-08c0e6311740f830eea30698877ae9dc9685dfd9.tar.bz2
Revert the last svnmerge (r60681) from trunk to _ctypes.c, it should
not have been merged as was noticed in the commit message.
-rw-r--r--Modules/_ctypes/_ctypes.c41
1 files changed, 2 insertions, 39 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 5319a9a..a4400cf 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4814,48 +4814,11 @@ static PyTypeObject PyComError_Type = {
static int
create_comerror(void)
{
- PyObject *dict = PyDict_New();
- PyMethodDef *methods = comerror_methods;
- PyObject *s;
- int status;
-
- if (dict == NULL)
+ PyComError_Type.tp_base = (PyTypeObject*)PyExc_Exception;
+ if (PyType_Ready(&PyComError_Type) < 0)
return -1;
-
- while (methods->ml_name) {
- /* get a wrapper for the built-in function */
- PyObject *func = PyCFunction_New(methods, NULL);
- PyObject *meth;
- if (func == NULL)
- goto error;
- meth = PyMethod_New(func, NULL, ComError);
- Py_DECREF(func);
- if (meth == NULL)
- goto error;
- PyDict_SetItemString(dict, methods->ml_name, meth);
- Py_DECREF(meth);
- ++methods;
- }
-
- s = PyString_FromString(comerror_doc);
- if (s == NULL)
- goto error;
ComError = (PyObject*)&PyComError_Type;
- status = PyDict_SetItemString(dict, "__doc__", s);
- Py_DECREF(s);
- if (status == -1)
- goto error;
-
- ComError = PyErr_NewException("_ctypes.COMError",
- NULL,
- dict);
- if (ComError == NULL)
- goto error;
-
return 0;
- error:
- Py_DECREF(dict);
- return -1;
}
#endif