[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pypy-dev
Subject:    Re: [pypy-dev] 2.6.1 and freebsd-9
From:       David Naylor <naylor.b.david () gmail ! com>
Date:       2015-08-27 3:41:51
Message-ID: 8475636.xbMoj7DVSb () dragon ! local
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


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
["signature.asc" (application/pgp-signature)]

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic