-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad code generated for except +*
function
#3065
Comments
#3064 is different, but probably related. |
Running into this as well. My current work around for this issue is the following dummy function: cdef dummy() except +:
dummy() which tricks cython into generating
|
Looking at the original, only It looks like there's somewhere that doesn't generate the correct utility code though... I'm not sure if that's because the assume that a Cython-defined function can't be |
In my case I have C++ functions, that can throw exceptions or have an error set from e.g. PyUnicode_READY. cdef extern from "example.hpp":
double func1(...) except +*
double func2() except +* it was also not enough to add a dummy function in the C++ code cdef extern from "example.hpp":
double func1(...) except +*
double func2() except +*
dummy except + apparently it only generates the code when the function is actually called |
Thanks @maxbachmann - that's a useful clarification |
Fixes issue cython#3065 Fixes issue cython#3066
Thanks, @da-woods. |
Hello up there. Please consider the following example:
---- 8< ---- (
y.pyx
)Explanation:
ggg
throws C++ exception and is not marked withexcept +
-- thus functions that callsggg
may throw C++ exception themselves;fff
raises Python exception but returns void. It thus is marked withexcept *
for its caller to check whether Python exception occurred.hhh
calls bothfff
andggg
. It thus may raise either Python exception (fromfff
) or C++ exception (fromggg
).hhh
is thus marked asexcept +*
.When trying to cythonize
y.pyx
, it gives:With the following code generated for
hhh
:Notice the
__pyx_r = <Cython.Compiler.ExprNodes.CharNode object at 0x7f8e76e20810>;
line.Cython version:
0.29.13-514-gac1c9fe47
(today's master).Thanks beforehand,
Kirill
The text was updated successfully, but these errors were encountered: