[pypy-issue] Issue #2813: seems bug in ctypes (pypy/pypy)
刘穆清
issues-reply at bitbucket.org
Fri Apr 27 07:39:06 EDT 2018
New issue 2813: seems bug in ctypes
https://bitbucket.org/pypy/pypy/issues/2813/seems-bug-in-ctypes
刘穆清:
```
#!python
from ctypes import *
class Context(Structure):
pass
PtrTypeOfContext = POINTER(Context)
LIB = cdll.LoadLibrary("./test.so")
LIB.test.restype = Context
LIB.test.argtypes = []
Context._fields_ = [
("a", c_char_p),
("b", c_char_p),
("c", c_char_p),
("d", c_char_p),
]
c = Context()
v = LIB.test(c)
print (v.a)
print (v.b)
print (v.c)
print (v.d)
```
this code can be run in CPython, but in pypy, it will raise `SystemError: not supported by libffi`
and If I comment line 5, pypy will be good
More information about the pypy-issue
mailing list