Skip to content

Map anonymous enum values to FFILibrary attributes.

Bitbucket Importer requested to merge bitbucket/declined-pr-11 into branch/default

Created originally on Bitbucket by SimonSapin (Simon Sapin)

Changesets for this Pull Request have not been imported, because it had been already declined on Bitbucket. Marked as closed by the import user.

Without this patch, this code gives an error:

from cffi import FFI
ffi = FFI()
ffi.cdef('typedef enum lipsum { LOREM, IPSUM } lipsum_t;'
'typedef enum { FOO, BAR } fb_t;')
lib = ffi.dlopen('m')
assert lib.IPSUM == 1 # Ok :)
assert lib.BAR == 1 # AttributeError :(

I’m not quite sure that 'anonymous' in ffi._parser._declarations is only for anonymous enums, so review is appreciated.

Merge request reports