From 6fc167a7b12598e023e3faed7aa3e599816e00b7 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 19 Oct 2011 22:00:59 +0100 Subject: [PATCH] Unregister the composite array caster after the test Otherwise the refcount script will report a leak. --- tests/test_types_extras.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_types_extras.py b/tests/test_types_extras.py index c690d9a6..9936305b 100755 --- a/tests/test_types_extras.py +++ b/tests/test_types_extras.py @@ -596,7 +596,12 @@ class AdaptTypeTestCase(unittest.TestCase): curs2.execute("select (1,2)::type_ii") self.assertEqual(curs2.fetchone()[0], (1,2)) finally: - del psycopg2.extensions.string_types[t.oid] + # drop the registered typecasters to help the refcounting + # script to return precise values. + del psycopg2.extensions.string_types[t.typecaster.values[0]] + if t.array_typecaster: + del psycopg2.extensions.string_types[ + t.array_typecaster.values[0]] finally: conn1.close()