| Store | Cart

Re: [Python-Dev] libffi embedded in CPython

From: Paul Moore <p.f....@gmail.com>
Tue, 24 Mar 2015 21:31:29 +0000
On 12 March 2015 at 17:44, Paul Moore <p.f....@gmail.com> wrote:
> On 12 March 2015 at 17:26, Brett Cannon <bre...@python.org> wrote:>>> I'm all for ditching our 'libffi_msvc' in favor of adding libffi as>>> another 'external' for the Windows build.  I have managed to get>>> _ctypes to build on Windows using vanilla libffi sources, prepared>>> using their configure script from within Git Bash and built with our>>> usual Windows build system (properly patched).  Unfortunately, making>>> things usable will take some work on ctypes itself, which I'm not>>> qualified to do. I'm happy to pass on my procedure and patches for>>> getting to the point of successful compilation to anyone who feels up>>> to fixing the things that are broken.>>>>>> So it seems possible to use upstream libffi but will require some work.>> I'd be willing to contemplate helping out on the Windows side of> things, if nobody else steps up (with the proviso that I have little> free time, and I'm saying this without much idea of what's involved> :-)) If Zachary can give a bit more detail on what the work on ctypes> is, and/or put what he has somewhere that I could have a look at, that> might help.

One thing that seems to be an issue. On Windows, ctypes detects if the
FFI call used the wrong number of arguments off the stack, and raises
a ValueError if it does. The tests rely on that behaviour. But it's
based on ffi_call() returning a value, which upstream libffi doesn't
do. As far as I can tell (not that the libffi docs are exactly
comprehensive...) there's no way of getting that information from
upstream libffi.

What does Unix ctypes do when faced with a call being made with the
wrong number of arguments? On Windows, using upstream libffi and
omitting the existing check, it seems to crash the Python process,
which obviously isn't good. But the test that fails is
Windows-specific, and short of going through all the tests looking for
one that checks passing the wrong number of arguments and isn't
platform-specific, I don't know how Unix handles this.

Can anyone on Unix tell me if a ctypes call with the wrong number of
arguments returns ValueError on Unix? Something like strcmp() (with no
args) should do as a test, I guess...

If there's a way Unix handles this, I can see about replicating it on
Windows. But if there isn't, I fear we could always need a patched
libffi to maintain the interface we currently have...

Thanks,
Paul
_______________________________________________
Python-Dev mailing list
Pyth...@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/python-dev-ml%40activestate.com

Recent Messages in this Thread
Brett Cannon Mar 11, 2015 05:27 pm
Antoine Pitrou Mar 11, 2015 05:50 pm
Maciej Fijalkowski Mar 11, 2015 05:54 pm
Antoine Pitrou Mar 11, 2015 06:05 pm
Antoine Pitrou Mar 11, 2015 06:17 pm
Maciej Fijalkowski Mar 11, 2015 09:13 pm
francis Mar 14, 2015 11:34 am
Maciej Fijalkowski Mar 11, 2015 09:10 pm
Antoine Pitrou Mar 11, 2015 10:31 pm
Maciej Fijalkowski Mar 11, 2015 10:33 pm
Paul Moore Mar 11, 2015 10:55 pm
Antoine Pitrou Mar 11, 2015 11:11 pm
Wes Turner Mar 11, 2015 06:31 pm
Maciej Fijalkowski Mar 11, 2015 09:11 pm
Paul Moore Mar 11, 2015 05:56 pm
Victor Stinner Mar 11, 2015 09:34 pm
Maciej Fijalkowski Mar 11, 2015 09:45 pm
Paul Moore Mar 11, 2015 10:03 pm
Brett Cannon Mar 11, 2015 10:20 pm
Antoine Pitrou Mar 11, 2015 10:28 pm
Maciej Fijalkowski Mar 11, 2015 10:31 pm
Guido van Rossum Mar 12, 2015 12:20 am
Brett Cannon Mar 12, 2015 02:05 pm
Thomas Wouters Mar 12, 2015 02:25 pm
Matthias Klose Mar 14, 2015 02:42 pm
Zachary Ware Mar 12, 2015 02:39 pm
Brett Cannon Mar 12, 2015 05:26 pm
Paul Moore Mar 12, 2015 05:44 pm
Zachary Ware Mar 12, 2015 06:54 pm
Paul Moore Mar 12, 2015 07:13 pm
Paul Moore Mar 24, 2015 09:31 pm
Maciej Fijalkowski Mar 25, 2015 08:05 am
Paul Moore Mar 25, 2015 08:15 am
Antoine Pitrou Mar 25, 2015 09:09 am
Paul Moore Mar 25, 2015 09:22 am
Antoine Pitrou Mar 25, 2015 09:30 am
Zachary Ware Mar 25, 2015 01:36 pm
Steve Dower Mar 25, 2015 03:57 pm
Nick Coghlan Mar 26, 2015 02:28 am
Zachary Ware Mar 26, 2015 02:40 am
Nick Coghlan Mar 26, 2015 03:18 am
Ned Deily Mar 12, 2015 06:35 pm
Maciej Fijalkowski Mar 12, 2015 07:36 pm
Thomas Wouters Mar 12, 2015 07:58 pm
Messages in this thread