summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrazer McLean <frazer@frazermclean.co.uk>2017-04-16 03:12:18 +0200
committerFrazer McLean <frazer@frazermclean.co.uk>2017-04-16 03:12:18 +0200
commit38cd7203695301f8f13e25e70eccf8e783cc1c7f (patch)
treef40b35d75553d0cd988f26d8dab1c173c9cbe416
parent4b4d2796b7efdd0846e972fd7a300ca4e7b11ccd (diff)
downloadpsycopg2-38cd7203695301f8f13e25e70eccf8e783cc1c7f.tar.gz
Fix name of lobject keyword argument
-rw-r--r--psycopg/connection_type.c2
-rwxr-xr-xtests/test_lobject.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c
index eb4b241..8c5085b 100644
--- a/psycopg/connection_type.c
+++ b/psycopg/connection_type.c
@@ -938,7 +938,7 @@ psyco_conn_lobject(connectionObject *self, PyObject *args, PyObject *keywds)
PyObject *obj;
static char *kwlist[] = {"oid", "mode", "new_oid", "new_file",
- "cursor_factory", NULL};
+ "lobject_factory", NULL};
if (!PyArg_ParseTupleAndKeywords(args, keywds, "|IzIzO", kwlist,
&oid, &smode, &new_oid, &new_file,
diff --git a/tests/test_lobject.py b/tests/test_lobject.py
index 3379ec0..744a3a8 100755
--- a/tests/test_lobject.py
+++ b/tests/test_lobject.py
@@ -382,6 +382,13 @@ class LargeObjectTests(LargeObjectTestCase):
except psycopg2.OperationalError:
pass
+ def test_factory(self):
+ class lobject_subclass(psycopg2.extensions.lobject):
+ pass
+
+ lo = self.conn.lobject(lobject_factory=lobject_subclass)
+ self.assertIsInstance(lo, lobject_subclass)
+
decorate_all_tests(LargeObjectTests, skip_if_no_lo, skip_lo_if_green)