Created
October 13, 2017 15:54
-
-
Save sonots/63e55ee3f7e46b4e6e897a936ae35670 to your computer and use it in GitHub Desktop.
preprocessor in cython
This file contains hidden or 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.