$_{set}$lets you set two internal variables in Clinic. $_{line_prefix}$is a string that will be prepended to every line of Clinic’s output; line_suffix is a string that will be appended to every line of Clinic’s output. 

Both of these support two format strings: 

{block comment start} Turns into the string /* , the start-comment text sequence for C files. $_{{block comment end}}$Turns into the string$_{*/}$ , the end-comment text sequence for C files. 

The final new directive is one you shouldn’t need to use directly, called preserve : 

preserve 

This tells Clinic that the current contents of the output should be kept, unmodified. This is used internally by Clinic when dumping output into$_{file}$files; wrapping it in a Clinic block lets Clinic use its existing checksum functionality to ensure the file was not modified by hand before it gets overwritten. 

## 4.20 The #ifdef trick 

If you’re converting a function that isn’t available on all platforms, there’s a trick you can use to make life a little easier. The existing code probably looks like this: 

#ifdef HAVE_FUNCTIONNAME static module_functionname (...) { ... } #endif /* HAVE_FUNCTIONNAME */ 

And then in the$_{PyMethodDef}$ structure at the bottom the existing code will have: 

#ifdef HAVE_FUNCTIONNAME {'functionname', ... }, #endif /* HAVE_FUNCTIONNAME */ 

In this scenario, you should enclose the body of your impl function inside the$_{#ifdef}$ , like so: 

#ifdef HAVE_FUNCTIONNAME /*[clinic input] module.functionname ... [clinic start generated code]*/ static module_functionname (...) { ... } #endif /* HAVE_FUNCTIONNAME */ 

Then, remove those three lines from the$_{PyMethodDef}$ structure, replacing them with the macro Argument Clinic generated: 

MODULE_FUNCTIONNAME_METHODDEF 

(You can find the real name for this macro inside the generated code. Or you can calculate it yourself: it’s the name of your function as defined on the first line of your block, but with periods changed to underscores, uppercased, and "_METHODDEF" added to the end.) 

Perhaps you’re wondering: what if HAVE_FUNCTIONNAME isn’t defined? The MODULE_FUNCTIONNAME_METHODDEF macro won’t be defined either! 

Here’s where Argument Clinic gets very clever. It actually detects that the Argument Clinic block might be deactivated by the$_{#ifdef}$ . When that happens, it generates a little extra code that looks like this: 

