cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://botbot.me/freenode/pypy/ ) | use cffi for calling C | the secret reason for us trying to get PyPy users: to test the JIT well enough that we're somewhat confident about it
<mattip> ronan: is array.array required by a python c-extension module?
<ronan> mattip: scikit-learn cimports it
<mattip> bummer
<mattip> maybe we could use PyBuffer* to work around it, but it would be a large chunk of PyPy only code
inhahe__ has quit []
<mattip> gnite
<kenaan> tdziopa py3.6 bce4e51f4d12 /pypy/: (tomek.dziopa ronan) add deprecationwarning for incorrectly escaped strings https://hg.python.org/cpython/rev/ee82...
<bbot2> Started: http://buildbot.pypy.org/builders/own-linux-x86-64/builds/6708 [ronan: force build, py3.6]
<bbot2> Started: http://buildbot.pypy.org/builders/pypy-c-jit-win-x86-32/builds/3862 [ronan: force build, py3.6]
<bbot2> Started: http://buildbot.pypy.org/builders/own-linux-x86-32/builds/5822 [ronan: force build, py3.6]
<bbot2> Started: http://buildbot.pypy.org/builders/own-win-x86-32/builds/1760 [ronan: force build, py3.6]
pf_moore has quit [Quit: Connection closed for inactivity]
<bbot2> Failure: http://buildbot.pypy.org/builders/pypy-c-jit-win-x86-32/builds/3862 [ronan: force build, py3.6]
ronan has quit [Ping timeout: 248 seconds]
inhahe__ has joined #pypy
asmeurer has quit [Quit: asmeurer]
WhatisRT_ has quit [Remote host closed the connection]
asmeurer_ has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tbodt has joined #pypy
<bbot2> Failure: http://buildbot.pypy.org/builders/own-linux-x86-64/builds/6708 [ronan: force build, py3.6]
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jcea has quit [Quit: jcea]
tbodt has joined #pypy
raynold has joined #pypy
raynold has quit [Max SendQ exceeded]
raynold has joined #pypy
energizer has quit [Remote host closed the connection]
energizer has joined #pypy
tbodt has quit [Read error: Connection reset by peer]
tbodt has joined #pypy
<raynold> ahh it's a wonderful day
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dddddd has quit [Remote host closed the connection]
<bbot2> Failure: http://buildbot.pypy.org/builders/own-linux-x86-32/builds/5822 [ronan: force build, py3.6]
Hexxeh______ has quit [Quit: Connection closed for inactivity]
oberstet has joined #pypy
energizer has quit [Remote host closed the connection]
energizer has joined #pypy
inhahe__ has quit [Ping timeout: 240 seconds]
inhahe__ has joined #pypy
<bbot2> Failure: http://buildbot.pypy.org/builders/own-win-x86-32/builds/1760 [ronan: force build, py3.6]
asmeurer_ has quit [Quit: asmeurer_]
ronan has joined #pypy
asmeurer__ has joined #pypy
asmeurer__ has quit [Quit: asmeurer__]
energizer has quit [Ping timeout: 260 seconds]
lazka has joined #pypy
<kenaan> tdziopa py3.6 d3ffc4376fe9 /pypy/interpreter/pyparser/parsestring.py: (tdziopa) fix warnings for PyString_DecodeEscape Recent PR introduced a bug with undefined variable ch being acces...
<kenaan> tdziopa py3.6 bc678f7e35f0 /pypy/interpreter/pyparser/parsestring.py: (tdziopa) fix default value for first_escape_error_char As RPython doesn't allow having int and None in the same v...
dddddd_ has joined #pypy
dddddd_ is now known as dddddd
ronan has quit [Ping timeout: 248 seconds]
lazka has quit [Quit: Leaving]
WhatisRT_ has joined #pypy
<WhatisRT_> hi! using cffi, is it possible to call a function by its address? I have a function that returns a void *, and I want to call the function this points to
<arigato> WhatisRT_: hi!
<arigato> sure, like you'd do in C:
<arigato> funcptr = ffi.cast("int(*)(int)", funcptr)
<arigato> funcptr(42)
<arigato> that string is the C type meaning "pointer to function with one arg of type int, returning int"
<arigato> note just in case, I see handles in what you asked earlier. If the "void *" is actually a handle obtained with ffi.new_handle(), it won't work
<arigato> with such a "void *" you can only do "ffi.from_handle(ptr)"
<WhatisRT_> arigato: cool, thanks!
<WhatisRT_> no, this is unrelated to handles in this case
<WhatisRT_> but if you know how to get the address of a handle, that would be awesome too
<arigato> hum, a handle *is* already an address, as in, a "void *" object
<WhatisRT_> well, I'm literally using int(re.search(r'0x([0-9]|[a-f]|[A-F])*', str(callback_handle)).group(), 16)
<arigato> if you want to cast a "void *" to an integer you can do: int(ffi.cast("intptr_t", ptr))
<WhatisRT_> if I try to cast the address, I get a different value
<arigato> you're talking about this, right? <cdata 'void *' handle to <cdata 'void(*)(void *, uint8_t *, size_t, uint8_t * *, size_t *)' 0x101feb080>>
<WhatisRT_> yes
<arigato> it's a handle over a Python object that happens to be a cdata object, which is a strange thing to do
<arigato> handles are meant to be used when you need to temporarily hide a Python object inside C code, and get it back later
<WhatisRT_> ok
<simpson> WhatisRT_: We might be at the point where you tell us what you're gonna do with the extracted address.
<WhatisRT_> simpson: nothing scary, just passing it around through some custom stuff
<arigato> ffi.new_handle() really returns a "void *" which hides the Python object. The actual value of the "void *" is meaningless and it can only be used in ffi.from_handle()
<WhatisRT_> but maybe my problems might be somewhere else: I just tried the conversion to uintptr_t again on my debian system, and it works there
<idnar> ah, yes, the hex string in that repr is the address of the cdata pointed to by the handle (it's from the inner <cdata …>), not the handle itself
<arigato> precisely, that's why you get two different addresses
<WhatisRT_> ok, that makes sense
<arigato> it's a handle that contains a Python object that happens to be a cdata object with a type and a value, and that value is 0x101feb080
<arigato> if you want to pass around to C code something that is already a cdata value, then you might just cast it to a "void *" and back when needed, with ffi.cast("void *", ptr)
<WhatisRT_> is the address of a handle really useless? I'm passing the address to my c code and it works
<arigato> yes, you can't do anything with it apart from ffi.from_handle()
<WhatisRT_> in python? or generally?
<arigato> generally
<arigato> it's just an opaque value with no meaning
<WhatisRT_> so my code shouldn't work
<arigato> it doesn't point anywhere
<arigato> I can't explain why it seems to work without seeing your code :-)
<WhatisRT_> maybe it's because the function has a @ffi.def_extern() attribute?
<WhatisRT_> so I'm getting a handle to lib.callback
<arigato> and doing what with it?
<WhatisRT_> getting its address and giving it to c code
<arigato> ah, "getting its address" as in with the regular expression
<WhatisRT_> yes
<arigato> which doesn't get the address of the handle at all
<arigato> it returns the address of lib.callback
<WhatisRT_> ok, so I imagine this is supposed to work
<arigato> so it happens to work, by accident
<arigato> you should directly pass lib.callback to C code, and forget about handles
<WhatisRT_> ah, ok
<WhatisRT_> that makes everything much nicer
<arigato> what you were doing is similar to: I have an integer x, I want to pass it, so I pass int(re.search("\d+", repr({'foo': x})))
<arigato> the handle object plays the same role as the dictionary in this example :-)
<WhatisRT_> ok, I think now I also understand why some other related stuff was not working
<WhatisRT_> where I got the handle to a function, and I was extracting the address in the same fashion
tbodt has joined #pypy
tbodt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tito_ has joined #pypy
JStoker has quit [Killed (wolfe.freenode.net (Nickname regained by services))]
JStoker has joined #pypy
idnar has quit [*.net *.split]
bendlas has quit [*.net *.split]
agates has quit [*.net *.split]
alcarithemad has quit [*.net *.split]
mjacob_ has quit [*.net *.split]
cadr_ has quit [*.net *.split]
rguillebert has quit [*.net *.split]
sbauman has quit [*.net *.split]
wallet42 has quit [*.net *.split]
iko has quit [*.net *.split]
tito has quit [*.net *.split]
runciter has quit [*.net *.split]
jaffachief has joined #pypy
dddddd has quit [Remote host closed the connection]
alcarithemad has joined #pypy
ronan has joined #pypy
<nanonyme> arigato, isn't handles with callbacks typically relevant only at the point where you want pass context?
<arigato> unsure what you're saying. it seems you're continuing to think in terms that I don't understand involving handles of callback
energizer has joined #pypy
<arigato> I think it never makes any sense to take a handle from a cdata object, if you ask me
mjacob has joined #pypy
<Cheery> I'm about to write a new interpreter.
jaffachief has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Cheery> though considering what I am doing, I'd like to make the interpreted code slightly higher level.
mcyprian has joined #pypy
mcyprian has quit [Client Quit]
<Cheery> There seems to be options ranging between doing it desugared AST, vs. mild SSA construction.
nunatak has joined #pypy
<Cheery> I wonder what's the best point.
<Cheery> and how much context? I feel like I wouldn't mind if the bytecode contained structured control flow.
<Cheery> and oddly, it really feels like that the JIT wouldn't care either.
wallet42 has joined #pypy
iko has joined #pypy
sbauman has joined #pypy
rguillebert has joined #pypy
runciter has joined #pypy
cadr_ has joined #pypy
agates has joined #pypy
bendlas has joined #pypy
idnar has joined #pypy
yuvipanda has quit [Ping timeout: 245 seconds]
pulkitg has quit [Ping timeout: 245 seconds]
<arigato> Cheery: indeed, the JIT doesn't care much, so you should base your choice on what feels most natural to you
abvi[m] has quit [Ping timeout: 246 seconds]
bendlas has quit [Ping timeout: 256 seconds]
agates has quit [Ping timeout: 256 seconds]
dash has quit [Ping timeout: 276 seconds]
lazka has joined #pypy
<lazka> if I call tp_init on a type not created in C it doesn't call __init__
<lazka> should I file a bug?
<arigato> lazka: yes, thanks
<lazka> ok
jaffachief has joined #pypy
ceridwen has quit [Ping timeout: 245 seconds]
asmeurer__ has joined #pypy
<lazka> done
ceridwen has joined #pypy
asmeurer__ has quit [Quit: asmeurer__]
jaffachief has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jaffachief has joined #pypy
jaffachief has quit [Client Quit]
energizer has quit [Disconnected by services]
energizer has joined #pypy
raynold has quit [Quit: Connection closed for inactivity]
marr has joined #pypy
marr has quit [Remote host closed the connection]
lritter has joined #pypy
tbodt has joined #pypy
ronan_ has joined #pypy
lritter has quit [Remote host closed the connection]
ronan_ has quit [Quit: Ex-Chat]
ronan_ has joined #pypy
ronan_ has quit [Remote host closed the connection]
marr has joined #pypy
abvi[m] has joined #pypy
lazka has quit [Quit: Leaving]
nunatak has quit [Quit: Leaving]
<mattip> something is wrong with macos build slave, extra-tests are crashing
<mattip> and we have no own build slave to run on that platform
pulkitg has joined #pypy
bendlas has joined #pypy
agates has joined #pypy
dash has joined #pypy
yuvipanda has joined #pypy
jaffachief has joined #pypy
energizer has quit [Remote host closed the connection]
energizer has joined #pypy
amaury has joined #pypy
jaffachief has quit [Ping timeout: 260 seconds]
amaury has quit [Remote host closed the connection]
amaury has joined #pypy
<kenaan> mattip py3.5 42681276e562 /: replace 7ac5e33a8260, applevel datetime inherit from a cpyext-friendly class
<mattip> ronan: porting that to py3.5 when I did it for py2.7 would have saved you some time, sorry
amaury has quit [Ping timeout: 264 seconds]
amaury has joined #pypy
ceridwen has quit [Quit: Ex-Chat]
<ronan> mattip: I saw that it was done like this in 2.7, but I wasn't sure it was a good idea to do it in 3.5
<mattip> if it is not done like this, then the type_attach are not called and the tzinfo is not reflected into c-objects
<ronan> right
<mattip> the test_tzinfo failed, which is needed for pandas
<ronan> BTW, I talked to scikit-learn maintainers, we've been trying to add pypy support
<mattip> nice. more python is better for us anyway
amaury has quit [Ping timeout: 256 seconds]
amaury has joined #pypy
<amaury> Hi
<amaury> ronan: I implemented ssl.Session
<ronan> amaury: cool!
<amaury> This cffi port is very easy to develop
<kenaan> amauryfa py3.6 e82fec399c34 /lib_pypy/_cffi_ssl/_stdssl/__init__.py: Add support for PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER (CPython Issue #28085)
<kenaan> amauryfa py3.6 2271eaab22b2 /lib_pypy/_cffi_ssl/_stdssl/__init__.py: Return a dummy .session to let more SSL tests pass.
<kenaan> amauryfa py3.6 6dc2dbf20397 /lib_pypy/_cffi_ssl/: Implement SSLSession.
<kenaan> amauryfa py3.6 26bff7c256af /lib_pypy/_cffi_ssl/_stdssl/__init__.py: Fix default socket options, added by CPython Issue 28043.
<kenaan> amauryfa py3.6 fc92860d2c30 /lib_pypy/_cffi_ssl/_stdssl/__init__.py: Apply the rest of CPython Issue 28043. This part is not well tested...
<kenaan> amauryfa py3.6 869382060075 /lib_pypy/_cffi_ssl/_stdssl/__init__.py: Complete the implementation of PROTOCOL_TLS_CLIENT: host names are checked.
<kenaan> amauryfa py3.6 2360f76c2d3c /lib-python/3/test/test_ssl.py: Is it only on my machine? 10% of the time, the test fails because the error is: '[SSL: NO_SHARED_CIPHER] error:140...
<kenaan> amauryfa py3.6 3f675393a946 /lib_pypy/_cffi_ssl/_stdssl/__init__.py: The session.id is a bytes string with NULs, use ffi.unpack() instead of ffi.string()
<mattip> amaury: feel like implementing win32 enum_certificates ?
<amaury> I don't have any win32 machine to test one
<mattip> ok, thanks for Session.
energizer has quit [Remote host closed the connection]
energizer has joined #pypy
energizer has quit [Read error: Connection reset by peer]
energizer has joined #pypy
lritter has joined #pypy
energizer has quit [Read error: Connection reset by peer]
energizer has joined #pypy
jcea has joined #pypy
iscreamforicecre has joined #pypy
<kenaan> mattip issue2806_tp_init de6e457c5576 /pypy/module/cpyext/test/test_typeobject.py: issue 2806 - object.__init__ is called not CALL.__init__
<iscreamforicecre> Does anyone know how to make CPython multiprocessing use a PyPy interpreter?
jcea has quit [Client Quit]
jcea has joined #pypy
inhahe__ has quit [Ping timeout: 248 seconds]
<kenaan> amauryfa py3.6 a29a0980fd16 /lib_pypy/_cffi_ssl/: We don't need SSL_is_init_finished after all
<kenaan> amauryfa py3.6 85c682c5ec33 /: The class is named ssl.SSLSession. Restore the import in ssl.py
iscreamforicecre has quit [Quit: Page closed]
WhatisRT_ is now known as WhatisRT
speeder39 has joined #pypy
amaury has quit [Ping timeout: 240 seconds]
oberstet has quit [Ping timeout: 264 seconds]
lritter has quit [Remote host closed the connection]
danieljabailey has quit [Quit: ZNC 1.6.5+deb2build2 - http://znc.in]
danieljabailey has joined #pypy
WhatisRT has quit [Remote host closed the connection]
raynold has joined #pypy
oberstet has joined #pypy