yuyichao_ has quit [Ping timeout: 260 seconds]
nimaje has joined #pypy
yuyichao_ has joined #pypy
jcea has quit [Quit: jcea]
_whitelogger has joined #pypy
ArneBab has joined #pypy
ArneBab_ has quit [Ping timeout: 246 seconds]
pilne has quit [Quit: Quitting!]
sms has joined #pypy
<sms> Hey there guys
<simpson> Hi.
<sms> Sooo..one little question about CFFI, when I create a .so to embed Python, what's the name of the header that I should #include in my C project
<sms> Tried just #include "nameofmyso.h" and it isn't recognized
<simpson> sms: I don't think that you have a header, just an extern declaration.
<simpson> I'm looking at http://cffi.readthedocs.io/en/latest/embedding.html and not seeing anything else.
<sms> Hmm, how do I call my function from the .so then?
<simpson> I think that you just call it. Not sure; I haven't actually used the embedding in this direction.
<simpson> Er, are you linking to it or doing a dlopen()? In the latter, I would *guess*, but don't know for sure, that you'd have to dlsym().
<sms> I'm currently just linking
<sms> I was in the C channel and they said I have to #include a header as well to access the linked lib
<sms> I tried just accessing the function without an #include to no avail
<simpson> Well, do you have an extern declaration of some sort?
<simpson> I would expect a linker error if you have it declared but the linker can't find it.
jamadden has quit [Quit: Leaving.]
<sms> What do you mean by extern declaration simpson
<simpson> sms: Just using `extern` to declare your function.
<sms> Hrm
<sms> When I define it with extern I don't get a linker error
<simpson> And does it run?
<sms> It does, yes
<sms> Actually nevermind, that's a reliable way of checking anyways
<sms> I'm allowed to declare anything as 'extern' without having a linker error
Taggnostr has joined #pypy
Taggnostr2 has quit [Ping timeout: 240 seconds]
<sms> I don't get it
<sms> Why isnt there just an example
<sms> A real simple example
<sms> On a real word embed situation
<sms> world*
<sms> I'd have understood this a day ago
<sms> Just show ONE small bit of C code printing the return of the do_stuff function and it makes sense
<sms> But nope, just goes on to explain what Python is doing
tilgovi has joined #pypy
<simpson> I imagine that the C side of things is relatively uninteresting.
<sms> You're right, but for the sake of thoroughness it'd be nice
<sms> _habnabit: Any idea on how to use the CFFI generated .so file, what is the name of the header file generated?
<_habnabit> sms, oh umm. you caught me slightly offguard; i'm in the middle of something else at the moment
<sms> Alright no problem
Tiberium has joined #pypy
_whitelogger has joined #pypy
inad922 has joined #pypy
mattip has left #pypy [#pypy]
oberstet has joined #pypy
inad922 has quit [Ping timeout: 240 seconds]
amaury has joined #pypy
amaury has quit [Ping timeout: 268 seconds]
amaury has joined #pypy
sms has quit [Ping timeout: 268 seconds]
sms has joined #pypy
<nimaje> sms: a header file in C is normally only a bunch of extern declarations, cffi probably doesn't generate a header, so if you really want a header you write it yourself, but you don't need a header only the declarations
<sms> nimaje: So in the basic embedding example, how do you call the function do_stuff in C?
<LarstiQ> plus the cffi embedding approach encourages a very simple api "You can use CFFI to generate C code which exports the API of your choice to any C application that wants to link with this C code. "
<LarstiQ> sms: the Usage section has an example?
<LarstiQ> sms: the block that says plugin.h
<LarstiQ> typedef struct { int x, y; } point_t; extern int do_stuff(point_t *);
<LarstiQ> for the declartions, and then just call it appropriately
<sms> Why is it declared with point_t* as an argument?
jamesaxl has quit [Read error: Connection reset by peer]
amaury has quit [Ping timeout: 240 seconds]
jamesaxl has joined #pypy
marr has joined #pypy
vkirilichev has joined #pypy
amaury has joined #pypy
vkirilichev has quit [Ping timeout: 260 seconds]
<LarstiQ> sms: you mean why -> dereference instead of . in C terms?
<cfbolz> njs: do you happen to know where the CPython tests for this feature are hiding?
<LarstiQ> sms: the More reading section points to http://cffi.readthedocs.io/en/latest/using.html#working which mentions "The ctype is usually some constant string describing the C type. It must be a pointer or array type. If it is a pointer, e.g. "int *" or struct foo *, then it allocates the memory for one int or struct foo"
vkirilichev has joined #pypy
<cfbolz> sms: would you be up to filing a bug so that Armin knows he should add an example?
inhahe_ has quit [Read error: Connection reset by peer]
inhahe_ has joined #pypy
asmeurer_ has joined #pypy
Tiberium has quit [Ping timeout: 260 seconds]
Tiberium has joined #pypy
asmeurer_ has quit [Ping timeout: 246 seconds]
arigato has joined #pypy
antocuni has joined #pypy
Tiberium has quit [Remote host closed the connection]
<fijal> arigato: hi
<antocuni> arigato, fijal: is there a 32bit chroot on bencher4?
<arigato> hi
<arigato> antocuni: I think not, there is a 64bit Ubuntu chroot I think
<antocuni> arigato: is it possible to create one? Or, to give me sudo powers so I can do it? :)
<antocuni> I don't know if you read the logs, I am debugging an RPython AssertionError which shows up only on 32bit, and bencher4 is incredibly fast at translating things :)
vkirilichev has quit [Remote host closed the connection]
Tiberium has joined #pypy
asmeurer_ has joined #pypy
<arigato> antocuni: I fear I can't give sudo access at all on bencher4
<antocuni> sure, no problem; but could you please create a 32bit chroot then? :)
asmeurer_ has quit [Ping timeout: 240 seconds]
<arigato> it looks not easy
<arigato> bencher4 has a very old debian and the buildslave runs in a more recent chroot
<arigato> both are relatively old nowadays
<arigato> I'm not even sure I want to spend two hours figuring out how to install a 32bit chroot for one of these two old distributions
<sms> LarstiQ: Weird, I got it working using extern int do_stuff(int, int), it was just confusing how the example decided to use a struct instead
asmeurer has joined #pypy
<antocuni> ok :(
<arigato> it's sufficiently a mess that I didn't do it when I first installed the buildslave chroot
<antocuni> this is the reason why the 32bit buildslave is still on tannit, I suppose?
<arigato> yes
<antocuni> ok
<arigato> with modern distros you're not really supposed to use a chroot at all, but have multilib installation or something
<sms> I suppose maybe it was intended to show that you can pass a struct as an arg and that you'd just infer that (int, int) would be no issue
<antocuni> of course I'd happily do it by myself, but I cannot without sudo
<arigato> yes, sorry, I think bencher4 is not the right machine
<sms> But I figured maybe there was some magic going on
<antocuni> ok
<sms> Just ended up confusing me
<arigato> maybe baroquesoftware.com?
<arigato> fijal: ^^
<sms> BUT I have a simple example working now...hopefully smooth sailing from here.
<antocuni> well, I can continue using tannit of course
<fijal> arigato: I'm ok with that
<fijal> feel free to give anto root there
<antocuni> thanks :)
<sms> I really appreciate the help and responses, I'm heading to bed though
sms has quit [Quit: WeeChat 1.8]
asmeurer has quit [Ping timeout: 260 seconds]
arigo has joined #pypy
<antocuni> arigato: so basically, I have translated my faster-rstruct-2 branch on 32 bit and suddenly started to get RPython AssertionError everywhere
<antocuni> inside pyjitpl.py:_opimpl_getfield_gc_any_pureornot
<antocuni> the failing assert is "assert ConstFloat(resvalue).same_constant(
<antocuni> upd.currfieldbox.constbox())
<arigato> I guess it's because you update fields or array items using an unexpected raw write, or something
<antocuni> and I managed to reduce a failing example to this: https://paste.lugons.org/?5cd9333bb238ea3b#8FvMr/jynaEMmldB57WJc33gkRO1PH+Eu2yOb4tJY0M=
<antocuni> yes, cfbolz suggests that it's because I introduced llop.gc_store_indexed, which is not handled e.g. by writeanalyze.py
<arigato> but where is that invoked in this small example?
<antocuni> but it's very weird because my example is very small and doesn't call the new llop at all
<antocuni> yes exactly
arigo has quit [Quit: Leaving]
<antocuni> I don't see how the new llop can introduce this bug. To double-check, I translated again at 892ab4160ec6 (just before I introduced llop.gc_store_indexed) and the bug disappeared
<arigato> I see
<antocuni> so now I am fixing writeanalyze.py hoping that it will fix the bug, but I don't really understand what's going on
<arigato> but 892ab4160ec6 can't add the bug, it's only about tests?
<arigato> you should try to bisect to figure out which exact checkin introduced the problem
<antocuni> arigato: sure, what I mean is that the bug was introduced *after* 892ab4160ec6
<antocuni> bisecting is a bit hard because I discovered that 32 bit translation was broken a bit everywhere during the history
<antocuni> so I have to apply patches from the future to translate
<arigato> still, no other idea
<antocuni> (that's why I was craving for a faster machine, since my translations keep failing :))
<antocuni> ok, let's see what happens with the fixed writeanalyze
<kenaan> antocuni faster-rstruct-2 85d3ab6fe80b /rpython/translator/backendopt/: fix writeanalyze.py to take into account llop.gc_store_indexed
<antocuni> arigato: could you please review this ^^^?
<arigato> I must say I'm skeptical
<arigato> why would this fix a failure that only shows up on 32bit?
<antocuni> I am skeptical as well :(
<antocuni> as I said, I don't really understand what's going on
<antocuni> anyway, I'm off for now, thanks for the help
<antocuni> I started a couple of translations, lets see what happens :)
antocuni has quit [Ping timeout: 255 seconds]
vkirilichev has joined #pypy
vkirilichev has quit [Ping timeout: 240 seconds]
asmeurer has joined #pypy
vkirilichev has joined #pypy
asmeurer has quit [Ping timeout: 240 seconds]
jcea has joined #pypy
arigato has quit [Quit: Leaving]
lritter has joined #pypy
arigato has joined #pypy
amaury has quit [Ping timeout: 260 seconds]
<fijal> their concurrent gc has still pretty sizable pauses
asmeurer_ has joined #pypy
<arigato> "parallel minor collection mode"?
asmeurer_ has quit [Ping timeout: 246 seconds]
girish946 has joined #pypy
arigato has quit [Quit: Leaving]
asmeurer has joined #pypy
asmeurer has quit [Ping timeout: 260 seconds]
t4nk422 has joined #pypy
pilne has joined #pypy
asmeurer has joined #pypy
asmeurer has quit [Ping timeout: 260 seconds]
amaury has joined #pypy
asmeurer has joined #pypy
antocuni has joined #pypy
vkirilichev has quit [Ping timeout: 240 seconds]
asmeurer has quit [Ping timeout: 255 seconds]
arigato has joined #pypy
<antocuni> arigato: fwiw, about my bug: a735e006ad8a seems to work, 3c31e7d36cc9 exhibits the behavior
<antocuni> now I am translating other three random revisions in the middle of them, although none of this seems related to the bug
<antocuni> I am wondering whether the bug was already there and it only manifest itself randomly, depending on some detail which might vary between translations
<antocuni> like the order of jitcodes or things like that. This would at least help to explain why I get it only on 32 bit
<arigato> all obscure
girish946 has quit [Quit: Leaving]
vkirilichev has joined #pypy
<kenaan> arigo cpyext-obj-stealing fb0a61fd753d /pypy/: Tweaks and simplifications A few "pointless" operations have been added which I removed again; I'm uns...
t4nk422 has quit [Quit: Page closed]
asmeurer has joined #pypy
vkirilichev has quit [Remote host closed the connection]
asmeurer has quit [Ping timeout: 240 seconds]
arigato has quit [Quit: Leaving]
oberstet has quit [Ping timeout: 246 seconds]
asmeurer has joined #pypy
asmeurer has quit [Ping timeout: 260 seconds]
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #pypy
vkirilichev has joined #pypy
adeohluwa has joined #pypy
Tiberium has quit [Remote host closed the connection]
<antocuni> so, 77c4134d96d9 is good, 3c31e7d36cc9 is bad; testing 196fb3e1e9b3 now, although it still does not make any sense
nimaje1 has joined #pypy
nimaje1 is now known as nimaje
nimaje has quit [Killed (wolfe.freenode.net (Nickname regained by services))]
tos9_ has joined #pypy
tos9 has quit [Ping timeout: 240 seconds]
tos9_ is now known as tos9
tos9 has quit [Ping timeout: 255 seconds]
Tiberium has joined #pypy
oberstet has joined #pypy
tos9 has joined #pypy
antocuni has quit [Ping timeout: 246 seconds]
tbodt has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jamesaxl has quit [Ping timeout: 240 seconds]
oberstet has quit [Quit: Leaving]
arigato has joined #pypy
mattip has joined #pypy
<mattip> arigato: thanks for looking at cpyext-obj-stealing, the goal indeed was to make pypy pass this test, especially the "if (tmp != i2) {fail}" part
asmeurer has joined #pypy
asmeurer has quit [Ping timeout: 240 seconds]
vkirilichev has quit [Ping timeout: 258 seconds]
jcea1 has joined #pypy
jcea has quit [Ping timeout: 240 seconds]
jcea1 is now known as jcea
jamesaxl has joined #pypy
asmeurer has joined #pypy
asmeurer has quit [Ping timeout: 240 seconds]
<ronan> is there actually any point to strbufobject?
<ronan> I'm tempted to kill it
asmeurer has joined #pypy
* mattip looking at hg blame for strbufobject to try to figure out why it exists ...
<arigato> mattip: so, I'm +1 to merge both your cpyext branches
<mattip> ok, thanks, and thanks for the review/rewrite
<arigato> ronan: it's an attempt that might be merged to default at some (long) point
<arigato> this or something similar
<arigato> more precisely, it attempts to fix the "string += string" complexity difference in some cases, but so far it fails to fix it in all the CPython cases
<ronan> arigato: well, it seems to have been there since 2010, and never did anything except cost maintenance time
<ronan> I don't see how it can possibly help with the string += string case
asmeurer has quit [Ping timeout: 255 seconds]
<ronan> (unless we modify semantics or find a way to mimic the 'refcount == 1' hack)
tilgovi has joined #pypy
tbodt has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
arigato has quit [Read error: Connection reset by peer]
tbodt has joined #pypy
arigato has joined #pypy
<arigato> ronan: it works in many cases where CPython does, and I think the remaining cases are documented somewhere but I don't remember them
<ronan> what are the cases where it works?
<arigato> the naïve "s += some_string" in a loop
<arigato> for example
<ronan> no, that forces the string for every concatenation after the first one
<arigato> if you're right then strbufobject.py has no point, but I think you're wrong
vkirilichev has joined #pypy
<arigato> if you show me an example or convince me of strbuf forcing all intermediate strings in the simple example, then yes, it can be killed
<arigato> the point is that when I wrote it, it didn't
Tiberium has quit [Remote host closed the connection]
<arigato> you have to do nothing with the intermedate strings
<arigato> just call "+="
<arigato> or "s = s + some_string"
<arigato> the old 's' stays around until the next GC, of course, and the new 's' is longer, but they share the same StringBuffer object
<arigato> ...StringBuilder object
<ronan> ah, you may be right
<arigato> anyway, it's probably killable anyway
<arigato> there's another alternate implementation of strings that we should play with
<arigato> something having a raw buffer
<arigato> maybe we could come up with such an implementation that also supports concatenation
<ronan> well, the case 'for x in xs: s += x' is the one people keep complaining about
<arigato> or, maybe we keep strbufobject but need to tweak heuristics so that it's invoked less eagerly
<arigato> yes
<arigato> but well, the point is that I'm not completely sure they don't have code that is more complicated
<ronan> if it works for that case, then why don't we enable it?
<arigato> e.g. for x in xs: if s.endswith('.'): rare_case; s+= x
<arigato> the answer is complicated, but there are three factors
<arigato> (1) it doesn't work in all cases where CPython's version works
<arigato> (2) this kind of "just checking something on 's'" will make it stop working
<arigato> (3) the impact on JITted code is not completely clear, e.g. how many extra bridges it makes
vkirilichev has quit [Ping timeout: 240 seconds]
<arigato> so, I think the status has always been "needs more work", to study and fix (3), and to make more of (2) cases still working
<ronan> I see
<ronan> using StringBuilder doesn't seem like a good choice for (2)
<arigato> indeed
<arigato> so maybe it needs (4) to be unified with a raw-string implementation
<kenaan> mattip cpyext-unhashable 552622605578 /pypy/module/cpyext/: test, fix for unhashable c-api objects
<kenaan> mattip default 158d97f6e1eb /pypy/: merge cpyext-obj-stealing which improves PyListObject refcounting compatibility
<kenaan> mattip default 17fddf817604 /pypy/module/cpyext/: merge cpyext-recursionlimit which implements Py_EnterRecursiveCall and friends
vkirilichev has joined #pypy
<kenaan> mattip default dba4bf058212 /pypy/doc/whatsnew-head.rst: document merged branches
<arigato> mattip: if my latest change to cpyext-obj-stealing broke pandas again, sorry about that
<arigato> I didn't test
<mattip> as long as that test passes, all should be good, AFAICT
<arigato> yes, all our tests pass
<arigato> but I had to tweak them a bit
<arigato> or at least, I *did* tweak them because they were relying on obscure details
<arigato> e.g. storing a string in a list, and then getting the item, might get you a different object because of the list-of-strings strategy
<arigato> and then the reference count of that different object has no relation with the original object's
<arigato> I think that's why you added a hack to force the CPyListStrategy in PyList_New()
<mattip> that was the problem I was trying to fix, and it seems you even tightened this test, maybe more tests are needed
<arigato> yes, but I removed that change to PyList_New(), which I *think* is fine and all our tests pass
<mattip> +1
<arigato> but it's possible that it makes some refcounts behave apparently strangely, again
<arigato> notably if you store strings or ints or floats, which are not really stored
<arigato> ...at least with PyList_Append()
<arigato> which doesn't force the CPyListStrategy
<arigato> with PyList_SET_ITEM, then it would force the CPyListStrategy, so everything should work as expected
<mattip> PyList_Append is very rarely used
<arigato> ok
<mattip> uhh, maybe I am wrong, cython tends to use it :(
<arigato> maybe PyList_New(n) should really make a CPyListStrategy, but then it would be better if it did so immediately, instead of making a regular list of Nones and converting it...
<ronan> arigato: so, should we keep strbufobject? It does work, but we're never going to enable it as is
<arigato> ronan: could we move it to a branch somehow? e.g. create the branch "strbufobject" and then remove it from default
<ronan> arigato: we could remove it and backout that commit on a branch
<arigato> right
asmeurer has joined #pypy
<mattip> arigato: I have moved back to numpy, and am trying to iron out the last ~12 test failures
<arigato> cool
<mattip> in hopes that if we can get a green build, they will add us to the CI
<arigato> +1
<arigato> for trying it :-)
asmeurer has quit [Ping timeout: 240 seconds]
* ronan creating branch strbufobject
<mattip> other than strbufobject, there are some random test failures on default
<ronan> mattip: we should probably just kill the flaky tests
<mattip> some of them seem more that just flaky, like the swapped ctypes one
* mattip zzz
<mattip> bye
mattip has left #pypy ["bye"]
<kenaan> rlamy default c74e33eeef0d /pypy/: Remove unused translation option 'withstrbuf' and supporting code
<kenaan> rlamy strbufobject fb38f51ca654 /: A branch to play with W_StringBufferObject (recently deleted on default)
<kenaan> rlamy strbufobject 8c65231e844b /pypy/: backout c74e33eeef0d: undelete W_StringBufferObject and withstrbuf config option
<ronan> arigato: ^^^ I hope that's what you meant
tbodt has quit [Remote host closed the connection]
<arigato> ronan: yes, thanks
* arigato zzz
arigato has quit [Quit: Leaving]
tilgovi has quit [Ping timeout: 272 seconds]
asmeurer has joined #pypy
asmeurer has quit [Client Quit]
<kenaan> rlamy py3.5 64deec640157 /: hg merge default
asmeurer__ has joined #pypy
tilgovi has joined #pypy
<kenaan> mattip default c971f0f22925 /pypy/module/cpyext/listobject.py: fix translation
tilgovi has quit [Ping timeout: 240 seconds]
asmeurer__ has quit [Quit: asmeurer__]
tbodt has joined #pypy
antocuni has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tbodt has joined #pypy
adeohluwa has quit [Quit: Connection closed for inactivity]
antocuni has quit [Ping timeout: 268 seconds]
vkirilichev has quit [Remote host closed the connection]
vkirilichev has joined #pypy
tilgovi has joined #pypy
vkirilichev has quit [Ping timeout: 240 seconds]
marr has quit [Ping timeout: 240 seconds]
<kenaan> rlamy py3.5 709ffd0a77bc /pypy/module/cpyext/listobject.py: hg merge default