]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
The _Binary base type now converts values through
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 11 Apr 2013 23:34:46 +0000 (19:34 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 11 Apr 2013 23:34:46 +0000 (19:34 -0400)
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.

doc/build/changelog/changelog_08.rst
lib/sqlalchemy/types.py

index 50d31a094fbe627aea09a821abc56e5a2b7d9c2b..8df055e10f66ed8f5c869269b1433fef60c649e7 100644 (file)
@@ -6,6 +6,15 @@
 .. changelog::
     :version: 0.8.1
 
+    .. change::
+      :tags: bug, sql, postgresql
+
+      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.
+
     .. change::
       :tags: bug, sql
       :tickets: 2695
index 08aba4b56b046a336051f060cb186db4d09aef3e..1824a9b3fdeb36f3b618d790fe4e53596a98ba89 100644 (file)
@@ -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: