[pypy-dev] PyPy and GeoDjango

Gasper Zejn zejn at kiberpipa.org
Tue May 10 23:02:10 CEST 2011


Seeing that there's a postgresql adapter written for PyPy [1], I decided to do 
a test-drive on a pet Django project. Had I not used GeoDjango, it would have 
probably worked right away. 


I didn't need to change much: Django's PostGIS database adapter uses a psycopg 
extension, psycopg2.extensions.ISQLQuote, which doesn't really provide 
anything useful. However, I'm guessing due to implementation difference, 
original psycopg calls `__conforms__` with extra parameter, while rpython 
implementation does not - that's why there's an `*args`.

The other problem was that CPython ctypes and PyPy ctypes implementations 
differ: where CPython uses `PTR._obj.value`, PyPy uses `PTR.contents.value`.


The attached patch made my project work both on CPython and PyPy.


Regards,
Gasper Zejn


[1] https://bitbucket.org/alex_gaynor/pypy-postgresql/overview
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pypy_geodjango_ctypes.diff
Type: text/x-patch
Size: 2698 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110510/12809c57/attachment-0001.bin>


More information about the pypy-dev mailing list