antocuni changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://botbot.me/freenode/pypy/ ) | use cffi for calling C | "PyPy: the Gradual Reduction of Magic (tm)"
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Ping timeout: 255 seconds]
adamholm_ has joined #pypy
zmt01 has quit [Quit: Leaving]
tbodt has joined #pypy
zmt00 has joined #pypy
adamholm_ has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Ping timeout: 240 seconds]
<raynold> ahh it's a wonderful day
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
Guest83823 has quit [Ping timeout: 240 seconds]
marvin has joined #pypy
marvin is now known as Guest31809
jacob22 has quit [Ping timeout: 260 seconds]
jacob22 has joined #pypy
yuyichao has quit [Ping timeout: 260 seconds]
yuyichao_ has joined #pypy
exarkun has quit [Read error: Connection reset by peer]
yuyichao_ has quit [Ping timeout: 246 seconds]
exarkun has joined #pypy
yuyichao_ has joined #pypy
pilne has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
jcea has quit [Quit: jcea]
exarkun has quit [Ping timeout: 240 seconds]
exarkun has joined #pypy
ArneBab_ has joined #pypy
<kenaan> rlamy default c2cf8296095b /lib_pypy/_ctypes/: ctypes: allow ptr[0] = foo when ptr is a pointer to struct
ArneBab has quit [Ping timeout: 248 seconds]
<kenaan> rlamy py3.5 1c9a8dfaca36 /: hg merge default
adamholmberg has joined #pypy
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
adamholmberg has quit [Ping timeout: 240 seconds]
exarkun has quit [Ping timeout: 240 seconds]
exarkun has joined #pypy
ssbr has quit [Ping timeout: 255 seconds]
tos9 has quit [Ping timeout: 260 seconds]
zmt00 has quit [Quit: Leaving]
ssbr has joined #pypy
tos9 has joined #pypy
exarkun has quit [Ping timeout: 240 seconds]
exarkun has joined #pypy
Garen has quit [Read error: Connection reset by peer]
Garen has joined #pypy
pilne has quit [Quit: Quitting!]
forgottenone has joined #pypy
inhahe_ has quit []
inhahe_ has joined #pypy
realitix has joined #pypy
mattip has joined #pypy
exarkun has quit [Ping timeout: 264 seconds]
exarkun has joined #pypy
<kenaan> fijal ssl-context-share 0531fecb7205 /: new branch to experiment with ssl context sharing
mattbillenstein has joined #pypy
<mattbillenstein> mattip: I'm ready to setup that build slave
oberstet has joined #pypy
<mattip> cool. pm me the details?
realitix has quit [Ping timeout: 240 seconds]
marr has joined #pypy
oberstet has quit [Ping timeout: 240 seconds]
realitix has joined #pypy
realitix has quit [Read error: Connection reset by peer]
<kenaan> mattip buildbot d495e76c5761 /bot2/pypybuildbot/master.py: add new macos buildbot
oberstet has joined #pypy
bbot2 has quit [Quit: buildmaster reconfigured: bot disconnecting]
bbot2 has joined #pypy
cstratak has joined #pypy
<mattip> mattbillenstein: can you connect?
<bbot2> Started: http://buildbot.pypy.org/builders/rpython-linux-x86-64/builds/0 [mattip: test new config]
pepesza has quit [Quit: ZNC 1.6.3+deb1 - http://znc.in]
* mattip back in 30 min
antocuni has joined #pypy
<mattbillenstein> mattip: yes, appears so: http://buildbot.pypy.org/buildslaves/billenstein-sierra
realitix has joined #pypy
<mattip> can the build slave mkdir /Users/pypy/buildarea/pypy-c-jit-macosx-x86-64/build ?
<xorAxAx> anybody at pycon.de these days?
<mattip> or is it mssing hg ?
exarkun has quit [Ping timeout: 260 seconds]
exarkun has joined #pypy
<mattip> xorAxAx: mike muller is giving a talk
<xorAxAx> ah, cool
<bbot2> Success: http://buildbot.pypy.org/builders/rpython-linux-x86-64/builds/0 [mattip: test new config]
<mattip> xorAxAx: are you there?
<xorAxAx> mattip: yes
<xorAxAx> currently travelling, but i will be
<mattip> xorAxAx: enjoy, the data tracks look interesting
<xorAxAx> mattip: thanks, will do!
<kenaan> mattip buildbot dbccd8b5c54f /: allow pause, tweak slave requirements
bbot2 has quit [Quit: buildmaster reconfigured: bot disconnecting]
bbot2 has joined #pypy
<ionelmc> antocuni: hey, but where do i pass the sources arg?
<antocuni> ionelmc: wait, this info has swapped out of my mind :)
<ionelmc> i thought so
<ionelmc> been looking for that argument all over the place lol
<antocuni> ffibuilder.set_source(...., sources=['file1.c'])
<antocuni> should work
<ionelmc> except it doesn't, if the code is empty then bad things happen
<antocuni> pastebin, please :)
<ionelmc> i'm using this right now, seems to work fine: ffi.set_source('foo._bar', open(join(dirname(__file__), '_bar.c')).read())
<antocuni> yes, that works too
lritter has joined #pypy
<ionelmc> so if i have ffi.set_source('foo._bar', '', sources=[join(dirname(__file__), '_bar.c')]) then the C file doesn't get included
<ionelmc> HMM
<ionelmc> actually it does
<antocuni> yeah, I told you :)
<ionelmc> but then something is wrong
<ionelmc> so i have that silly 'longest' function
<antocuni> well, from the GCC errors, it looks like you are missing an #include
<ionelmc> how come it worked when reading the file?
<antocuni> the string which you pass to set_source() is appended to some preamble which is generated by cffi
<antocuni> while files passed as source=[...] are compiled by themselves
<ionelmc> doesn't seem so, the temp C file has my code somewhere in the middle
<antocuni> I think it's easier if you just show me a minimal example
<ionelmc> hmmm
<ionelmc> maybe i got confused by all these temporary files
<ionelmc> seems that trying stuff with a dirty build dir yields weird results
<antocuni> you are probably missing the #include
<ionelmc> i don't have the header file
<ionelmc> actually, is the `#include "mysrc.h"` really necessary?
<antocuni> well, you are the author of mysrc.c, so you can write mysrc.h as well
<antocuni> yes
<antocuni> suppose you want to use a 3rd party library
<antocuni> like math.h
<antocuni> in cdef(), you write the prototypes you are interested in
<antocuni> so, ffi.cdef("double fabs(double, double)")
<antocuni> but this is "fake C"
<antocuni> in the sense that it's used only by cffi+pycparser internally, it's never passed to GCC
<antocuni> then, in set_source(), you need to tell GCC where to find these actual C declarations
<ionelmc> so i need the headers cause there are going to be two object files (one for the binding and one for mysrc) yes?
<antocuni> and usually you do it with an include file
<antocuni> so, ffi.set_source('#include <math.h>')
<antocuni> you need a header for each file that you put in sources=[...]
<antocuni> or, alternatively, you can write the function declaration manually in set_source, if you don't want the header file
<antocuni> basically, you need to do it properly as you would do in C
<antocuni> if you develop a C program, you write a .h for each .c
<ionelmc> seems like a pain in the ass
<antocuni> then, cffi generates one additional .c file under the hood, but you need to include the .h to get the declaration of all the functions you use
<antocuni> well, it's C
<antocuni> it works this way, sorry :)
<ionelmc> what's the disadvantage of just reading the c file and passing it in?
<antocuni> if it's one, probably not too much
<antocuni> if you start to have more, using sources=[...] it's just clearer, IMHO
<antocuni> anyway, I need to go now, sorry
<ionelmc> so basically it doesn't scale
<ionelmc> i get it
<ionelmc> thanks
<antocuni> np
<antocuni> bye
antocuni has quit [Ping timeout: 240 seconds]
exarkun has quit [Ping timeout: 240 seconds]
exarkun has joined #pypy
jcea has joined #pypy
antocuni has joined #pypy
TheAdversary has joined #pypy
oberstet has quit [Ping timeout: 255 seconds]
exarkun has quit [Ping timeout: 240 seconds]
exarkun has joined #pypy
jcea has quit [Remote host closed the connection]
jcea has joined #pypy
oberstet has joined #pypy
<ionelmc> antocuni: still around?
<antocuni> yes
<antocuni> ionelmc: ^^
<ionelmc> hmmm actually hold on i wanna feel less stupid and figure it out on my own lol
<ionelmc> antocuni: so is size_t same as int?
<antocuni> not necessarily
<antocuni> it depends on the platform
<antocuni> actually, on linux64 I'd guess it's the same as long
<antocuni> but for best portability, you should use size_t (and ssize_t, for signed values) whenever necessary
<arigato> ...or more precisely "unsigned long"
<arigato> (hi)
<antocuni> arigato: whooo, you are alive :)
<ionelmc> so i have a _ffi.new('size_t*') how do i make it an int?
<arigato> antocuni: barely
<antocuni> ionelmc: do you want to know how to get a python int? Or how to convert it to a C int*?
<ionelmc> get the int from the pointer (first way)
Rhy0lite has joined #pypy
<ionelmc> actually lemme put the code somewhere
<arigato> ionelmc: if 'p' is the pointer, it's p[0]
<arigato> (which makes a bit of sense if you're used to C)
<antocuni> ionelmc: yes, in the code you pasted it should be outlen[0]
<antocuni> (too bad that python has a '+' unary operator, but not a '*' one)
<ionelmc> ah lol, dunno why i expected magic :)
<kenaan> mattip default 7dec6a241b75 /: fix issue #2682, split firstword on any whitespace
<kenaan> mattip py3.5 7d0732ed45b9 /: merge default into py3.5
<antocuni> ionelmc: cffi tries to stick as close as possible to C semantics
<antocuni> so, if you use it with the C mindset, often things just work as you would expect
<ionelmc> antocuni: rest of the code looks fine? the signature is int unlzw(unsigned const char *in, size_t inlen, unsigned char **out, size_t *outlen)
<arigato> let's make cffi the first and only python library which has an actual usage for "+", by allowing "+p" to stand for "*p" :-)
<ionelmc> what
<antocuni> arigato: I was thinking the same... but please don't
<ionelmc> really, python has a unary + ?
<arigato> I prefer the hack: "ffi *p" (which is valid Python). but neither hack will be implemented, don't worry :-)
<arigato> (also, both hacks fail at '+p = 5' or 'ffi *p = 5'
<antocuni> arigato: this is obviously solved by allowing "+p == 5"
<antocuni> uh, even better
<antocuni> "+p <= 5"
<ionelmc> so i get a UserWarning: implicit cast from 'char *' to a different pointer type
<ionelmc> what's the correct way to pass a string as `char*`?
<ionelmc> actually it's `unsigned const char *`
<antocuni> ionelmc: you are creating _ffi.new('char[]', data)
<antocuni> but unlzw expected unsigned char*
<antocuni> so, just do _ffi.new('unsigned char[]', data)
inhahe_ has quit [Ping timeout: 240 seconds]
<mattip> cfbolz: dunno if you teach c + python, but here is a lecture I gave on ctypes, cffi, cython at pycon IL in June
<cfbolz> cool!
<cfbolz> mattip: is it ok if I tweet a link to the notebook?
<cfbolz> (from the pypy account)
inhahe_ has joined #pypy
<cfbolz> (we should rerun the numbers when the cpyext improvements get merged)
<antocuni> arigato: apropos cpyext improvements, eventually I'd like comments about cpyext-refactor-methodobject :)
<antocuni> (but there is no real hurry, as I'm not doing much cpyext work these days)
adamholmberg has joined #pypy
<mattip> cfbolz: of course. it also shows how pypy is faster than them all at the end :)
<cfbolz> excellent
adamholmberg has quit [Remote host closed the connection]
marky1991 has joined #pypy
exarkun has quit [Ping timeout: 264 seconds]
adamholmberg has joined #pypy
exarkun has joined #pypy
demonimin has quit [Remote host closed the connection]
demonimin has joined #pypy
Masklinn has joined #pypy
<mattip> antocuni: how close is cpyext-refactor-methodobject to being ready?
yuyichao_ has quit [Ping timeout: 246 seconds]
<mattip> my real question - if I add a pure-c implementation of PyBuffer_{From,To}Contiguous, will it break your branch?
yuyichao_ has joined #pypy
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-macosx-x86-64/builds/3373 [mattip: test new build slave]
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-macosx-x86-64/builds/3373 [mattip: test new build slave]
oberstet has quit [Ping timeout: 248 seconds]
demonimin has quit [Remote host closed the connection]
demonimin has joined #pypy
demonimin has quit [Remote host closed the connection]
demonimin has joined #pypy
<antocuni> mattip: cpyext-refactor-methodobject has already been merged to cpyext-avoid-roundtrip
<antocuni> cpyext-avoid-roundtrip is basically a never-ending task, because there are tons of things to improve
<antocuni> however, I think that right now it's in a state which can be merged to default
<antocuni> but I'd like arigato review first
oberstet has joined #pypy
demonimin has quit [Remote host closed the connection]
demonimin has joined #pypy
<mattip> cool
ronny has quit [Ping timeout: 240 seconds]
manjaroDeepin has joined #pypy
<manjaroDeepin> Hello guys! I'm a new guy who wants to help and contribute to PyPy3. Any advise on how to proceed or just a direction to where i may find some beginner friendly issues ?
<kenaan> mattip default 94ab09b73962 /pypy/module/cpyext/: test, fix issue #2677 copy pure c PyBuffer_{From,To}Contiguous from cpython
<simpson> manjaroDeepin: Are there perhaps specific pieces of code that you'd like to run? That might be a place to start.
ronny has joined #pypy
<manjaroDeepin> I was looking at prospective projects on GSOC 17 Ideas List and i would like to contribute on either of these projects "Make bytearray type fast" or "port other modules to PyPy".
<manjaroDeepin> Is there some place where i can track it's development/issues specifically ?
<simpson> Okay. I don't know about the GSoC project ideas, but hopefully a core dev is around.
zmt00 has joined #pypy
realitix has quit [Remote host closed the connection]
Masklinn has quit []
tbodt has joined #pypy
__Yiota has quit [Quit: Textual IRC Client: www.textualapp.com]
__Yiota has joined #pypy
rubdos has joined #pypy
manjaroDeepin has quit [Quit: Leaving]
<fijal> well, he quit
__Yiota has quit [Remote host closed the connection]
drolando has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<bbot2> Started: http://buildbot.pypy.org/builders/own-linux-x86-64/builds/6320 [ronan: force build, py3.5]
__Yiota has joined #pypy
<antocuni> fijal: do you know how hard is to implement vmprof(real_time=True) on PyPy?
<fijal> What does it do?
drolando has joined #pypy
<antocuni> it measures wall clock time
<antocuni> so it includes also time spent inside blocking IO
<antocuni> it's a feature we have for CPython
<antocuni> but since you didn't even know it existed, I doubt that you know if it's hard on PyPy :)
Masklinn has joined #pypy
Masklinn has quit [Client Quit]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<mattbillenstein> mattip: installed hg and forced another build -- currently translating: http://buildbot.pypy.org/builders/pypy-c-jit-macosx-x86-64/builds/3374
tbodt has joined #pypy
drolando has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<bbot2> Failure: http://buildbot.pypy.org/builders/own-linux-x86-64/builds/6320 [ronan: force build, py3.5]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<mattip> mattbillenstein: cool!
drolando has joined #pypy
drolando_ has joined #pypy
antocuni has quit [Ping timeout: 240 seconds]
oberstet has quit [Ping timeout: 248 seconds]
<tos9> Is lxml supposed to work these days
<tos9> I thought it was
<tos9> (Without using lxml-cffi)
drolando has quit [Ping timeout: 252 seconds]
lritter has quit [Remote host closed the connection]
<mattip> tos9: what doesn't work, and what pypy?
<tos9> mattip: 5.9, and installing
<tos9> I get... src/lxml/etree.c:1232:3: error: unknown type name ‘PyBaseExceptionObject’
manjaroDeepin has joined #pypy
manjaroDeepin has quit [Client Quit]
<mattip> tos9: works for me on linux64, pip install lxml and got lxml 4.1.0
exarkun has quit [Ping timeout: 260 seconds]
<mattip> with PyPy 5.9.0 84a2f3e6a7f8
exarkun has joined #pypy
* tos9 checks what he has
<tos9> Linux ip-172-16-10-250.ec2.internal 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
<tos9> a ha... two pypy versions...
<tos9> maybe it's running on the 5.6
oberstet has joined #pypy
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
__Yiota has joined #pypy
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cstratak has quit [Quit: Leaving]
cstratak has joined #pypy
ronan has quit [Quit: Ex-Chat]
adamholm_ has joined #pypy
cstratak has quit [Quit: Leaving]
tbodt has joined #pypy
adamholmberg has quit [Ping timeout: 258 seconds]
marky1991 has quit [Ping timeout: 248 seconds]
adamholmberg has joined #pypy
adamholm_ has quit [Ping timeout: 246 seconds]
Rhy0lite has quit [Quit: Leaving]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
<mattip> looking at issue 2622, https://bitbucket.org/pypy/pypy/issues/2622
<mattip> it seems cpython 3 added a whole slew of PyAPI_FUNC s in fileutils.h, that are nothing more than a thin wrapper over stdlib calls
<mattip> why did they bother?
<Rotonen> old habit?
adamholm_ has joined #pypy
<Rotonen> i suppose the same should be found in math as log2 and friends landed
<mattip> at least those are visible from the interpreter in the math module, no?
exarkun has quit [Ping timeout: 248 seconds]
adamholmberg has quit [Ping timeout: 240 seconds]
<Rotonen> correct
<mattip> I am refering to things like _Py_open, _Py_fopen, _Py_wfopen
<Rotonen> kk
<mattip> that are only accessable from C, and are a slight tweak of the stdlib call
exarkun has joined #pypy
tbodt has joined #pypy
marky1991 has joined #pypy
<kenaan> mattip default 89d1f31fabc8 /lib_pypy/_sqlite3.py: whoops for empty sql
<mattip> mattbillenstein: nice, the build completed, and those errors seem to be similar to the ones we have had for a while on macosx
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<mattip> mattbillenstein: now I just hope we don't burden your machine with too many builds
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-macosx-x86-64/builds/3375 [mattip: force build, py3.5-mac-embedding]
<mattip> like that
<mattip> bye
mattip has left #pypy ["bye"]
adamholmberg has joined #pypy
adamholm_ has quit [Ping timeout: 246 seconds]
cjwelborn has quit [Remote host closed the connection]
fryguybob has quit [Ping timeout: 258 seconds]
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-macosx-x86-64/builds/3375 [mattip: force build, py3.5-mac-embedding]
inad922 has joined #pypy
tbodt has joined #pypy
__Yiota has joined #pypy
inad922 has quit [Quit: Leaving]
__Yiota has quit [Remote host closed the connection]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
__Yiota has joined #pypy
tbodt has joined #pypy
kolko has joined #pypy
tbodt has quit [Client Quit]
exarkun has quit [Ping timeout: 248 seconds]
exarkun has joined #pypy
tbodt has joined #pypy
forgottenone has quit [Quit: Konversation terminated!]
__Yiota has quit [Remote host closed the connection]
__Yiota has joined #pypy
Ulfalizer has joined #pypy
ronan has joined #pypy
kipras is now known as kipras`away
antocuni has joined #pypy
adamholmberg has quit [Remote host closed the connection]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
oberstet has quit [Quit: Leaving]
marky1991 has quit [Remote host closed the connection]
exarkun has quit [Ping timeout: 260 seconds]
marky1991 has joined #pypy
exarkun has joined #pypy
marky1991 has quit [Ping timeout: 258 seconds]
tbodt has joined #pypy
yuyichao_ has quit [Quit: Konversation terminated!]
yuyichao has joined #pypy
cjwelborn has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yuyichao has quit [Ping timeout: 240 seconds]
yuyichao has joined #pypy
tbodt has joined #pypy
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
antocuni has quit [Ping timeout: 240 seconds]