Looking at the source to the enum34 backport, just like the enum module in 3.4+, it's pure Python, and does nothing to expose a custom C API.
So, you just use PyObject_GetAttr and friends to access class attributes. In particular, if you have a MyEnum.val, you need to get its value attribute, which will be an int, which you can then PyInt_AsLong.
This is the same way things work in Python. If you try to use MyEnum.val where an int is expected, you should get a TypeError; if you try to explicitly call int(MyEnum.val), you will definitely get a TypeError. So, although I haven't tested it, PyInt_AsLong directly on the constant instead of its value should raise a TypeError and return -1.
If you want enumeration constants that act like subtypes of int, then, as the enum docs explain, you want IntEnum. Usually, that isn't really what you want (as the docs explain), but if it is, of course it works. And you should be able to PyInt_Check and PyInt_AsLong an IntEnum value (although, again, I haven't tested).
enum34package doesn't provide any special C representation or API, so you just have to callPyObject_GetAttrand friends, as with any other pure-Python type.xfor whichPyInt_Check(x) != 0? e.g. support for built-in protocols, something likePyNumber_Int(x)(if that actually worked).Enumvalues are explicitly designed not to act like they're a subtype ofint.IntEnumvalues are another story. You should be able toPyInt_Checkthose andPyInt_AsLongthem. But forEnum, you shouldn't be able to, so you (at least should) need to get thevalueattr if you want to use them as ints, just as you do from Python.enum.IntEnumon the Python-side instead ofenum.Enumdoes seem to be the most convenient path to take then. Thanks.IntEnumtypes' constants will compare equal to each other—e.g.,Colors.red == Days.sundaywill be true. TheIntEnumdocs explain why usually, that's not what you want… but of course sometimes it is, which is why they included it in the module.