Last active
October 7, 2017 13:48
-
-
Save tusharpm/ac0eef89796ca9c67ca92fe6c6071f6b to your computer and use it in GitHub Desktop.
Cython raw string literal broken example
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
| from Cython.Compiler import Options | |
| Options.annotate = True | |
| Options.fast_fail = True | |
| from Cython.Build import cythonize | |
| cythonize(["main.pyx"], language='c++') |
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
| from mypxd cimport ( | |
| myInt | |
| ) | |
| print(myInt) |
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
| # This one works. | |
| # cdef extern from ".\\util.h": | |
| # This one doesn't. | |
| cdef extern from r".\util.h": | |
| const unsigned myInt |
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
| const unsigned myInt = 32768; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice catch. That was the problem.
Adding
#cython: language_level=3to the pxd file solved it.Thanks!