From 9b38463b06ff48269668a6b05822b285d603c7f8 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 2 Dec 2013 14:24:22 -0600 Subject: [PATCH] Fixed DB test cases on PyPy They weren't working because of the intersection between some monkey patching in the tests and the fact that ``sqlite3.Connection`` and ``Cursor`` are Python classes on PyPy, but C-extension classes on CPython. The result was that trying to call the superclass's init didn't work because the name ``sqlite3.Connection`` pointed to a different class that wasn't actually the real superclass of ``GreenDBConnection``. Using ``super`` fixes this because the method called is now always the real superclass's. Change-Id: Ib45b16c7499883e560877788f13285d0a47cc2cd --- swift/common/db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swift/common/db.py b/swift/common/db.py index a8b1d4933f..192d17d371 100644 --- a/swift/common/db.py +++ b/swift/common/db.py @@ -100,7 +100,7 @@ class GreenDBConnection(sqlite3.Connection): timeout = BROKER_TIMEOUT self.timeout = timeout self.db_file = database - sqlite3.Connection.__init__(self, database, 0, *args, **kwargs) + super(GreenDBConnection, self).__init__(database, 0, *args, **kwargs) def cursor(self, cls=None): if cls is None: @@ -119,7 +119,7 @@ class GreenDBCursor(sqlite3.Cursor): def __init__(self, *args, **kwargs): self.timeout = args[0].timeout self.db_file = args[0].db_file - sqlite3.Cursor.__init__(self, *args, **kwargs) + super(GreenDBCursor, self).__init__(*args, **kwargs) def execute(self, *args, **kwargs): return _db_timeout(