diff --git a/src/bindgen/ir/constant.rs b/src/bindgen/ir/constant.rs index 0013fce3..82087b78 100644 --- a/src/bindgen/ir/constant.rs +++ b/src/bindgen/ir/constant.rs @@ -841,12 +841,16 @@ impl Constant { language_backend.write_literal(out, value); } Language::Cython => { - out.write("const "); - language_backend.write_type(out, &self.ty); - // For extern Cython declarations the initializer is ignored, - // but still useful as documentation, so we write it as a comment. - write!(out, " {} # = ", name); - language_backend.write_literal(out, value); + if matches!(self.value, Literal::PanicMacro(_)) { + // Cython don't have a equivalent to `#error` directive + } else { + out.write("const "); + language_backend.write_type(out, &self.ty); + // For extern Cython declarations the initializer is ignored, + // but still useful as documentation, so we write it as a comment. + write!(out, " {} # = ", name); + language_backend.write_literal(out, value); + } } }