提交 b564a736 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Set default error in fail, so "None" is not raised.

上级 67f3ff83
......@@ -124,8 +124,19 @@ class CodeBlock:
def failure_code(sub):
"""WRITEME"""
return "{%(failure_var)s = %(id)s; goto __label_%(id)i;}" % sub
"""Code contained in sub['fail'], usually substituted for %(fail)s.
It sets information about current error, then goto the code
actually handling the failure, which is defined in struct_gen().
"""
return '''{
%(failure_var)s = %(id)s;
if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError,
"Unexpected error in an Op's C code. "
"No Python exception was set");
}
goto __label_%(id)i;}''' % sub
def code_gen(blocks):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论