<br><br><div class="gmail_quote">On Tue, May 10, 2011 at 5:02 PM, Gasper Zejn <span dir="ltr"><<a href="mailto:zejn@kiberpipa.org">zejn@kiberpipa.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Seeing that there's a postgresql adapter written for PyPy [1], I decided to do<br>
a test-drive on a pet Django project. Had I not used GeoDjango, it would have<br>
probably worked right away.<br>
<br>
<br>
I didn't need to change much: Django's PostGIS database adapter uses a psycopg<br>
extension, psycopg2.extensions.ISQLQuote, which doesn't really provide<br>
anything useful. However, I'm guessing due to implementation difference,<br>
original psycopg calls `__conforms__` with extra parameter, while rpython<br>
implementation does not - that's why there's an `*args`.<br>
<br>
The other problem was that CPython ctypes and PyPy ctypes implementations<br>
differ: where CPython uses `PTR._obj.value`, PyPy uses `PTR.contents.value`.<br>
<br>
<br>
The attached patch made my project work both on CPython and PyPy.<br>
<br>
<br>
Regards,<br>
Gasper Zejn<br>
<br>
<br>
[1] <a href="https://bitbucket.org/alex_gaynor/pypy-postgresql/overview" target="_blank">https://bitbucket.org/alex_gaynor/pypy-postgresql/overview</a><br>
<br>_______________________________________________<br>
pypy-dev mailing list<br>
<a href="mailto:pypy-dev@python.org">pypy-dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/pypy-dev" target="_blank">http://mail.python.org/mailman/listinfo/pypy-dev</a><br>
<br></blockquote></div><br>The __conform__ thing is a bug in my psycogp2, I'll fix that so it'd be innapropriate to apply that to django. The other changes look like Django relying on internal details of ctypes, the correct fix isn't to add a special case for another ctypes impl.<div>
<br></div><div>Alex<br clear="all"><br>-- <br>"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>"The people's good is the highest law." -- Cicero<br>
<br>
</div>