[pypy-dev] Preliminary ctypes-based pysqlite implementation

Carl Friedrich Bolz cfbolz at gmx.de
Tue Dec 25 20:09:23 CET 2007


Hi Gerhard,

Gerhard Häring wrote:
 > A few weeks ago, I've read with great interest the thread "missing
 > things for making PyPy "production" ready (for some value of
 > production)" on this list. That's when I decided to help with the
 > standard library and the module I'm most familiar with, the "sqlite3"
 > module based on pysqlite.
 >
 > Mercurial mirror here: http://hg.ghaering.de/pysqlite3/
 >
 > Download with "hg clone http://hg.ghaering.de/pysqlite3/" if Mercurial
 > installed.
 >
 > This is in a rough pre-alpha state now so that one set of pysqlite's
 > unit tests pass (the DB-API ones). It's really rough code I'd not
 > normally release to the public, but xorAxAx (Alexander Schremmer) on
 > #pypy said it would perhaps motivate people to improve PyPy's ctypes
 > implementation.

Cool, cool, cool! You probably won't have any luck to use this with
PyPy, because our ctypes implementation is extremely rudimentary (e.g.
it imports and not much else).  However, I hope to work on it a bit in
the next weeks, so making the sqlite wrapper work is a nice first
target. Thank you!
 >
 > I didn't get PyPy to compile correctly (*), but trying to import the
 > "pysqlite3 pre-alpha" led an error about c_void_p() not working. This
 > demonstrates:
 >
 > $ pypy/bin/py.py --withmod-_ffi
 >>>>> from ctypes import *
 >>>>> ptr = c_void_p()
 > Traceback (application-level):
 >   File "<inline>", line 1 in <interactive>
 >     ptr = c_void_p()
 > TypeError: __init__() takes exactly 2 arguments (1 given)
 >>>>> ptr = c_void_p()
 >
 > This is probably just one of the issues that hinder using the new
 > pysqlite with PyPy. It would be extra sweet if one of you could hack
 > on ctypes to make it more compatible with the CPython one, but patches
 > to my code to make it work with PyPy's ctypes would also be welcome.

I think our goal is to be as compatible to the ctypes one as possible.
As I said above, I am not surprised that nothing works yet :-).

Merry Christmas,

Carl Friedrich



More information about the Pypy-dev mailing list