Revision: 183
http://informixdb.svn.sourceforge.net/informixdb/?rev=183&view=rev
Author: chaese
Date: 2008-09-26 04:50:13 +0000 (Fri, 26 Sep 2008)
Log Message:
-----------
Fix how the __init__ and __str__ methods are being injected into the
Error classes. The methods are now actual methods and don't receive
"self" in the args tuple anymore.
Modified Paths:
--------------
branches/informixdb-py3k/ext/_informixdb.ec
Modified: branches/informixdb-py3k/ext/_informixdb.ec
===================================================================
--- branches/informixdb-py3k/ext/_informixdb.ec 2008-09-26 02:07:03 UTC (rev 182)
+++ branches/informixdb-py3k/ext/_informixdb.ec 2008-09-26 04:50:13 UTC (rev 183)
@@ -3156,12 +3156,12 @@
static PyObject* DatabaseError_init(PyObject* self, PyObject* args, PyObject* kwds)
{
- static char* kwdnames[] = { "self", "action", "sqlcode", "diagnostics", 0 };
+ static char* kwdnames[] = { "action", "sqlcode", "diagnostics", 0 };
PyObject *action;
PyObject *diags;
long int sqlcode;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OSlO!", kwdnames, &self,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "UlO!", kwdnames,
&action, &sqlcode, &PyList_Type, &diags)) {
return NULL;
}
@@ -3186,7 +3186,6 @@
{
PyObject *str, *action, *sqlcode, *diags, *a, *f, *str2, *str3;
int i;
- self = PyTuple_GetItem(args, 0);
action = PyObject_GetAttrString(self, "action");
sqlcode = PyObject_GetAttrString(self, "sqlcode");
@@ -3228,11 +3227,9 @@
PyMethodDef* meth;
for (meth = DatabaseError_methods; meth->ml_name != NULL; ++meth) {
- PyObject *func = PyCFunction_New(meth, NULL);
- PyObject *method = PyMethod_New(func, exc);
- PyObject_SetAttrString(exc, meth->ml_name, method);
+ PyObject *func = PyDescr_NewMethod((PyTypeObject*)exc, meth);
+ PyObject_SetAttrString(exc, meth->ml_name, func);
Py_DECREF(func);
- Py_DECREF(method);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|