cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://quodlibet.duckdns.org/irc/pypy/latest.log.html#irc-end ) | use cffi for calling C | if a pep adds a mere 25-30 [C-API] functions or so, it's a drop in the ocean (cough) - Armin
marky1991 has quit [Ping timeout: 258 seconds]
marky1991 has joined #pypy
infernix has joined #pypy
lritter has quit [Ping timeout: 265 seconds]
lritter has joined #pypy
marky1991 has quit [Ping timeout: 265 seconds]
jvesely has quit [Quit: jvesely]
_whitelogger has joined #pypy
marky1991 has joined #pypy
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
dddddd has quit [Ping timeout: 258 seconds]
marky1991 has quit [Quit: Saliendo]
marky1991 has joined #pypy
jvesely has joined #pypy
_whitelogger has joined #pypy
dustinm has quit [Quit: Leaving]
dustinm has joined #pypy
dustinm has quit [Ping timeout: 264 seconds]
dustinm has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
Ai9zO5AP has quit [Remote host closed the connection]
jvesely has quit [Ping timeout: 258 seconds]
dddddd has joined #pypy
<arigo>
rjarry: are you still here? I can answer your question from yesterday
<rjarry>
arigo: I'm here
<arigo>
so the problem is that "some_c_data = ffi.new()" is always wrong
<rjarry>
ah
<arigo>
because it's equivalent to:
<arigo>
obj = ffi.new()
<arigo>
some_c_data = obj
<arigo>
<forget obj>
<arigo>
and so the result of ffi.new() is immediately freed
<arigo>
you need to keep these obj alive as long as needed
<arigo>
for example, store them in a python list
<rjarry>
that's what I did, and it seemed to fix the issue
<arigo>
OK
<rjarry>
that's rather confusing to have to store them at two places
<arigo>
I guess so
<rjarry>
:)
<arigo>
you can rewrite it like this, too: for ...: lst.append(ffi.new("char *", ...))
<arigo>
and only then call:
<arigo>
carray = ffi.new('char *[]', lst)
<arigo>
(the length of the list determines the length of the array in this case)
<arigo>
(sorry, above, that was lst.append(ffi.new("char[]", x.encode()))
<rjarry>
oh I did not know it was possible
<rjarry>
thanks
<arigo>
in fact if you're calling a C function with 'carray' as argument, you can even just pass 'lst' directly and it will be converted into a C array automatically
<rjarry>
does it work with tuples as well?
<arigo>
not sure
<arigo>
or maybe lists or tuples but not general iterables
<arigo>
yes, exactl
<arigo>
y
<arigo>
lists and tuples are accepted because we have a guarantee that objects inside are kept alive until after the C call is done, because the list or tuple object stays alive. With a general iterator we have no such guarantee
<rjarry>
awesome, thanks
jacob22 has quit [Read error: Connection reset by peer]
jacob22 has joined #pypy
lritter has quit [Quit: Leaving]
Ai9zO5AP has joined #pypy
BPL has joined #pypy
jcea has joined #pypy
YannickJadoul has joined #pypy
BPL has quit [Read error: Connection reset by peer]
otisolsen70 has joined #pypy
oberstet has joined #pypy
xcm is now known as Guest81365
Guest81365 has quit [Killed (livingstone.freenode.net (Nickname regained by services))]
xcm has joined #pypy
marky1991 has quit [Ping timeout: 260 seconds]
marky1991 has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
xcm has quit [Ping timeout: 240 seconds]
xcm has joined #pypy
marky1991 has quit [Ping timeout: 264 seconds]
yajadoul has joined #pypy
YannickJadoul has quit [Ping timeout: 265 seconds]
Ai9zO5AP has quit [Ping timeout: 240 seconds]
xcm has quit [Remote host closed the connection]
marvin has quit [Remote host closed the connection]
marvin has joined #pypy
xcm has joined #pypy
marky1991 has joined #pypy
marky1991 has quit [Remote host closed the connection]
yajadoul has quit [Read error: Connection reset by peer]
<arigo>
no. I didn't even get the "ping" message
<arigo>
I guess you wrote it just before I finally found out how to get a mail for all messages
<mattip>
:)
<arigo>
it's not working correctly even now
<arigo>
well, or maybe I need to manually visit all old merge requests and click "Notification"?
<arigo>
sounds nonsense but hey
<arigo>
seems that half the old issues have the "Notification" set and half not, for me. Randomly
<arigo>
marmoute: I fail to find the logic or how to fix the situation. the problem for me is that randomly, half the existing issues and merge requests on pypy/pypy and pypy/cffi have the "Notification" set, and half not
<arigo>
(for me I would be happy with "always get all notifications about everything in all cases" and then see later if I need to add some mail filters to prioritize them)
<mattip>
I think they need to actively request to link with python27.lib on windows if they do that, but I wonder when/what changed?
<arigo>
uh no?
<arigo>
ah yes, sorry
<arigo>
it's in my inbox
<mattip>
The pragma in pyconfig.h is "if defined(_MSC_VER) && !defined(_CFFI_)"
<arigo>
right
<mattip>
but the cffi part has been there since 5/2015
<arigo>
strange
<arigo>
maybe it's using a different compiler, too?
<mattip>
it seems to be using a correct compiler for that version, C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe
<arigo>
I mean, the compiler might be different in the 7.2.0 vs 7.3.0 runs he did, so maybe the difference is there
<mattip>
it fails to build on the machine that runs the win32 buildslave
<mattip>
but numpy (not cffi) builds fine
<arigo>
but does it work on the same machine with 7.2.0?
* mattip
trying to check
otisolsen70_ has joined #pypy
<mattip>
7.2.0 builds with the older Studio 9.0 compiler, and succeeds
<mattip>
maybe 7.3.0 - which uses the older compiler too?
otisolsen70 has quit [Ping timeout: 256 seconds]
<mattip>
7.3.0, with the old compiler, also fails
<mattip>
so maybe something nw in cffi 13.2 vs cffi 13.0 or setuptools 41.2 vs setuptools 28.8?
<mattip>
updating setuptools to 41.2 on the older pypy - it still compiles and links
<mattip>
even when I move python27.lib away, the compilation passes
otisolsen70_ has quit [Quit: Leaving]
<mattip>
uhh, duhh. The code has a #if version pragma, of course it changed
oberstet has quit [Read error: Connection reset by peer]
oberstet has joined #pypy
<arigo>
I see
<mattip>
... and now heptapod is down
<mattip>
ahh, back up. I am answering why PyPy demands he do the right thing when CPython lets him cheat
dmalcolm__ has quit [Ping timeout: 256 seconds]
<arigo>
there was (and still is) a banner on top of heptapod pages warning us of a few minutes downtime just now
<arigo>
apparently it was really just a few minutes :-)
<mattip>
heh, I glanced at it and thought it had to do with the longer downtime on Mon
<arigo>
mattip: merged the cffi PR
<arigo>
sorry it took so long
<mattip>
thanks
dmalcolm has joined #pypy
<mattip>
merge to pypy default/py3.6?
<mattip>
well, default definitely needs it now for the newer compiler
<arigo>
sure. should I run pypy/tool/import_cffi.py?
<arigo>
hum, you did two commits 127fefd15a2b and ee8a8648aade inside extra_tests/cffi_tests/, they will be lost when we run import_cffi.py. Should I also backport them first into cffi?
<mattip>
arig
<mattip>
arigo: whichever makes more sense to you
<arigo>
also, bcb0c566c840
* mattip
zzzz
<mattip>
I can take a look tomorrow
<arigo>
I see that the idea that extra_tests/cffi_tests should be an exact copy of cffi's didn't quite stick :-)
<arigo>
there's at least one file added by ronan and renamed by you, which is not removed by import_cffi only because import_cffi is lazily written and doesn't try to remove files when it copies them
marky1991 has quit [Ping timeout: 265 seconds]
lritter has joined #pypy
marky1991 has joined #pypy
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
yajadoul has joined #pypy
YannickJadoul has quit [Ping timeout: 256 seconds]