[pypy-dev] Preliminary ctypes-based pysqlite implementation

Gerhard Häring gh at ghaering.de
Tue Dec 25 18:15:24 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear pypy developers,

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.

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'll give experimenting with PyPy/ctypes another shot myself when the
svn version starts to compile (err. translate?!) again. The version on
top of CPython is too slow for such experiments.

Cheers,

- -- Gerhard

(*) "python translate.py --run targetpypystandalone.py --withmod-_ffi"
crashes with current pypy svn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHcTqsdIO4ozGCH14RArbyAKCNF5AGhSBs/taqxE+WZDl6xlmjDgCeMK4b
Gn6F7n3Rhn170xnXybnNFEk=
=AvIW
-----END PGP SIGNATURE-----



More information about the Pypy-dev mailing list