summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2009-01-22 11:02:38 +0100
committerFederico Di Gregorio <fog@initd.org>2009-01-22 11:02:38 +0100
commite22451736a3b35bcb7da199e14a1b62e93e97663 (patch)
tree71bd071bcd81016ea295b879d2a307884d5abcac
parent78c0765367d2a02f2ba5079ef2b600316e7d9003 (diff)
downloadpsycopg2-e22451736a3b35bcb7da199e14a1b62e93e97663.tar.gz
register_type() now works on connection and cursor subclasses
-rw-r--r--ChangeLog6
-rw-r--r--psycopg/psycopgmodule.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 487943a..582dca7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-20 Federico Di Gregorio <fog@initd.org
+
+ * Fixed problem reported by Lawrence Oluyede where
+ register_type() didn't work on connection and cursors
+ suclasses.
+
2009-01-10 Federico Di Gregorio <fog@initd.org>
* psycopg/cursor_type.c: cursor.isready() now raise an exception
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index 43e0402..eb05b84 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -243,10 +243,10 @@ psyco_register_type(PyObject *self, PyObject *args)
}
if (obj != NULL) {
- if (obj->ob_type == &cursorType) {
+ if (PyObject_TypeCheck(obj, &cursorType)) {
_psyco_register_type_set(&(((cursorObject*)obj)->string_types), type);
}
- else if (obj->ob_type == &connectionType) {
+ else if (PyObject_TypeCheck(obj, &connectionType)) {
typecast_add(type, ((connectionObject*)obj)->string_types, 0);
}
else {