<inad922>
If I define lib like: "import cffi; ffi = cffi.FFI(); ffi.cdef('void stuff(int a, bool b)'); lib = ffi.dlopen('./somelib.so')". Can I call lib.stuff(12, True). I mean do python integers get casted to C integers and same for booleans or do these get passed down as PyObjects?
amaury has quit [Ping timeout: 246 seconds]
<inad922>
Alright I managed to figure out this myself.
* mattip
not sure those are meant to be run untranslated
<mihaid>
this is the command: /usr/bin/python2.7 pytest.py pypy/module/test_lib_pypy/ctypes_tests/test_libc.py -v
<cfbolz>
mihaid: yes, you need to run them with pypy
<mihaid>
I think it uses the interpreter's ctypes library
<cfbolz>
just the same command, but with pypy in the front
<cfbolz>
yep, it does
<mihaid>
so, basically all these are assumed to run after the translation?
<cfbolz>
yes
<mihaid>
oh, thanks. I've been trying for 3 days to get them to run before the translation, with no succes :)
<cfbolz>
ouch. maybe we should add a readme to the directory?
<antocuni>
uhm, according to ctypes_test/conftest.py, they should not be even collected, if you run them on CPython
<mihaid>
most of them run just fine :)
<mihaid>
anyway, thank you very much! this makes the problem a lot easier.
<mattip>
antocuni: pytest_ignore_collect from conftest is not called in this case
<antocuni>
yeah, I supposed so. Maybe we should write another hook which emits a warning/error in case you run it on CPython, to avoid confusions like mihaid's one
jcea has joined #pypy
<mattip>
cppyy uses a "@py.test.mark.tryfirst", that might work?
<antocuni>
no idea :)
<mattip>
cppyy uses a "@py.test.mark.tryfirst", that might work?
<mattip>
sorry
dmalcolm has joined #pypy
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #pypy
<mattip>
nope,it doesn't
<mattip>
arigato: (for the logs) cpyext-recursionlimit works as advertised, could you review?
marr has quit [Ping timeout: 240 seconds]
<kenaan>
mattip cpyext-obj-stealing 92c3ef911221 /: merge default into branch
<mattip>
also cpext-obj-stealing which adds tests and fixes for refcounting and PyListObjects
* mattip
off
mattip has left #pypy ["bye"]
DragonSA has joined #pypy
<kenaan>
cfbolz default 157a06a45851 /pypy/module/test_lib_pypy/README.txt: a readme for the applevel tests in this dir
<kenaan>
antocuni faster-rstruct-2 0265fea70804 /rpython/rlib/rstruct/test/test_pack.py: ouch, this was plainly wrong, as it overwrote the correct teardown_method just above
<kenaan>
antocuni faster-rstruct-2 ce82d5756ddd /rpython/rlib/rstruct/test/test_pack.py: write tests to check that USE_FASTPATH and ALLOW_SLOWPATH actually do what they are supposed to do
<kenaan>
antocuni faster-rstruct-2 274be07c41af /rpython/rlib/rstruct/: add a new test flag to disallow fast paths
<kenaan>
antocuni faster-rstruct-2 23b951353efe /rpython/rlib/rstruct/test/test_pack.py: add a passing test to check that we don't take the fast path for unaligned access
<kenaan>
antocuni faster-rstruct-2 6bed52a9d7c6 /rpython/rlib/rstruct/test/test_pack.py: WIP: add a failing test which show why the current way to detect alignement is buggy
<kenaan>
antocuni faster-rstruct-2 7d8f1bbfc0b1 /rpython/rlib/: delegate the alignment check to Buffer.typed_{read,write}, to take in account also the SubBuffer's offs...
<cfbolz>
inad922: cffi and PyObject don't really work together. the point of cffi is indeed to not need to use the C api
cstratak has joined #pypy
cstratak has quit [Remote host closed the connection]
cstratak has joined #pypy
<inad922>
cfbolz: Yeah well. I create a data structure where the key can be any PyObject which supports comparison i.e. has a __cmp__ defined or is a builtin type like that so I can't really get rid of PyObject function. For me cffi is a tool to write C extensions in a cleaner way.
<inad922>
cfbolz: Ah ok I see the problem. If I use PyObject than I can only use the extension with CPython and not with PyPy. I just don't see how can I get around this. Suppose I want to make something similar to 'dict' in a way that I want to enable all inmutable instances to be keys. How can I do that without using a PyObject? Also I need to compare these objects.
<cfbolz>
inad922: I am not fully sure, to be honest. you could try to use new_handle and a callback to python do the actual comparison
<cfbolz>
but I think there are lifetime problems then
<cfbolz>
(ie, who keeps the python objects alive)
<inad922>
new_handle and a callback? I don't get it. Could you give me a link?
<arigato>
I guess the name "OS/X" we use everywhere is wrong, it is "OS X". it has been renamed recently "macOS" but I'm -1 on renaming it because it's less clear for outside people (i.e. me :-). +1 / -1 ?
lritter has quit [Ping timeout: 268 seconds]
<arigato>
I would suggest to remove the "/" and that's it
inad922 has joined #pypy
amaury has joined #pypy
<mattip>
+1 for "OS X"
<arigato>
thanks
<mattip>
I can do the grep change, give me a moment
<arigato>
too late :-)
<kenaan>
arigo pypy.org[extradoc] f8278c922a6e /: OS/X => OS X
<mattip>
:)
<arigato>
thanks anyway
<mattip>
I am almost off to sleep, but would like a review of two branches - cpyext-obj-stealing and cpyext-recursionlimit
<mattip>
the first tries harder to copy the exact refcounting done in cpython PyListObject, including a test
<mattip>
the second is a hacky implementation from this week, as we discussed
<arigato>
ok, I'll review them
<mattip>
cpyext-obj-stealing works with pandas without crashing, where default segfaults
<mattip>
thanks
<mattip>
gnite
mattip has left #pypy ["bye"]
<arigato>
gni--zzzz
arigato has quit [Quit: Leaving]
Guest6935 has quit [Quit: Leaving...]
amaury has quit [Quit: Konversation terminated!]
amaury_ has joined #pypy
amaury_ is now known as amaury
amaury has quit [Client Quit]
amaury_ has joined #pypy
<amaury_>
I found a way to help with the win32 port
<amaury_>
Since I don't have any Windows machine, I will try to use wine and mingw32 to translate PyPy...