Created
October 13, 2017 15:54
Star
You must be signed in to star a gist
preprocessor in cython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A trick to embed preprocessors in cython | |
cdef extern from *: | |
cdef void EMIT_IF_PYTHON_VERSION_HEX_LT_37 "#if PY_VERSION_HEX < 0x03070000 //" () | |
cdef void EMIT_ELSE "#else //" () | |
cdef void EMIT_ENDIF "#endif //" () | |
EMIT_IF_PYTHON_VERSION_HEX_LT_37() | |
EMIT_ELSE() | |
EMIT_ENDIF() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great trick! Still working as of Cython 0.29.10.