arigato 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 | mac OS and Fedora are not Windows
danieljabailey has quit [Quit: ZNC 1.6.6+deb1ubuntu0.1 - http://znc.in]
danieljabailey has joined #pypy
lritter has joined #pypy
speeder39_ has quit [Quit: Connection closed for inactivity]
jcea has quit [Quit: jcea]
themsay has joined #pypy
xcm has quit [Remote host closed the connection]
<Curi0> is there a way to save the jit ?
xcm has joined #pypy
<ronan> Curi0: not sure what you mean by that, but the answer is probably no
dddddd has quit [Remote host closed the connection]
glyph has quit [Quit: End of line.]
glyph has joined #pypy
glyph_ has joined #pypy
glyph has quit [Ping timeout: 250 seconds]
glyph_ is now known as glyph
lritter has quit [Ping timeout: 250 seconds]
lritter has joined #pypy
jacob22__ has quit [Ping timeout: 252 seconds]
Remi_M has joined #pypy
themsay has quit [Ping timeout: 250 seconds]
dddddd has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-linux-s390x/builds/954 [mattip: force build, py3.5]
lritter has quit [Quit: Leaving]
antocuni has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
jacob22__ has joined #pypy
<cfbolz> mattip: Re datetime, in some way we should submit these fixes back to CPython, but it's probably just going to produce a gigantig discussion
dddddd has quit [Remote host closed the connection]
antocuni has quit [Ping timeout: 250 seconds]
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
marky1991 has joined #pypy
<cfbolz> xorAxAx: thanks, fixed
<cfbolz> xorAxAx: you coming, btw?
<mattip> cfbolz: we would need to add the extra_tests/test_datetime.py too
<mattip> in fact, much of extra_tests could be upstreamed
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
<cfbolz> mattip: yeah
marky1991 has quit [Ping timeout: 268 seconds]
joannah has joined #pypy
joannah has quit [Quit: Page closed]
vstinner has joined #pypy
<cfbolz> vstinner: wanna come to the sprint? ;-)
<vstinner> cfbolz: yes, i'm interested, but the date is not perfect. i attend Devconf.CZ at January 25-27
<cfbolz> Ah, damn
<vstinner> cfbolz: it's a whole week?
<cfbolz> Yes
<cfbolz> Six days
<vstinner> cfbolz: is it once a yeah?
<vstinner> year*
<cfbolz> Sort of varying schedules
<cfbolz> Usually we have one a year though, yes
<vstinner> cfbolz: ok. to be honest, my largest project related to PyPy is to find a way to modify the C API
Rhy0lite has joined #pypy
<cfbolz> vstinner Yes sure, would be a good place to discuss. But I admit that doing two things next to each other sounds too stressful
<vstinner> i like arigato's idea of using an opaque PyHandle
<mattip> as someone writing alot of c-api code, I admit a new c-api is a hard sell. There is just so much code and tooling around it
<mattip> moving NumPy/Scipy/Pandas to a newer c-api will be difficult
<vstinner> mattip: i plan to add a new C API *and* keep the existing one, https://pythoncapi.readthedocs.io/
<vstinner> mattip: there is no need to modify numpy at this point
<mattip> but then what do you gain?
<mattip> better in my opinion to invest in something like njs's idea for an IR like rpython or webassembly
<vstinner> mattip: it's a very complex problem with multiple sub-issues
<vstinner> one issue is that people are not aware that it's an issue :)
<vstinner> another issue is that Python is reduced to CPython, and to one implementation of CPython
<vstinner> i would like to promote the idea of having multiple Python runtimes
<vstinner> IMHO one simple way to do that would be have to working runtime in debug mode mode
<vstinner> currently, python3-dbg is not usable since it uses a different ABI
<mattip> I know of groups using iron python, pypy. They would like to not have to deal with the C-API at all
<vstinner> mattip: sorry but this way is a deadend IMHO
<mattip> would love to meet with you and discuss why you feel that way. In the mean time you (and PyPy)
<mattip> are investing alot of effort into revamping something that shouldn't be touched, rather
<mattip> that energy should be going into solving the root issue - as I said before. Getting tooling around moving off the C-API
<mattip> for instance, why should QT be using SIP to generate C-API bindings, when cppyy or cffi could do the work
antocuni has joined #pypy
<tos9> (FWIW +1 as an end user I just wish the C API would die entirely.)
<mattip> why should cython not be using annotations and developing a new backend without the c-api?
<vstinner> mattip: my constraint is that i'm mostly alone to work on designing a new C API
<vstinner> other people mostly complain and tell me that i'm going to fail, that the project is useless and counter-productive, etc. :)
<vstinner> i cannot fix all issues
<vstinner> i'm trying to find a working solution that i can implement alone :)
<mattip> vstinner: some people like to work alone. I would rather work in a group, even if it means I don't get to decide the agenda
<vstinner> oh, i don't want to work alone. it's just that nobody came up to me to offer their help :)
<mattip> for instance, I think numpypy is a much better numpy, but when it became clear I was alone, I moved to cpyext, and had more success
<vstinner> even if i tried to make as much noise as i can
<antocuni> what is arigato's "PyHandle" idea?
<vstinner> "something like njs's idea for an IR like rpython or webassembly" doesn't seem realistic with the current state of CPython
<xorAxAx> cfbolz, very likely
<xorAxAx> i will add myself when i know more details about availability
<vstinner> mattip: dropping the C API or moving to webassembly doesn't solve the problems that i described in my doc
<xorAxAx> i can also host people at my place, its 80 minutes door-to-door to HHU
<vstinner> mattip: in short, my problem is that take a simple C extension from PyPI, convert it, and it now uses a stable ABI working on PyPy and CPython and don't access to implementation details
<cfbolz> xorAxAx: ah, where is that?
<xorAxAx> cfbolz, essen-altendorf
<mattip> vstinner: "don't access implementation details" is not worht the effort in my opinion
<vstinner> mattip: what do you mean?
<xorAxAx> mjacob, you are also invited given that you might be still a student
<mattip> what is the use case that you are serving by hiding the details? Is that use case widespread enough to justify the change?
<xorAxAx> ah, it might be even less than 80 minutes if we go by car
<xorAxAx> (then its 45 min.)
<vstinner> mattip: i would like to be able to distribute a single binary working on multiple versions of Python and working on PyPy
<vstinner> mattip: i'm working for Red Hat and packaging is painful :)
<mattip> sorry, not convinced. Conda and docker have solved the problem for most users, even those behind firewalls
<mattip> packaging problem
<mattip> performance - I do not see how the new C-API solves PyPy's problem of looking into the C code to JIT it
<mattip> that is where njs's idea shines
<antocuni> I think that the two ideas are complementary, not exclusive
<mattip> it is not just PyPy's problem, that is also the problem with numba, dask, jax ...
<vstinner> mattip: "looking into the C code to JIT" i don't understand that
<vstinner> mattip: are you talking about a function calling PyObject_GetItem()?
<vstinner> mattip: do you want to inline PyObject_GetItem() or do you need to know what does PyObject_GetItem()?
<mattip> no. I am talking about not having a pyobject at all
<vstinner> mattip: i would like to make PyObject optional. my question is how can we move towards that?
<mattip> sorry, I am not explaining myself well.
<vstinner> mattip: we cannot jump immediately to the solution, we need small steps (milestones)
<mattip> that is why I would like to meet you and discuss
<vstinner> we are talking :)
<vstinner> i propose arigato to talk by video, i would like to understand his proposal
<vstinner> but he seems to be away
<mattip> people do not like writing C (well, normal developers)
<mattip> we force them to, to get performance
<antocuni> speaking of this hypotetical PyHandle, we should also discuss whether it makes sense to have an API similar to what Java/JNI does to handle GC references: https://www.ibm.com/support/knowledgecenter/en/SSYKE2_8.0.0/com.ibm.java.vm.80.doc/docs/jni_gc.html
<antocuni> TL;DR: when you pass an object to C, by default it is a "local reference" which is valid only until the function returns; if you want to store it somewhere, you need to upgrade to a "global reference"
<vstinner> mattip: sorry but i don't get your point
<antocuni> this would save entirely the need of filling the PyHandle table, as long as you don't upgrade them
<vstinner> mattip: people do write C, they are plenty of C extensions all around. that's just a fact
<vstinner> mattip: you cannot ignore the giant pile of C extensions used in the wild
<mattip> how likely is it really that they will move to a new c-api? Most of them will never move
<mattip> the live ones would happily move to a more expressive performant paradigm, if it was easy
<mattip> not just "trade a pyobject for a pyhandle" and get really nothing out of the deal
<mattip> I don't beleive CPython will get a 2x performance boost by using this new API. Can you convince me it is true?
<vstinner> mattip: my plan is to provide converters, so you don't have to port code yourself. "setup.py install" will magically do the trick :)
<vstinner> (sorry, i start a meeting)
<mattip> sounds like 2to3, and we know there are corner cases taht don't work
<mattip> In the mean time, your work toward this goal, that many people do not believe in, causes cpython reviewers to work for you
<mattip> checking your PRs and replying to mails
<mattip> when that energy could go toward something else, maybe
<mattip> I work full time for NumPy, but my goals are set by the community via a roadmap
adamholmberg has joined #pypy
jcea has joined #pypy
<arigato> antocuni: that's similar, I think. A C function would be called with PyHandle arguments, and these are definitely valid only for the duration of the call. You'd need to make a copy with pyhandle_dup(), just like right now you need to Py_INCREF() them in order to store them somewhere for later
<arigato> on PyPy there would still be one indirection via the table, but this indirection is really needed, because moving gc
<antocuni> arigato: well, not necessarily but it depends on how you define the API of course. E.g. by reading your python-dev email, I got the impression than a PyHandle is valid until you call PyHanlde_Close
<arigato> yes, for handles returned to you by a function call you did
<arigato> for handles that are passed in as arguments to a Python-exposed C function you implement, the lifetime is managed by the caller
<antocuni> ah I see. If you just *receive* a handle as an argument, the caller owns it and you are not allowed to close
<antocuni> makes sense
<arigato> yes
<antocuni> I wonder why JNI didn't do that then?
<arigato> also, the "table" implementation is still open to possible optimizations, like storing an integer object by just copying it into the table and not having any extra memory allocated
<arigato> or in general (in theory) storing in the table whatever exploded representation comes from our JIT
<antocuni> yes, that's basically tagged pointers, but only for objects which are proxied by handles
<arigato> in my PyHandle approach that would be all of them
<arigato> all of them from the point of view of the C extension
<antocuni> yes exactly. What I meant is that objects which are NOT passed to cpyext don't get a handle at all
<arigato> right
<arigato> and yes, unsure why JNI needs separate notions of local vs global references
<antocuni> maybe to avoid the double indirection?
<antocuni> if you have local/global refs, you can just keep the local refs alive around the C call and pass the raw pointer
<arigato> right, maybe local references come with pinning?
<antocuni> it seems not
<antocuni> here it explicitly says that you have at least one level of indirection
<arigato> maybe the difference is that they need fully concurrent GCs
<arigato> so a global reference would contain more stuff to make sure it works even if another thread moves the object
<arigato> concurrently
<arigato> it's a problem we can avoid by not touching the GIL---saying "don't call the C API if you don't own the GIL"
<Hodgestar> vstinner: I'm not sure small steps are necessarily better if moving through the steps is painful and requires people to repeatedly do work. I don't think people would have a problem with a big change if the old way still worked (e.g old C-API) and the new way was much better (e.g. new PyHandles).
<Hodgestar> With both Python 3 and CFFI people started writing new stuff using them, and the old stuff didn't go away, even though they were big steps.
<cfbolz> arigato: I like this proposal. I still wonder whether we can find something to offer to CPython users to entice them to use the new API
<Hodgestar> cfbolz: Maybe the answer to that is to find something that isn't PyPy that would benefit and get them onboard? No idea what the something might be though at the moment. :|
<antocuni> note that unfortunately it's not enough to make cpyext faster, because currently we never measured the gc-to-pyobject* code as a bottleneck
dddddd has joined #pypy
<cfbolz> :-(
<arigato> cfbolz: I think one milestone would be if Cython would generate C code targetting the new C-API
<cfbolz> Yes, but again that would mostly benefit PyPy users, no?
<arigato> directly, yes
<arigato> still, even if we get "only" that, it's very interesting for PyPy
<arigato> but maybe more to the point when talking about the future of Python:
<arigato> this simpler C API would allow more projects to experiment with CPython or CPython-like approaches
<cfbolz> Well, I like cython like approaches, because at least in theory cython could have a totally different backend that also produces eg jit codes
<cfbolz> So we could inline into the C extension
<cfbolz> (which as mattip points out is what we would *really* need)
<arigato> right
<arigato> there are two things here, one is what you're saying and the other is what might make sense for the future of Python
<cfbolz> Yes
<cfbolz> We probably need both of these things. At least if we want to have a way for CPython out of its local maximum
<mattip> if the code no longer is succeptible to refcount bugs, that is a significant +
<arigato> there are still issues though
<arigato> the major one I foresee is that, assuming the CPython implementation is done just as "a PyHandle = a PyObject *",
<arigato> then you have potential problems because calling pyhandle_dup(x) would just return x, after incrementing the reference counter,
<arigato> and then possible bugs where people store the wrong x and it works fine on cpython
<mattip> maybe a summit of cython, sip, pypy, dask, numba, mypyc, swig, cffi, cppyy, pybind11, ... maintainers would be helpful
<arigato> we could mitigate that issue a little bit by using another, slower implementation (e.g. when compiling in debug mode) but still
<arigato> and of course you still have the risk that someone forgets to close a handle
xcm has quit [Ping timeout: 244 seconds]
<cfbolz> arigato: the latter is like forgetting how to decref, right?
<arigato> yes
xcm has joined #pypy
<cfbolz> mattip: yes, that would make sense. Though one risk in adding more project is that nothing gets done because of too many possible directions and concerns
<antocuni> arigato: one nice advantage of PyHandle is that in theory you can have a debug mode which tells you EXACTLY which handle you forgot to close
marky1991 has joined #pypy
<antocuni> much better than debugging missing decrefs
<arigato> yes
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
<cfbolz> Nice
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
xcm has quit [Read error: Connection reset by peer]
xcm has joined #pypy
squeaky_pl has joined #pypy
<squeaky_pl> mattip, there is a typo in the blog post, it says multilinux2010 instead of manylinux2010
<mattip> squeaky_pl: thanks, and hi!
<mattip> btw, those are just some suggested topics, other ideas or rejection of those is welcome
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
Zaab1t has joined #pypy
<ronan> mattip: about datetime, arguably it's CPython3.5 that's buggy: https://bugs.python.org/issue31222
<ronan> hmm, I misunderstood, recent CPython still has a discrepancy AFAICT
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
speeder39_ has joined #pypy
adamholmberg has quit [Ping timeout: 250 seconds]
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
antocuni has quit [Ping timeout: 272 seconds]
adamholmberg has joined #pypy
<mattip> I tested the fix I committed against Cpython 3.6.6
<mattip> ronan ^^^
<ronan> I guess we should just upstream the fix (and accept having a diff with cpython in 3.5)
<mattip> ronan: by "diff" you mean diff in python code they do not use or diff in behavior?
<mattip> we could hide our version in lib_pypy, but I doubt anyone really cares
<ronan> diff in the stdlib
<ronan> *diff in the stdlib code
jacob22__ has quit [Ping timeout: 240 seconds]
dddddd has quit [Ping timeout: 250 seconds]
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
squeaky_pl has quit [Remote host closed the connection]
marky1991 has quit [Ping timeout: 244 seconds]
Rhy0lite has quit [Quit: Leaving]
jacob22__ has joined #pypy
Zaab1t has quit [Quit: bye bye friends]
dddddd has joined #pypy
marky1991 has joined #pypy
themsay has joined #pypy
themsay has quit [Read error: Connection reset by peer]
themsay has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
PileOfDirt has joined #pypy
PileOfDirt has quit [Remote host closed the connection]
PileOfDirt has joined #pypy
PileOfDirt has quit [Quit: Leaving]
PileOfDirt has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
xcm is now known as Guest57427
Guest57427 has quit [Killed (tepper.freenode.net (Nickname regained by services))]
xcm has joined #pypy
antocuni has joined #pypy
speeder39_ has quit [Quit: Connection closed for inactivity]