From 00d247edcc89ae7620d75112cd9183138db7ebe7 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 9 Aug 2009 21:41:56 +0000 Subject: [PATCH] close out py3k + pg8000 bugs that are fixable for now without pg8000 decimal fix --- lib/sqlalchemy/dialects/postgresql/base.py | 13 +++++++++++++ test/engine/test_transaction.py | 10 +++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 874907abc1..fbba8221bf 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -619,8 +619,13 @@ class PGDialect(default.DefaultDialect): """ rp = connection.execute(s) # what about system tables? + # Py3K + #schema_names = [row[0] for row in rp \ + # if not row[0].startswith('pg_')] + # Py2K schema_names = [row[0].decode(self.encoding) for row in rp \ if not row[0].startswith('pg_')] + # end Py2K return schema_names @reflection.cache @@ -644,7 +649,11 @@ class PGDialect(default.DefaultDialect): WHERE relkind = 'v' AND '%(schema)s' = (select nspname from pg_namespace n where n.oid = c.relnamespace) """ % dict(schema=current_schema) + # Py3K + #view_names = [row[0] for row in connection.execute(s)] + # Py2K view_names = [row[0].decode(self.encoding) for row in connection.execute(s)] + # end Py2K return view_names @reflection.cache @@ -661,7 +670,11 @@ class PGDialect(default.DefaultDialect): rp = connection.execute(sql.text(s), view_name=view_name, schema=current_schema) if rp: + # Py3K + #view_def = rp.scalar() + # Py2K view_def = rp.scalar().decode(self.encoding) + # end Py2K return view_def @reflection.cache diff --git a/test/engine/test_transaction.py b/test/engine/test_transaction.py index 16f746ea6b..11dd0e0102 100644 --- a/test/engine/test_transaction.py +++ b/test/engine/test_transaction.py @@ -779,14 +779,14 @@ class ForUpdateTest(TestBase): iterations, thread_count = 10, 5 threads, errors = [], [] for i in xrange(thread_count): - thread = threading.Thread(target=self.increment, + thrd = threading.Thread(target=self.increment, args=(iterations,), kwargs={'errors': errors, 'update_style': True}) - thread.start() - threads.append(thread) - for thread in threads: - thread.join() + thrd.start() + threads.append(thrd) + for thrd in threads: + thrd.join() for e in errors: sys.stdout.write("Failure: %s\n" % e) -- 2.47.3