[pypy-dev] 2.6.1 and freebsd-9

David Naylor naylor.b.david at gmail.com
Thu Aug 27 05:41:51 CEST 2015


On Thursday, 27 August 2015 00:53:05 Matti Picus wrote:
> On 26/08/15 23:32, David Naylor wrote:
> Please find attached for a patch that adds support for:
> 	ctypes.CDLL(name, handle=X)
> 
> The patch includes tests for the pypy and rpython changes.  I am not sure
> about the policy regarding changes to the python libraries and thus did not
> add a unit test there (the standard tests are lacking one for handle support
> anyway).
> 
> I have translation tested the change and the previous fix I submitted now
> works on pypy :-D.
> 
> Regards
> Hi David. Thanks for the contributions. It would be more convenient if you
> would submit pull requests, or even better would be to do this work on the
> pypy/pypy repo on a branch. In the meantime, I have commited this set of
> changes on https://bitbucket.org/mattip/pypy and given you a write bit
> there, so if you do not want to fork on your own you may feel free to use
> that repo.

Thank you Matti :-D

> Unfortunately the patch causes a segfault in testing on ubuntu 14.04, in the
> test_handle test you added, I'm pretty sure handle=-2 will not work on
> linux.

That can be fixed, I had to hardcode -2 elsewhere (to prevent a cyclical 
reference on importing) but that was FreeBSD specific anyway. This can be done 
properly.  

I am away today and tomorrow on business but will attend to this over the 
weekend.   

> Also, it would be good to find a work-around so we do not modify upstream
> stdlib in lib-python/2.7, perhaps the handle-as-int could be dealt with
> later on in _ctypes, or however cpython deals with the issue?

The problem is that on cPython CDLL.handle is an integer (corresponding to 
void*) but on PyPy it is a _rawffi.CDLL class instance.  The 
ctypes/__init__.py file was already modified to this effect and the patch 
added support to converting on int into a _rawffi.CDLL class instance.  

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150827/3baa1433/attachment-0001.sig>


More information about the pypy-dev mailing list