[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 
struct_setattr
    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>
<https://bugs.pypy.org/issue820>
________________________________________


More information about the pypy-issue mailing list