Re: [pysqlite] Blob.read() return value

Roger Binns <[email protected]> Fri, 12 Jun 2009 12:05:47 -0700
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Austin Bingham wrote:
> The documentation for Blob.read() indicates that the function will
> only ever return strings or bytes, but it looks like it return Nones
> and NULL (does that become None?) under certain circumstances. What
> exactly are the conditions under which read() will return something
> other than a string or bytes?

I assume you are referring to APSW here.  Blob is supposed to be
following *exactly* what the builtin Python file type does.  In
particular only strings (Python 2) or bytes (Python 3) are returned for
data, and I need to double check what happens once end of blob/file is
reached (empty, none etc)

BTW NULL is never returned back to Python code.  It is how a C function
using the Python API signals an error to its caller.

> And could that be put in the documentation? 

The code and documentation are indeed inconsistent.  Thanks for
reporting this - I will have it fixed before the end of the day.

  http://code.google.com/p/apsw/issues/detail?id=50

The next APSW release will be in the next few days shortly after SQLite
3.6.15 comes out.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoypwgACgkQmOOfHg372QS3sQCdFaMGiSXCGaPGNFhoG2rtF/jO
HykAoJtUjReibRCJUQXQ7I1NvBWxtDak
=z5Am
-----END PGP SIGNATURE-----