You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this is a bug in your code: except * means "can raise a Python exception with any return value". Since you wouldn't expect __pyx_v_codec to be assigned if the function raises a Python exception then the code generated is correct.
OK sorry I misunderstood. The existence of the temporary is right, because it's matching the following Python behaviour:
def f():
raise RuntimeError()
def g():
try:
a = f()
except:
# "a" shouldn't be assigned here
If the temporary didn't exist then a would be assigned directly exception or not and the behaviour would be incorrect. I think we both agree on this bit, but just making sure.
I'm not 100% sure what C++ standard Cython targets as a baseline. I'm pretty sure it still targets C89, so on that basis I'd assume it aims for the earliest possible C++ standard, and that std::move might not be acceptable for generated code. But I don't know this for certain so I'll stop commenting now.
If I have a C++ API such as the following:
Then the following Cython code:
creates this C++ code:
which fails compiling because it tries to copy a
unique_ptr
.Cython should instead move the temporary:
(I can add the
move()
call explicitly in the Cython source, but it's a bit surprising, and also it's also inconvenient because of #2169)The text was updated successfully, but these errors were encountered: