summaryrefslogtreecommitdiff
path: root/tests/test_lobject.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-01-08 09:54:18 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-01-10 00:11:14 +0000
commit935c25730a6f62bfbe0e0796bf4eae0a0d5f61d3 (patch)
treef7eae229fd04f4cfb288bf0ca42dd558518d737a /tests/test_lobject.py
parent38641b93eafe90ca17770559c8be4b187ec117bb (diff)
downloadpsycopg2-935c25730a6f62bfbe0e0796bf4eae0a0d5f61d3.tar.gz
Fixed segfault in large object close.
Check that the connection is not closed/faulty before attempting lo_close.
Diffstat (limited to 'tests/test_lobject.py')
-rwxr-xr-xtests/test_lobject.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_lobject.py b/tests/test_lobject.py
index 056496e..b3e3880 100755
--- a/tests/test_lobject.py
+++ b/tests/test_lobject.py
@@ -60,6 +60,10 @@ class LargeObjectMixin(object):
def tearDown(self):
if self.tmpdir:
shutil.rmtree(self.tmpdir, ignore_errors=True)
+
+ if self.conn.closed:
+ return
+
if self.lo_oid is not None:
self.conn.rollback()
try:
@@ -106,6 +110,11 @@ class LargeObjectTests(LargeObjectMixin, unittest.TestCase):
self.assertEqual(lo2.oid, lo.oid)
self.assertEqual(lo2.closed, True)
+ def test_close_connection_gone(self):
+ lo = self.conn.lobject()
+ self.conn.close()
+ lo.close()
+
def test_create_with_oid(self):
# Create and delete a large object to get an unused Oid.
lo = self.conn.lobject()