Clang Python Binding get integer from CursorKind.INTEGER_LITERAL

Hello,

I’m trying to convert an AST emitted by the Clang python bindings (as a TranslationUnit) to a pycparser AST (As found in Eli Bendersky’s code here) to work with some existing code. Eventually, I have a recursive function that points to a cursor of kind INTEGER_LITERAL, but if the integer literal came from a preprocessed macro, the cursor.get_tokens() and cursor.spelling attributes are both empty. Is there a way to reliably retrieve an integer constant form a cursor?

Thanks for any help,

Theodor