Issue #45 resolved

Accepting unicode strings for enum values.

Simon Sapin
created an issue

On Python 2.x I get this error when passing a unicode string to a function that expects an enum value:

TypeError: initializer for ctype 'enum _cairo_format' must be a str or int, not unicode

(str works as expected.)

In Python 2.x ASCII-only byte strings and unicode strings are usually equivalent: they compare equal and they often convert implicitly to each other. It would help if cffi did the same, especially for modules that use from __future__ import unicode_literals.

Comments (4)

  1. Log in to comment