Merge remote-tracking branch 'fix_lobject_factory'

This commit is contained in:
Daniele Varrazzo 2017-04-19 01:06:24 +01:00
commit a7e3f46431
2 changed files with 8 additions and 1 deletions

View File

@ -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,

View File

@ -389,6 +389,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.assert_(isinstance(lo, lobject_subclass))
decorate_all_tests(LargeObjectTests, skip_if_no_lo, skip_lo_if_green)