diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-11 19:34:46 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-04-11 19:34:46 -0400 |
| commit | a0e95869a4a17cc1c162341a05d0c8a04a398f55 (patch) | |
| tree | 473b07b4ef40558a858dc7176cc73df6d9987eaa /lib/sqlalchemy | |
| parent | ee7bb9c1744b4b09263ef32032afd38f694df136 (diff) | |
| download | sqlalchemy-a0e95869a4a17cc1c162341a05d0c8a04a398f55.tar.gz | |
The _Binary base type now converts values through
the bytes() callable when run on Python 3; in particular
psycopg2 2.5 with Python 3.3 seems to now be returning
the "memoryview" type, so this is converted to bytes
before return.
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/types.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index 08aba4b56..1824a9b3f 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -1711,8 +1711,15 @@ class _Binary(TypeEngine): return process # Python 3 has native bytes() type - # both sqlite3 and pg8000 seem to return it - # (i.e. and not 'memoryview') + # both sqlite3 and pg8000 seem to return it, + # psycopg2 as of 2.5 returns 'memoryview' + # Py3K + #def result_processor(self, dialect, coltype): + # def process(value): + # if value is not None: + # value = bytes(value) + # return value + # return process # Py2K def result_processor(self, dialect, coltype): if util.jython: |
