0

I'm trying to work with Pypy, but as soon as I've executed my code in Pypy fails, but with cPython works.

I've found several issues googling around regarding ctypes and pypy, but I'm not able to find the error in my code:

libc = CDLL("libc.so.6")
ptr = c_void_p(None)
result = libc.getifaddrs(pointer(ptr))
if result:
    return None
ifa = ifaddrs.from_address(ptr.value)
result = {}

the code fails at the call libc.getifaddrs(pointer(ptr)), returning:

102: RuntimeWarning: C function without declared arguments called result = libc.getifaddrs(pointer(ptr))

Any Idea what's going on?

Thanks!

biegleux
  • 13,179
  • 11
  • 45
  • 52
Xavi
  • 1
  • That warning also exists under CPython, and the code you show qualifies for triggering it. Try explicitly turning on warnings. –  Sep 18 '12 at 16:05

1 Answers1

0

just set the argument types of the function and the warning will gone

its considered bad practice not to delcare them anyway

  • Hi, could you expand on how to declare them? Thanks! – Xavi Sep 25 '12 at 15:20
  • http://docs.python.org/library/ctypes.html#specifying-the-required-argument-types-function-prototypes –  Oct 01 '12 at 08:35