<br><br><div class="gmail_quote">On Tue, May 10, 2011 at 5:02 PM, Gasper Zejn <span dir="ltr">&lt;<a href="mailto:zejn@kiberpipa.org">zejn@kiberpipa.org</a>&gt;</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&#39;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&#39;t need to change much: Django&#39;s PostGIS database adapter uses a psycopg<br>
extension, psycopg2.extensions.ISQLQuote, which doesn&#39;t really provide<br>
anything useful. However, I&#39;m guessing due to implementation difference,<br>
original psycopg calls `__conforms__` with extra parameter, while rpython<br>
implementation does not - that&#39;s why there&#39;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&#39;ll fix that so it&#39;d be innapropriate to apply that to django.  The other changes look like Django relying on internal details of ctypes, the correct fix isn&#39;t to add a special case for another ctypes impl.<div>
<br></div><div>Alex<br clear="all"><br>-- <br>&quot;I disapprove of what you say, but I will defend to the death your right to say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>&quot;The people&#39;s good is the highest law.&quot; -- Cicero<br>
<br>
</div>