[pypy-dev] Running pysqlite on pypy
Gerhard Häring
gh at ghaering.de
Sat May 17 03:27:17 CEST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Antonio Cuni wrote:
> Hi Gerhard, hi all,
>
> in the last days, we have been trying to run django on pypy, using the
> ctypes based implementation of pysqlite.
>
> In doing this, we encountered a problem; we have exchanged a bit of
> private mails, so I try to sum up here:
>
> This snippet explodes when run with pysqlite-ctypes, either on cpython
> or pypy-c:
>
>>>>> from pysqlite2.dbapi2 import connect
>>>>> db = connect(':memory:')
>>>>> db.execute('BEGIN IMMEDIATE TRANSACTION')
That's illegal usage of pysqlite. In the very unlikely case that what
you really want to do is *not* use DB-API implicit transactions. You
have to switch to autocommit mode first:
set isolation_level=None; either the property on the connection object,
or directly in the connect() call. That was the root of the problem -
pysqlite's ctypes branch apparently will need to do a few more sanity
checks.
> [...] The double COMMIT is probably causing the problem; not sure if it's a
> bug in pysqlite-ctypes or an expected behavior.
Both, kind of ;-)
> Gerhard, what do you think about all of this? What's the best way to solve?
I just pushed an ad-hoc fix for this particular problem to the hg repo:
changeset: 328:c42db28b5031
branch: ctypes
tag: tip
parent: 317:89e6da6ea1cb
user: Gerhard Haering <gh at ghaering.de>
date: Sat May 17 03:19:37 2008 +0200
summary: Quick fix: only use implicit transactions when autocommit
is off.
HTH & good night; just shout if there's anything else that needs fixing
- -- Gerhard
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFILjR1dIO4ozGCH14RAsMLAJwM2M7SgW5pQaV+4M/cezRb+whkDwCfbP7e
/Dh7VRnCyqfCNPDKk4BGTqE=
=9ByT
-----END PGP SIGNATURE-----
More information about the Pypy-dev
mailing list