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
lritter has quit [Ping timeout: 246 seconds]
<bbot2> Exception: http://buildbot.pypy.org/builders/pypy-c-jit-win-x86-32/builds/5358 [mattip: force build, py3.7]
oberstet__ has quit [Remote host closed the connection]
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
Rhy0lite has quit [Quit: This computer has gone to sleep]
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
marvin has quit [Remote host closed the connection]
marvin has joined #pypy
altendky has quit [Ping timeout: 260 seconds]
altendky has joined #pypy
<mattip> dunno what I did, but latest win32 py3.6 crashes when run at the repl
<mattip> :(
oberstet has joined #pypy
Masklinn has joined #pypy
Masklinn has quit []
stillinbeta has quit [Ping timeout: 272 seconds]
Masklinn has joined #pypy
stillinbeta has joined #pypy
<mattip> arigo: on issue 3267, thanks for not recommending the latest nightly :)
oberstet_ has joined #pypy
oberstet has quit [Ping timeout: 264 seconds]
oberstet__ has joined #pypy
petronny has joined #pypy
oberstet_ has quit [Ping timeout: 258 seconds]
<rjarry> hi all
<rjarry> anyone has experience in adding typing hints for cffi extensions?
epony has quit [Quit: reconfigure]
epony has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
nimaje has quit [Quit: WeeChat 2.8]
nimaje has joined #pypy
oberstet_ has joined #pypy
oberstet__ has quit [Ping timeout: 256 seconds]
oberstet__ has joined #pypy
oberstet_ has quit [Ping timeout: 256 seconds]
Rhy0lite has joined #pypy
nimaje has quit [Read error: Connection timed out]
nimaje has joined #pypy
oberstet_ has joined #pypy
oberstet__ has quit [Ping timeout: 256 seconds]
oberstet__ has joined #pypy
oberstet_ has quit [Ping timeout: 256 seconds]
speeder39_ has joined #pypy
lritter has joined #pypy
Masklinn has quit []
eregon_ has quit [Ping timeout: 258 seconds]
eregon has joined #pypy
<pmp-p> hi rjarry what do you want to achieve ?
<rjarry> pmp-p: hi, I am working on CFFI wrappers around C libraries and I would like to use mypy
<rjarry> which requires to add type annotations on function/variables
<pmp-p> interesting
<rjarry> however, when working on CFFI extensions, the compiled extension is generated
<rjarry> so that kind of requires to add a stub file
<pmp-p> what would you do if you find void some_c_func(int a) and void some_c_func(float a) in the C exports list ?
<pmp-p> with annotations
<rjarry> def some_c_func(a: int) -> None: ...
<rjarry> def some_c_func(a: float) -> None: ...
<rjarry> for example
<rjarry> the problem I have is that some C objects are too complex to be native python types
<rjarry> they are wrapped in ffi.CData objects
<rjarry> but there is no "subclass" of CData
<pmp-p> use boxed pointers then
<rjarry> so I have no idea how to declare these types
<rjarry> for example "void *" or "char *"
<rjarry> boxed pointers ?
<rjarry> I wonder if CFFI could generate these .pyi stub files directly
<pmp-p> yeah use specific python type to say "this thing is a c/c++ pointer" when on the stack before call you can replace it
<pmp-p> same when returning value
<rjarry> I don't understand what you mean, sorry :)
<pmp-p> also problem with annotation is that the second "some_c_func" mask the first
<pmp-p> so stubs are interesting
<rjarry> yes, I seems to me that they could be generated automatically by cffi when it generates the .c extension code
<pmp-p> rjarry: i tried to the same but with C++ here https://github.com/pmp-p/panda3d-interrogator
<pmp-p> but in the export i could not use annotations because of overload https://github.com/pmp-p/panda3d-interrogator/blob/master/build/upanda3d.py
<mattip> pmp-p: if you have void some_c_func(int a) and void some_c_func(float a) in an exported C interface, something is terribly wrong
<mattip> you will only see some_c_func in the eports, and not be able to choose between them
<pmp-p> mattip: yeah but sometimes it happens with C++
<rjarry> I'm not sure what it means in C
<pmp-p> also sometimes c++ have init values :(
<rjarry> I don't think that function overloading in C is possible
<mattip> but then the signature is some garbled mess for cffi
<pmp-p> yep
<pmp-p> luckily it was corner cases :D
<mattip> I don't even know if the pycparser will work on a C++ interface header
<rjarry> pmp-p: you need to write c++ffi
<rjarry> :D
<pmp-p> i did not try pycparser, i guess cppyy or interrogate (what i used) are better for that
<rjarry> mattip: did you ever consider generating stub files when building extensions?
<rjarry> is it something anyone ever suggested?
<pmp-p> rjarry: idk but i certainly will try to generate them for my experiment, so thx for letting me know about them
<mattip> rjarry: it is a thing, look up cppyy
<rjarry> mattip: that's C++, ahh
<mattip> sorry, I am in a lag. cppyy is a c++ffi
<rjarry> no prob
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
<rjarry> mattip: btw, you did not answer my original question
<rjarry> :D
<rjarry> do you think that cffi could be modified so that it generates .pyi stub files when generating the C extension code?
<mattip> anything is possible. I don't know much about typing conventions
<mattip> definitely would need tests to confirm it is working
<pmp-p> i've seen docstrings generated from cffi in pysdl2-cffi but not annotations, maybe it can help
<rjarry> mattip: I'm not sure I have enough knowledge of the inner workings of cffi to attempt such a change by myself
<rjarry> however, I'd like to help if possible
<mattip> maybe ask on the cffi-dev mailing list or file an issue
Olorin_ has joined #pypy
jeroud_ has joined #pypy
string_ has joined #pypy
<rjarry> mattip: I posted a message on the mailing list
string has quit [*.net *.split]
jeroud has quit [*.net *.split]
krono has quit [*.net *.split]
Olorin has quit [*.net *.split]
avakdh has quit [*.net *.split]
ronan has quit [*.net *.split]
dstufft has quit [*.net *.split]
_aegis_ has quit [*.net *.split]
string_ is now known as string
Olorin_ is now known as Olorin
jeroud_ is now known as jeroud
agates[m] has quit [Write error: Connection reset by peer]
the_drow[m] has quit [Remote host closed the connection]
toad_polo has quit [Remote host closed the connection]
_aegis_ has joined #pypy
krono has joined #pypy
dstufft has joined #pypy
avakdh has joined #pypy
ronan has joined #pypy
agates[m] has joined #pypy
toad_polo has joined #pypy
the_drow[m] has joined #pypy
BPL has joined #pypy
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
speeder39_ has quit [Quit: Connection closed for inactivity]
<mattip> it took me a while to realize that I can create a PyCFunctionObject in a test very easily by just writing a module function :)
xcm has quit [Read error: Connection reset by peer]
xcm has joined #pypy
BPL has quit [Quit: Leaving]
xcm has quit [Remote host closed the connection]
xcm has joined #pypy
xcm has quit [Killed (orwell.freenode.net (Nickname regained by services))]
xcm has joined #pypy
oberstet__ has quit [Remote host closed the connection]