Commits

Brian Kearns committed ffe9f06

fix this copy more simply and in another place

Comments (0)

Files changed (1)

lib_pypy/_sqlite3.py

 import string
 import sys
 import weakref
-import array
 from threading import _get_ident as _thread_get_ident
 try:
     from __pypy__ import newlist_hint
                 elif typ == _lib.SQLITE_BLOB:
                     blob = _lib.sqlite3_column_blob(self.__statement._statement, i)
                     blob_len = _lib.sqlite3_column_bytes(self.__statement._statement, i)
-                    # make a copy of the data into an array, in order to get
-                    # a read-write buffer in the end, and one that own the
-                    # memory for a more predictable length of time than 'blob'
-                    copy = array.array("c", _ffi.buffer(blob, blob_len))
-                    val = _BLOB_TYPE(copy)
+                    val = _BLOB_TYPE(_ffi.buffer(blob, blob_len)[:])
             row.append(val)
         return tuple(row)
 
         elif typ == _lib.SQLITE_BLOB:
             blob = _lib.sqlite3_value_blob(params[i])
             blob_len = _lib.sqlite3_value_bytes(params[i])
-            val = _BLOB_TYPE(_ffi.buffer(blob, blob_len))
+            val = _BLOB_TYPE(_ffi.buffer(blob, blob_len)[:])
         else:
             raise NotImplementedError
         _params.append(val)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.