1. Python CFFI
  2. Untitled project
  3. cffi
  4. Issues
Issue #16 resolved

Anonymous/untagged enum causes error

created an issue

This code only works with the ctypes backend: {{{


from cffi import FFI, backend_ctypes

ffi = FFI(backend=backend_ctypes.CTypesBackend()) # doesn't exhibit bug

ffi = FFI()

ffi.cdef(""" typedef struct { enum /ThisNameRequired/ { Value0 = 0 } e; } Foo; """)

api = ffi.new('Foo') }}}

Comments (6)

  1. tlynn reporter
    Traceback (most recent call last):
      File "provoke_cffi2.py", line 13, in <module>
        api = ffi.new('Foo')
      File "/home/tlynn/cffi-hg/cffi/api.py", line 172, in new
        return self._backend.newp(cdecl, init)
    TypeError: expected a pointer or array ctype, got 'struct $Foo'

    Same code. Should I be using the default branch in cffi hg?

  2. tlynn reporter

    I'd lost a "*" while editing it down to a minimal test case. The code example should say "typedef struct { ... } *Foo;". cffi bug seems fixed.

  3. Log in to comment