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
jcea has quit [Ping timeout: 245 seconds]
mgorny has quit [Ping timeout: 250 seconds]
mgorny has joined #pypy
mgorny has quit [Read error: Connection reset by peer]
mgorny has joined #pypy
exarkun_ has joined #pypy
exarkun has quit [Ping timeout: 245 seconds]
fijal has quit [Ping timeout: 245 seconds]
fijal has joined #pypy
oberstet has joined #pypy
Ashleee has quit [Ping timeout: 245 seconds]
Ashleee has joined #pypy
<arigato> hi
<cfbolz> hi armin :-)
<arigato> what's the proper way to execute tests on py3.7 from pypy/module/test_lib_pypy/?
<arigato> there's a README.txt but I can't get it to work anyway
<arigato> are these tests even run by buildbot or not at all?
<cfbolz> I always get confused by that directory too :-(
<cfbolz> arigato: I think the answer is: "use extra_tests" instead?
<arigato> right, but does it mean we have a number of tests that are never run, and corresponding functionality which is untested?
<cfbolz> good question indeed
<cfbolz> right, I get a problem with our conftest if I try to run it as the readme says :-(
<cfbolz> indeed, on py2 I can use the vendored pytest to run them, but not on py3 of course
<arigato> yes
<arigato> 'extra_tests' works as advertised, at least
<cfbolz> yes (but they aren't fun to run untranslated)
<arigato> unsure what I'm looking at
<arigato> ah
<arigato> 9 of these test files are completely skipped
<arigato> looking at the test_greenlet_*.py, they are skipped because "No module named __pypy__"
<cfbolz> uh, wat
<arigato> so... are they just run on top of cpython, testing cpython?
<cfbolz> seems I am getting lost again
<cfbolz> right, that's what -A means, doesn't it?
<cfbolz> :-(
<cfbolz> not very useful to *just* run them that way
<arigato> they test specifically that the code we wrote in lib_pypy works, independently on where
<arigato> I guess?
<cfbolz> I suppose
<arigato> that means that test_greenlet_* are pointless in there, because lib_pypy/greenlet imports _continuation
<arigato> I'll try to move them to extra_tests
gef_ has quit [Ping timeout: 268 seconds]
gef has joined #pypy
<cfbolz> arigato: I mean, do they pass?
<arigato> yes
<cfbolz> phew, good
<arigato> trying only now to make the first change to greenlet that really belongs to py3.7 and not default
<cfbolz> arigato: that's the contextvars one?
<arigato> yes
<cfbolz> nice
<cfbolz> let me know how that goes, I think I implemented contextvars
<arigato> OK
<cfbolz> (they could be better, they need an implementation of a clojure-style immutable map data structure, which is hidden in CPython despite it being generally cool. in pypy it's just pure python)
<arigato> let me see if I get this detail correctly: this 900-lines-of-python _immutables_map is here *only* for contextvars, and *only* to guarantee that copy_context() runs in constant time, right?
<cfbolz> arigato: log time but yes
<cfbolz> it's a very nice data structure! I would totally understand if they had also put it into collections, but "nobody got around to it" or something
<arigato> CPython uses the same one?
<arigato> then "The function has an O(1) complexity" is a lie?
<arigato> on their docs
<cfbolz> arigato: yes, cpython has the same one in C, the python implementation is also from them I think
<cfbolz> re complexity: hm
<cfbolz> right, copying is probably O(1), lookup is O(log(n))
<arigato> bah
<arigato> in a language where dicts are central to everything, you'd think someone might mention that this dict-like lookup is actually slower
<cfbolz> :-)
<cfbolz> arigato: but it would be so cool to have it in rpython, and be able to add an @elidable to lookup!!!
papangoo[m] has quit [Ping timeout: 245 seconds]
papangoo[m] has joined #pypy
<arigato> of course I find strange behaviours in greenlet's contextvars, which I'm not sure yet to call a bug of greenlet, of cpython, or just me not understanding
<arigato> can you think of a case where calling "contextvars.copy_context()" on its own, ignoring the return value, can have any effect?
<cfbolz> arigato: like the CPython implementation? :-(
<cfbolz> arigato: uh, I would hope it does nothing?
<cfbolz> ah no, I see. if there isn't already a context it makes one?
<arigato> yes, and then you shouldn't be able to tell the difference, ideally
<cfbolz> but you are?
<arigato> with greenlets, yes
<cfbolz> :-(
<arigato> well they give was is essentially a way to __pypy__.get_contextvar_context(), so sometimes you get None and sometimes you get an empty context
<arigato> s/was/what
<cfbolz> right
<cfbolz> so somehow that should do the same thing as copy_context: if there isn't one, set an empty one, so that it's not observable?
<arigato> yes, but it doesn't do that, so too bad
<arigato> indeed, the context I get as list(items())==[]
<arigato> s/as/has
<arigato> ah I see (maybe)
<arigato> ...no i don't
<cfbolz> :-)
<arigato> (the current issue is that there are tests that distinguish between None and an empty Context, and I can't understand the greenlet-on-cpython exact behavior
<cfbolz> yeah, it's entirely possible that the details around that are different on pypy
<arigato> OK that's nonsense and I'll give this detail up
<arigato> if I change the test like this, later some gr_context attribute reads as None or as an empty Context:
<arigato> greenlet(lambda: copy_context().run(_increment))
<arigato> greenlet(partial(copy_context().run(_increment))
<cfbolz> eh wat
<arigato> greenlet(partial(copy_context().run,_increment)) sorry
<arigato> aaaaaaaaaaa
<arigato> of course these two lines are NOT equivalent
<arigato> copy_context() runs either later in the new greenlet, or right now
<arigato> if we run copy_context() now, then the new greenlet is created with None as its contextvars_context, and the run() method of the already-existing Context object restores None in CPython
<arigato> but doesn't do that in PyPy
gef_ has joined #pypy
gef has quit [Ping timeout: 240 seconds]
exarkun_ is now known as exarkun
nopf has quit [Quit: Lost terminal]
jcea has joined #pypy
gef_ has quit [Ping timeout: 252 seconds]
gef has joined #pypy
jcea has quit [Read error: Connection reset by peer]
lritter has joined #pypy
lritter has quit [Quit: Leaving]
oberstet has quit [Remote host closed the connection]
gef_ has joined #pypy
gef has quit [Ping timeout: 245 seconds]
lritter has joined #pypy
lritter has quit [Quit: Leaving]
gef has joined #pypy
gef_ has quit [Ping timeout: 252 seconds]
gef_ has joined #pypy
gef has quit [Ping timeout: 260 seconds]