[pypy-issue] [issue820] ctypes structure._fields_ should accept 3 tuple

npforce tracker at bugs.pypy.org
Mon Aug 8 16:33:00 CEST 2011

npforce <lesterz at gmail.com> added the comment:

This script works in CPython but not in pypy 1.5. Error message:
Traceback (most recent call last):
  File "app_main.py", line 53, in run_toplevel
  File "test.py", line 6, in <module>
    ("normal_int", c_int)]
  File "/usr/local/pypy/lib_pypy/_ctypes/structure.py", line 92, in 
    if self in [v for k, v in value]:
ValueError: expected length 2, got 3

Obviously, k,v expects a 2-tuple.  For a 3-tuple, it fails.  Note that if the 
_fields_ is defined inside the class, there's no problem.  The problem occurs 
only when _fields_ is added outside class definition.

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list