Commits

Mike Bayer committed dccc0b4

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.

Comments (0)

Files changed (2)

doc/build/changelog/changelog_08.rst

     :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
 

lib/sqlalchemy/types.py

         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: