<aclass="reference internal"href="#ref-typedef-annos"><em>typedef annotations</em></a> or <aclass="reference internal"href="#ref-variable-annos"><em>variable annotations</em></a> depending on the context in which they can be used.</p>
<p>Annotations are placed between forward slashes (<ttclass="docutils literal"><spanclass="pre">/</span></tt>). Multiple annotations
are comma separated within the slashes.</p>
<p>Annotations have a type and, possibly, a value. The type determines the
format of the value. The name of an annotation and its value are separated by
<p>Annotations can have one of the following types:</p>
<dlclass="docutils">
<dt><em>boolean</em></dt>
<dd>This type of annotation has no value and is implicitly true.</dd>
<dt><em>name</em></dt>
<dd>The value is a name that is compatible with a C/C++ identifier. In some
cases the value is optional.</dd>
<dt><em>dotted name</em></dt>
<dd>The value is a name that is compatible with an identifier preceded by a
Python scope.</dd>
<dt><em>string</em></dt>
<dd>The value is a double quoted string.</dd>
<dt><em>API range</em></dt>
<dd><pclass="first">The value is the name of an API (defined using the <aclass="reference external"href="directives.html#directive-%API"><ttclass="xref docutils literal"><spanclass="pre">%API</span></tt></a>
directive) separated by a range of version numbers with a colon.</p>
<p>The range of version numbers is a pair of numbers separated by a hyphen
specifying the lower and upper bounds of the range. A version number is
within the range if it is greater or equal to the lower bound and less
than the upper bound. Each bound can be omitted meaning that the range is
<p>Note that the current version of SIP does not complain about unknown
annotations, or annotations used out of their correct context.</p>
<divclass="section"id="argument-annotations">
<spanid="ref-arg-annos"></span><h2>Argument Annotations<aclass="headerlink"href="#argument-annotations"title="Permalink to this headline">¶</a></h2>
<dlclass="argument-annotation">
<dtid="aanno-AllowNone">
<ttclass="descname">AllowNone</tt><aclass="headerlink"href="#aanno-AllowNone"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation specifies that the value of the corresponding
argument (which should be either <aclass="reference external"href="specification_files.html#stype-SIP_PYCALLABLE"><ttclass="xref docutils literal"><spanclass="pre">SIP_PYCALLABLE</span></tt></a>,
<aclass="reference external"href="specification_files.html#stype-SIP_PYTUPLE"><ttclass="xref docutils literal"><spanclass="pre">SIP_PYTUPLE</span></tt></a> or <aclass="reference external"href="specification_files.html#stype-SIP_PYTYPE"><ttclass="xref docutils literal"><spanclass="pre">SIP_PYTYPE</span></tt></a>) may be <ttclass="xref docutils literal"><spanclass="pre">None</span></tt>.</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-Array">
<ttclass="descname">Array</tt><aclass="headerlink"href="#aanno-Array"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation specifies that the corresponding argument refers
to an array.</p>
<p>The argument should be either a pointer to a wrapped type, a <ttclass="docutils literal"><spanclass="pre">char</span><spanclass="pre">*</span></tt> or
a <ttclass="docutils literal"><spanclass="pre">unsigned</span><spanclass="pre">char</span><spanclass="pre">*</span></tt>. If the argument is a character array then the
annotation also implies the <aclass="reference internal"href="#aanno-Encoding"><ttclass="xref docutils literal"><spanclass="pre">Encoding</span></tt></a> annotation with an encoding
of <ttclass="docutils literal"><spanclass="pre">"None"</span></tt>.</p>
<p>There must be a corresponding argument with the <aclass="reference internal"href="#aanno-ArraySize"><ttclass="xref docutils literal"><spanclass="pre">ArraySize</span></tt></a>
annotation specified. The annotation may only be specified once in a list
of arguments.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-ArraySize">
<ttclass="descname">ArraySize</tt><aclass="headerlink"href="#aanno-ArraySize"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation specifies that the corresponding argument (which
should be either <ttclass="docutils literal"><spanclass="pre">short</span></tt>, <ttclass="docutils literal"><spanclass="pre">unsigned</span><spanclass="pre">short</span></tt>, <ttclass="docutils literal"><spanclass="pre">int</span></tt>, <ttclass="docutils literal"><spanclass="pre">unsigned</span></tt>,
<ttclass="docutils literal"><spanclass="pre">long</span></tt> or <ttclass="docutils literal"><spanclass="pre">unsigned</span><spanclass="pre">long</span></tt>) refers to the size of an array. There must
be a corresponding argument with the <aclass="reference internal"href="#aanno-Array"><ttclass="xref docutils literal"><spanclass="pre">Array</span></tt></a> annotation specified.
The annotation may only be specified once in a list of arguments.</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-Constrained">
<ttclass="descname">Constrained</tt><aclass="headerlink"href="#aanno-Constrained"title="Permalink to this definition">¶</a></dt>
<dd><p>Python will automatically convert between certain compatible types. For
example, if a floating pointer number is expected and an integer supplied,
then the integer will be converted appropriately. This can cause problems
when wrapping C or C++ functions with similar signatures. For example:</p>
<divclass="highlight-python"><pre>// The wrapper for this function will also accept an integer argument
// which Python will automatically convert to a floating point number.
void foo(double);
// The wrapper for this function will never get used.
void foo(int);</pre>
</div>
<p>This boolean annotation specifies that the corresponding argument (which
should be either <ttclass="docutils literal"><spanclass="pre">bool</span></tt>, <ttclass="docutils literal"><spanclass="pre">int</span></tt>, <ttclass="docutils literal"><spanclass="pre">float</span></tt>, <ttclass="docutils literal"><spanclass="pre">double</span></tt>, <ttclass="docutils literal"><spanclass="pre">enum</span></tt> or a
wrapped class) must match the type without any automatic conversions. In
the context of a wrapped class the invocation of any
<aclass="reference external"href="directives.html#directive-%ConvertToTypeCode"><ttclass="xref docutils literal"><spanclass="pre">%ConvertToTypeCode</span></tt></a> is suppressed.</p>
<p>The following example gets around the above problem:</p>
<divclass="highlight-python"><pre>// The wrapper for this function will only accept floating point
// numbers.
void foo(double /Constrained/);
// The wrapper for this function will be used for anything that Python
// can convert to an integer, except for floating point numbers.
void foo(int);</pre>
</div>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-DocType">
<ttclass="descname">DocType</tt><aclass="headerlink"href="#aanno-DocType"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.</span></p>
<p>This string annotation specifies the type of the argument as it will appear
in any generated docstrings. It is usually used with arguments of type
<aclass="reference external"href="specification_files.html#stype-SIP_PYOBJECT"><ttclass="xref docutils literal"><spanclass="pre">SIP_PYOBJECT</span></tt></a> to provide a more specific type.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-DocValue">
<ttclass="descname">DocValue</tt><aclass="headerlink"href="#aanno-DocValue"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.</span></p>
<p>This string annotation specifies the default value of the argument as it
will appear in any generated docstrings.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-Encoding">
<ttclass="descname">Encoding</tt><aclass="headerlink"href="#aanno-Encoding"title="Permalink to this definition">¶</a></dt>
<dd><p>This string annotation specifies that the corresponding argument (which
should be either <ttclass="docutils literal"><spanclass="pre">char</span></tt>, <ttclass="docutils literal"><spanclass="pre">const</span><spanclass="pre">char</span></tt>, <ttclass="docutils literal"><spanclass="pre">char</span><spanclass="pre">*</span></tt> or <ttclass="docutils literal"><spanclass="pre">const</span><spanclass="pre">char</span><spanclass="pre">*</span></tt>)
refers to an encoded character or <ttclass="docutils literal"><spanclass="pre">'\0'</span></tt> terminated encoded string with
the specified encoding. The encoding can be either <ttclass="docutils literal"><spanclass="pre">"ASCII"</span></tt>,
<ttclass="docutils literal"><spanclass="pre">"Latin-1"</span></tt>, <ttclass="docutils literal"><spanclass="pre">"UTF-8"</span></tt> or <ttclass="docutils literal"><spanclass="pre">"None"</span></tt>. An encoding of <ttclass="docutils literal"><spanclass="pre">"None"</span></tt> means
that the corresponding argument refers to an unencoded character or string.</p>
<p>The default encoding is specified by the <aclass="reference external"href="directives.html#directive-%DefaultEncoding"><ttclass="xref docutils literal"><spanclass="pre">%DefaultEncoding</span></tt></a>
directive. If the directive is not specified then <ttclass="xref docutils literal"><spanclass="pre">None</span></tt> is used.</p>
<p>Python v3 will use the <ttclass="docutils literal"><spanclass="pre">bytes</span></tt> type to represent the argument if the
encoding is <ttclass="docutils literal"><spanclass="pre">"None"</span></tt> and the <ttclass="docutils literal"><spanclass="pre">str</span></tt> type otherwise.</p>
<p>Python v2 will use the <ttclass="docutils literal"><spanclass="pre">str</span></tt> type to represent the argument if the
encoding is <ttclass="docutils literal"><spanclass="pre">"None"</span></tt> and the <ttclass="docutils literal"><spanclass="pre">unicode</span></tt> type otherwise.</p>
<ttclass="descname">GetWrapper</tt><aclass="headerlink"href="#aanno-GetWrapper"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation is only ever used in conjunction with handwritten
code specified with the <aclass="reference external"href="directives.html#directive-%MethodCode"><ttclass="xref docutils literal"><spanclass="pre">%MethodCode</span></tt></a> directive. It causes an
extra variable to be generated for the corresponding argument which is a
pointer to the Python object that wraps the argument.</p>
<p>See the <aclass="reference external"href="directives.html#directive-%MethodCode"><ttclass="xref docutils literal"><spanclass="pre">%MethodCode</span></tt></a> directive for more detail.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-In">
<ttclass="descname">In</tt><aclass="headerlink"href="#aanno-In"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation is used to specify that the corresponding argument
(which should be a pointer type) is used to pass a value to the function.</p>
<p>For pointers to wrapped C structures or C++ class instances, <ttclass="docutils literal"><spanclass="pre">char</span><spanclass="pre">*</span></tt> and
<ttclass="docutils literal"><spanclass="pre">unsigned</span><spanclass="pre">char</span><spanclass="pre">*</span></tt> then this annotation is assumed unless the <aclass="reference internal"href="#aanno-Out"><ttclass="xref docutils literal"><spanclass="pre">Out</span></tt></a>
annotation is specified.</p>
<p>For pointers to other types then this annotation must be explicitly
specified if required. The argument will be dereferenced to obtain the
actual value.</p>
<p>Both <aclass="reference internal"href="#aanno-In"><ttclass="xref docutils literal"><spanclass="pre">In</span></tt></a> and <aclass="reference internal"href="#aanno-Out"><ttclass="xref docutils literal"><spanclass="pre">Out</span></tt></a> may be specified for the same argument.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-KeepReference">
<ttclass="descname">KeepReference</tt><aclass="headerlink"href="#aanno-KeepReference"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used to specify that a reference to the
corresponding argument should be kept to ensure that the object is not
garbage collected. If the method is called again with a new argument then
the reference to the previous argument is discarded. Note that ownership
of the argument is not changed.</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-NoCopy">
<ttclass="descname">NoCopy</tt><aclass="headerlink"href="#aanno-NoCopy"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.1.</span></p>
<p>This boolean annotation is used with arguments of virtual methods that are
a <ttclass="docutils literal"><spanclass="pre">const</span></tt> reference to a class. Normally, if the class defines a copy
constructor then a copy of the returned reference is automatically created
and wrapped before being passed to a Python reimplementation of the method.
The copy will be owned by Python. This means that the reimplementation may
take a reference to the argument without having to make an explicit copy.</p>
<p>If the annotation is specified then the copy is not made and the original
reference is wrapped instead and will be owned by C++.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-Out">
<ttclass="descname">Out</tt><aclass="headerlink"href="#aanno-Out"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation is used to specify that the corresponding argument
(which should be a pointer type) is used by the function to return a value
as an element of a tuple.</p>
<p>For pointers to wrapped C structures or C++ class instances, <ttclass="docutils literal"><spanclass="pre">char</span><spanclass="pre">*</span></tt> and
<ttclass="docutils literal"><spanclass="pre">unsigned</span><spanclass="pre">char</span><spanclass="pre">*</span></tt> then this annotation must be explicitly specified if
required.</p>
<p>For pointers to other types then this annotation is assumed unless the
<aclass="reference internal"href="#aanno-In"><ttclass="xref docutils literal"><spanclass="pre">In</span></tt></a> annotation is specified.</p>
<p>Both <aclass="reference internal"href="#aanno-In"><ttclass="xref docutils literal"><spanclass="pre">In</span></tt></a> and <aclass="reference internal"href="#aanno-Out"><ttclass="xref docutils literal"><spanclass="pre">Out</span></tt></a> may be specified for the same argument.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-ResultSize">
<ttclass="descname">ResultSize</tt><aclass="headerlink"href="#aanno-ResultSize"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used with functions or methods that return a
<ttclass="docutils literal"><spanclass="pre">void</span><spanclass="pre">*</span></tt> or <ttclass="docutils literal"><spanclass="pre">const</span><spanclass="pre">void</span><spanclass="pre">*</span></tt>. It identifies an argument that defines the
size of the block of memory whose address is being returned. This allows
the <ttclass="docutils literal"><spanclass="pre">sip.voidptr</span></tt> object that wraps the address to support the Python
buffer protocol and allows the memory to be read and updated when wrapped
by the Python <ttclass="docutils literal"><spanclass="pre">buffer()</span></tt> builtin.</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-SingleShot">
<ttclass="descname">SingleShot</tt><aclass="headerlink"href="#aanno-SingleShot"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used only with arguments of type
<aclass="reference external"href="specification_files.html#stype-SIP_RXOBJ_CON"><ttclass="xref docutils literal"><spanclass="pre">SIP_RXOBJ_CON</span></tt></a> to specify that the signal connected to the slot
will only ever be emitted once. This prevents a certain class of memory
leaks.</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-Transfer">
<ttclass="descname">Transfer</tt><aclass="headerlink"href="#aanno-Transfer"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation is used to specify that ownership of the
corresponding argument (which should be a wrapped C structure or C++ class
instance) is transferred from Python to C++. In addition, if the argument
is of a class method, then it is associated with the class instance with
regard to the cyclic garbage collector.</p>
<p>See <aclass="reference external"href="using.html#ref-object-ownership"><em>Ownership of Objects</em></a> for more detail.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-TransferBack">
<ttclass="descname">TransferBack</tt><aclass="headerlink"href="#aanno-TransferBack"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation is used to specify that ownership of the
corresponding argument (which should be a wrapped C structure or C++ class
instance) is transferred back to Python from C++. In addition, any
association of the argument with regard to the cyclic garbage collector
with another instance is removed.</p>
<p>See <aclass="reference external"href="using.html#ref-object-ownership"><em>Ownership of Objects</em></a> for more detail.</p>
</dd></dl>
<dlclass="argument-annotation">
<dtid="aanno-TransferThis">
<ttclass="descname">TransferThis</tt><aclass="headerlink"href="#aanno-TransferThis"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation is only used in C++ constructors or methods. In
the context of a constructor or factory method it specifies that ownership
of the instance being created is transferred from Python to C++ if the
corresponding argument (which should be a wrapped C structure or C++ class
instance) is not <ttclass="xref docutils literal"><spanclass="pre">None</span></tt>. In addition, the newly created instance is
associated with the argument with regard to the cyclic garbage collector.</p>
<p>In the context of a non-factory method it specifies that ownership of
<ttclass="docutils literal"><spanclass="pre">this</span></tt> is transferred from Python to C++ if the corresponding argument is
not <ttclass="xref docutils literal"><spanclass="pre">None</span></tt>. If it is <ttclass="xref docutils literal"><spanclass="pre">None</span></tt> then ownership is transferred to Python.</p>
<p>The annotation may be used more that once, in which case ownership is
transferred to last instance that is not <ttclass="xref docutils literal"><spanclass="pre">None</span></tt>.</p>
<p>See <aclass="reference external"href="using.html#ref-object-ownership"><em>Ownership of Objects</em></a> for more detail.</p>
</dd></dl>
</div>
<divclass="section"id="class-annotations">
<spanid="ref-class-annos"></span><h2>Class Annotations<aclass="headerlink"href="#class-annotations"title="Permalink to this headline">¶</a></h2>
<dlclass="class-annotation">
<dtid="canno-Abstract">
<ttclass="descname">Abstract</tt><aclass="headerlink"href="#canno-Abstract"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used to specify that the class has additional
pure virtual methods that have not been specified and so it cannot be
instantiated or sub-classed from Python.</dd></dl>
<dlclass="class-annotation">
<dtid="canno-AllowNone">
<ttclass="descname">AllowNone</tt><aclass="headerlink"href="#canno-AllowNone"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.8.2.</span></p>
<p>Normally when a Python object is converted to a C/C++ instance <ttclass="xref docutils literal"><spanclass="pre">None</span></tt>
is handled automatically before the class’s
<aclass="reference external"href="directives.html#directive-%ConvertToTypeCode"><ttclass="xref docutils literal"><spanclass="pre">%ConvertToTypeCode</span></tt></a> is called. This boolean annotation
specifies that the handling of <ttclass="xref docutils literal"><spanclass="pre">None</span></tt> will be left to the
<aclass="reference external"href="directives.html#directive-%ConvertToTypeCode"><ttclass="xref docutils literal"><spanclass="pre">%ConvertToTypeCode</span></tt></a>. The annotation is ignored if the class
does not have any <aclass="reference external"href="directives.html#directive-%ConvertToTypeCode"><ttclass="xref docutils literal"><spanclass="pre">%ConvertToTypeCode</span></tt></a>.</p>
</dd></dl>
<dlclass="class-annotation">
<dtid="canno-API">
<ttclass="descname">API</tt><aclass="headerlink"href="#canno-API"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.9.</span></p>
<p>This API range annotation is used to specify an API and corresponding
range of version numbers that the class is enabled for.</p>
<p>If a class or mapped type has different implementations enabled for
different ranges of version numbers then those ranges must not overlap.</p>
<p>See <aclass="reference external"href="using.html#ref-incompat-apis"><em>Managing Incompatible APIs</em></a> for more detail.</p>
</dd></dl>
<dlclass="class-annotation">
<dtid="canno-DelayDtor">
<ttclass="descname">DelayDtor</tt><aclass="headerlink"href="#canno-DelayDtor"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation is used to specify that the class’s destructor
should not be called until the Python interpreter exits. It would normally
only be applied to singleton classes.</p>
<p>When the Python interpreter exits the order in which any wrapped instances
are garbage collected is unpredictable. However, the underlying C or C++
instances may need to be destroyed in a certain order. If this annotation
is specified then when the wrapped instance is garbage collected the C or
C++ instance is not destroyed but instead added to a list of delayed
instances. When the interpreter exits then the function
<atitle="sipDelayedDtors"class="reference internal"href="#sipDelayedDtors"><ttclass="xref docutils literal"><spanclass="pre">sipDelayedDtors()</span></tt></a> is called with the list of delayed instances.
<atitle="sipDelayedDtors"class="reference internal"href="#sipDelayedDtors"><ttclass="xref docutils literal"><spanclass="pre">sipDelayedDtors()</span></tt></a> can then choose to call (or ignore) the
destructors in any desired order.</p>
<p>The <atitle="sipDelayedDtors"class="reference internal"href="#sipDelayedDtors"><ttclass="xref docutils literal"><spanclass="pre">sipDelayedDtors()</span></tt></a> function must be specified using the
void <ttclass="descname">sipDelayedDtors</tt><big>(</big>const <atitle="sipDelayedDtor"class="reference internal"href="#sipDelayedDtor">sipDelayedDtor</a><em> *dd_list</em><big>)</big><aclass="headerlink"href="#sipDelayedDtors"title="Permalink to this definition">¶</a></dt>
<trclass="field"><thclass="field-name">Parameter:</th><tdclass="field-body"><em>dd_list</em>– the linked list of delayed instances.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dlclass="ctype">
<dtid="sipDelayedDtor">
<ttclass="descname">sipDelayedDtor</tt><aclass="headerlink"href="#sipDelayedDtor"title="Permalink to this definition">¶</a></dt>
<dd><p>This structure describes a particular delayed destructor.</p>
<dlclass="cmember">
<dtid="dd_name">
const char *<ttclass="descname">dd_name</tt><aclass="headerlink"href="#dd_name"title="Permalink to this definition">¶</a></dt>
<dd>This is the name of the class excluding any package or module name.</dd></dl>
<dlclass="cmember">
<dtid="dd_ptr">
void *<ttclass="descname">dd_ptr</tt><aclass="headerlink"href="#dd_ptr"title="Permalink to this definition">¶</a></dt>
<dd>This is the address of the C or C++ instance to be destroyed. It’s
exact type depends on the value of <atitle="dd_isderived"class="reference internal"href="#dd_isderived"><ttclass="xref docutils literal"><spanclass="pre">dd_isderived</span></tt></a>.</dd></dl>
<dlclass="cmember">
<dtid="dd_isderived">
int <ttclass="descname">dd_isderived</tt><aclass="headerlink"href="#dd_isderived"title="Permalink to this definition">¶</a></dt>
<dd>This is non-zero if the type of <atitle="dd_ptr"class="reference internal"href="#dd_ptr"><ttclass="xref docutils literal"><spanclass="pre">dd_ptr</span></tt></a> is actually the
generated derived class. This allows the correct destructor to be
called. See <aclass="reference external"href="c_api.html#ref-derived-classes"><em>Generated Derived Classes</em></a>.</dd></dl>
<dlclass="cmember">
<dtid="dd_next">
<atitle="sipDelayedDtor"class="reference internal"href="#sipDelayedDtor">sipDelayedDtor</a> *<ttclass="descname">dd_next</tt><aclass="headerlink"href="#dd_next"title="Permalink to this definition">¶</a></dt>
<dd>This is the address of the next entry in the list or zero if this is
the last one.</dd></dl>
<p>Note that the above applies only to C and C++ instances that are owned by
Python.</p>
</dd></dl>
<dlclass="class-annotation">
<dtid="canno-Deprecated">
<ttclass="descname">Deprecated</tt><aclass="headerlink"href="#canno-Deprecated"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used to specify that the class is deprecated.
It is the equivalent of annotating all the class’s constructors, function
and methods as being deprecated.</dd></dl>
<dlclass="class-annotation">
<dtid="canno-External">
<ttclass="descname">External</tt><aclass="headerlink"href="#canno-External"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used to specify that the class is defined in
another module. Declarations of external classes are private to the module
in which they appear.</dd></dl>
<dlclass="class-annotation">
<dtid="canno-Metatype">
<ttclass="descname">Metatype</tt><aclass="headerlink"href="#canno-Metatype"title="Permalink to this definition">¶</a></dt>
<dd><p>This dotted name annotation specifies the name of the Python type object
(i.e. the value of the <ttclass="docutils literal"><spanclass="pre">tp_name</span></tt> field) used as the meta-type used when
creating the type object for this C structure or C++ type.</p>
<p>See the section <aclass="reference external"href="using.html#ref-types-metatypes"><em>Types and Meta-types</em></a> for more details.</p>
</dd></dl>
<dlclass="class-annotation">
<dtid="canno-NoDefaultCtors">
<ttclass="descname">NoDefaultCtors</tt><aclass="headerlink"href="#canno-NoDefaultCtors"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used to suppress the automatic generation of
default constructors for the class.</dd></dl>
<dlclass="class-annotation">
<dtid="canno-PyName">
<ttclass="descname">PyName</tt><aclass="headerlink"href="#canno-PyName"title="Permalink to this definition">¶</a></dt>
<dd>This name annotation specifies an alternative name for the class being
wrapped which is used when it is referred to from Python. It is required
when a class name is the same as a Python keyword. It may also be used to
avoid name clashes with other objects (e.g. enums, exceptions, functions)
that have the same name in the same C++ scope.</dd></dl>
<dlclass="class-annotation">
<dtid="canno-Supertype">
<ttclass="descname">Supertype</tt><aclass="headerlink"href="#canno-Supertype"title="Permalink to this definition">¶</a></dt>
<dd><p>This dotted name annotation specifies the name of the Python type object
(i.e. the value of the <ttclass="docutils literal"><spanclass="pre">tp_name</span></tt> field) used as the super-type used when
creating the type object for this C structure or C++ type.</p>
<p>See the section <aclass="reference external"href="using.html#ref-types-metatypes"><em>Types and Meta-types</em></a> for more details.</p>
</dd></dl>
</div>
<divclass="section"id="mapped-type-annotations">
<spanid="ref-mapped-type-annos"></span><h2>Mapped Type Annotations<aclass="headerlink"href="#mapped-type-annotations"title="Permalink to this headline">¶</a></h2>
<dlclass="mapped-type-annotation">
<dtid="manno-AllowNone">
<ttclass="descname">AllowNone</tt><aclass="headerlink"href="#manno-AllowNone"title="Permalink to this definition">¶</a></dt>
<dd>Normally when a Python object is converted to a C/C++ instance <ttclass="xref docutils literal"><spanclass="pre">None</span></tt>
is handled automatically before the mapped type’s
<aclass="reference external"href="directives.html#directive-%ConvertToTypeCode"><ttclass="xref docutils literal"><spanclass="pre">%ConvertToTypeCode</span></tt></a> is called. This boolean annotation
specifies that the handling of <ttclass="xref docutils literal"><spanclass="pre">None</span></tt> will be left to the
<ttclass="descname">API</tt><aclass="headerlink"href="#manno-API"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.9.</span></p>
<p>This API range annotation is used to specify an API and corresponding
range of version numbers that the mapped type is enabled for.</p>
<p>If a class or mapped type has different implementations enabled for
different ranges of version numbers then those ranges must not overlap.</p>
<p>See <aclass="reference external"href="using.html#ref-incompat-apis"><em>Managing Incompatible APIs</em></a> for more detail.</p>
</dd></dl>
<dlclass="mapped-type-annotation">
<dtid="manno-DocType">
<ttclass="descname">DocType</tt><aclass="headerlink"href="#manno-DocType"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.</span></p>
<p>This string annotation specifies the name of the type as it will appear in
any generated docstrings.</p>
</dd></dl>
<dlclass="mapped-type-annotation">
<dtid="manno-NoRelease">
<ttclass="descname">NoRelease</tt><aclass="headerlink"href="#manno-NoRelease"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used to specify that the mapped type does not
support the <atitle="sipReleaseType"class="reference external"href="c_api.html#sipReleaseType"><ttclass="xref docutils literal"><spanclass="pre">sipReleaseType()</span></tt></a> function. Any
<aclass="reference external"href="directives.html#directive-%ConvertToTypeCode"><ttclass="xref docutils literal"><spanclass="pre">%ConvertToTypeCode</span></tt></a> should not create temporary instances of
the mapped type, i.e. it should not return <ttclass="xref docutils literal"><spanclass="pre">SIP_TEMPORARY</span></tt>.</dd></dl>
</div>
<divclass="section"id="enum-annotations">
<spanid="ref-enum-annos"></span><h2>Enum Annotations<aclass="headerlink"href="#enum-annotations"title="Permalink to this headline">¶</a></h2>
<dlclass="enum-annotation">
<dtid="eanno-PyName">
<ttclass="descname">PyName</tt><aclass="headerlink"href="#eanno-PyName"title="Permalink to this definition">¶</a></dt>
<dd>This name annotation specifies an alternative name for the enum or enum
member being wrapped which is used when it is referred to from Python. It
is required when an enum or enum member name is the same as a Python
keyword. It may also be used to avoid name clashes with other objects
(e.g. classes, exceptions, functions) that have the same name in the same
C++ scope.</dd></dl>
</div>
<divclass="section"id="exception-annotations">
<spanid="ref-exception-annos"></span><h2>Exception Annotations<aclass="headerlink"href="#exception-annotations"title="Permalink to this headline">¶</a></h2>
<dlclass="exception-annotation">
<dtid="xanno-Default">
<ttclass="descname">Default</tt><aclass="headerlink"href="#xanno-Default"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation specifies that the exception being defined will be
used as the default exception to be caught if a function or constructor
does not have a <ttclass="docutils literal"><spanclass="pre">throw</span></tt> clause.</dd></dl>
<dlclass="exception-annotation">
<dtid="xanno-PyName">
<ttclass="descname">PyName</tt><aclass="headerlink"href="#xanno-PyName"title="Permalink to this definition">¶</a></dt>
<dd>This name annotation specifies an alternative name for the exception being
defined which is used when it is referred to from Python. It is required
when an exception name is the same as a Python keyword. It may also be
used to avoid name clashes with other objects (e.g. classes, enums,
functions) that have the same name.</dd></dl>
</div>
<divclass="section"id="function-annotations">
<spanid="ref-function-annos"></span><h2>Function Annotations<aclass="headerlink"href="#function-annotations"title="Permalink to this headline">¶</a></h2>
<dlclass="function-annotation">
<dtid="fanno-API">
<ttclass="descname">API</tt><aclass="headerlink"href="#fanno-API"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.9.</span></p>
<p>This API range annotation is used to specify an API and corresponding
range of version numbers that the function is enabled for.</p>
<p>See <aclass="reference external"href="using.html#ref-incompat-apis"><em>Managing Incompatible APIs</em></a> for more detail.</p>
</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-AutoGen">
<ttclass="descname">AutoGen</tt><aclass="headerlink"href="#fanno-AutoGen"title="Permalink to this definition">¶</a></dt>
<dd>This optional name annotation is used with class methods to specify that
the method be automatically included in all sub-classes. The value is the
name of a feature (specified using the <aclass="reference external"href="directives.html#directive-%Feature"><ttclass="xref docutils literal"><spanclass="pre">%Feature</span></tt></a> directive)
which must be enabled for the method to be generated.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-Default">
<ttclass="descname">Default</tt><aclass="headerlink"href="#fanno-Default"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is only used with C++ constructors. Sometimes SIP
needs to create a class instance. By default it uses a constructor with no
compulsory arguments if one is specified. (SIP will automatically generate
a constructor with no arguments if no constructors are specified.) This
annotation is used to explicitly specify which constructor to use. Zero is
passed as the value of any arguments to the constructor.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-Deprecated">
<ttclass="descname">Deprecated</tt><aclass="headerlink"href="#fanno-Deprecated"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used to specify that the constructor or function
is deprecated. A deprecation warning is issued whenever the constructor or
function is called.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-DocType">
<ttclass="descname">DocType</tt><aclass="headerlink"href="#fanno-DocType"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.</span></p>
<p>This string annotation specifies the name of the type of the returned value
as it will appear in any generated docstrings. It is usually used with
values of type <aclass="reference external"href="specification_files.html#stype-SIP_PYOBJECT"><ttclass="xref docutils literal"><spanclass="pre">SIP_PYOBJECT</span></tt></a> to provide a more specific type.</p>
</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-Factory">
<ttclass="descname">Factory</tt><aclass="headerlink"href="#fanno-Factory"title="Permalink to this definition">¶</a></dt>
<dd><p>This boolean annotation specifies that the value returned by the function
(which should be a wrapped C structure or C++ class instance) is a newly
created instance and is owned by Python.</p>
<p>See <aclass="reference external"href="using.html#ref-object-ownership"><em>Ownership of Objects</em></a> for more detail.</p>
</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-HoldGIL">
<ttclass="descname">HoldGIL</tt><aclass="headerlink"href="#fanno-HoldGIL"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation specifies that the Python Global Interpreter Lock
(GIL) is not released before the call to the underlying C or C++ function.
See <aclass="reference external"href="using.html#ref-gil"><em>The Python Global Interpreter Lock</em></a> and the <aclass="reference internal"href="#fanno-ReleaseGIL"><ttclass="xref docutils literal"><spanclass="pre">ReleaseGIL</span></tt></a> annotation.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-KeywordArgs">
<ttclass="descname">KeywordArgs</tt><aclass="headerlink"href="#fanno-KeywordArgs"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.</span></p>
<p>This boolean annotation specifies that the argument parser generated for
this function will support passing the parameters using Python’s keyword
argument syntax. Keyword arguments cannot be used for functions that have
unnamed arguments or use an ellipsis to designate that the function has a
variable number of arguments.</p>
</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-__len__">
<ttclass="descname">__len__</tt><aclass="headerlink"href="#fanno-__len__"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.3.</span></p>
<p>This boolean annotation specifies that a <ttclass="docutils literal"><spanclass="pre">__len__()</span></tt> method should be
automatically generated that will use the method being annotated to compute
the value that the <ttclass="docutils literal"><spanclass="pre">__len__()</span></tt> method will return.</p>
</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-NewThread">
<ttclass="descname">NewThread</tt><aclass="headerlink"href="#fanno-NewThread"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation specifies that the function will create a new
thread.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-NoArgParser">
<ttclass="descname">NoArgParser</tt><aclass="headerlink"href="#fanno-NoArgParser"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is used with methods and global functions to
specify that the supplied <aclass="reference external"href="directives.html#directive-%MethodCode"><ttclass="xref docutils literal"><spanclass="pre">%MethodCode</span></tt></a> will handle the parsing
of the arguments.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-NoCopy">
<ttclass="descname">NoCopy</tt><aclass="headerlink"href="#fanno-NoCopy"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.1.</span></p>
<p>This boolean annotation is used with methods and global functions that
return a <ttclass="docutils literal"><spanclass="pre">const</span></tt> reference to a class. Normally, if the class defines a
copy constructor then a copy of the returned reference is automatically
created and wrapped. The copy will be owned by Python.</p>
<p>If the annotation is specified then the copy is not made and the original
reference is wrapped instead and will be owned by C++.</p>
</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-NoDerived">
<ttclass="descname">NoDerived</tt><aclass="headerlink"href="#fanno-NoDerived"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation is only used with C++ constructors. In many cases
SIP generates a derived class for each class being wrapped (see
<aclass="reference external"href="c_api.html#ref-derived-classes"><em>Generated Derived Classes</em></a>). This derived class contains constructors with
the same C++ signatures as the class being wrapped. Sometimes you may want
to define a Python constructor that has no corresponding C++ constructor.
This annotation is used to suppress the generation of the constructor in
the derived class.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-NoKeywordArgs">
<ttclass="descname">NoKeywordArgs</tt><aclass="headerlink"href="#fanno-NoKeywordArgs"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.</span></p>
<p>This boolean annotation specifies that the argument parser generated for
this function will not support passing the parameters using Python’s
keyword argument syntax. In other words, the argument parser will only
support only normal positional arguments. This annotation is useful when
the default setting of allowing keyword arguments has been changed via the
command line, but you would still like certain functions to only support
positional arguments.</p>
</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-Numeric">
<ttclass="descname">Numeric</tt><aclass="headerlink"href="#fanno-Numeric"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation specifies that the operator should be interpreted
as a numeric operator rather than a sequence operator. Python uses the
<ttclass="docutils literal"><spanclass="pre">+</span></tt> operator for adding numbers and concatanating sequences, and the
<ttclass="docutils literal"><spanclass="pre">*</span></tt> operator for multiplying numbers and repeating sequences. SIP tries
to work out which is meant by looking at other operators that have been
defined for the type. If it finds either <ttclass="docutils literal"><spanclass="pre">-</span></tt>, <ttclass="docutils literal"><spanclass="pre">-=</span></tt>, <ttclass="docutils literal"><spanclass="pre">/</span></tt>, <ttclass="docutils literal"><spanclass="pre">/=</span></tt>,
<ttclass="docutils literal"><spanclass="pre">%</span></tt> or <ttclass="docutils literal"><spanclass="pre">%=</span></tt> defined then it assumes that <ttclass="docutils literal"><spanclass="pre">+</span></tt>, <ttclass="docutils literal"><spanclass="pre">+=</span></tt>, <ttclass="docutils literal"><spanclass="pre">*</span></tt> and
<ttclass="docutils literal"><spanclass="pre">*=</span></tt> should be numeric operators. Otherwise, if it finds either <ttclass="docutils literal"><spanclass="pre">[]</span></tt>,
<ttclass="xref docutils literal"><spanclass="pre">__getitem__()</span></tt>, <ttclass="xref docutils literal"><spanclass="pre">__setitem__()</span></tt> or <ttclass="xref docutils literal"><spanclass="pre">__delitem__()</span></tt> defined
then it assumes that they should be sequence operators. This annotation is
used to force SIP to treat the operator as numeric.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-PostHook">
<ttclass="descname">PostHook</tt><aclass="headerlink"href="#fanno-PostHook"title="Permalink to this definition">¶</a></dt>
<dd>This name annotation is used to specify the name of a Python builtin that
is called immediately after the call to the underlying C or C++ function or
any handwritten code. The builtin is not called if an error occurred. It
is primarily used to integrate with debuggers.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-PreHook">
<ttclass="descname">PreHook</tt><aclass="headerlink"href="#fanno-PreHook"title="Permalink to this definition">¶</a></dt>
<dd>This name annotation is used to specify the name of a Python builtin that
is called immediately after the function’s arguments have been successfully
parsed and before the call to the underlying C or C++ function or any
handwritten code. It is primarily used to integrate with debuggers.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-PyName">
<ttclass="descname">PyName</tt><aclass="headerlink"href="#fanno-PyName"title="Permalink to this definition">¶</a></dt>
<dd>This name annotation specifies an alternative name for the function being
wrapped which is used when it is referred to from Python. It is required
when a function or method name is the same as a Python keyword. It may
also be used to avoid name clashes with other objects (e.g. classes, enums,
exceptions) that have the same name in the same C++ scope.</dd></dl>
<dlclass="function-annotation">
<dtid="fanno-ReleaseGIL">
<ttclass="descname">ReleaseGIL</tt><aclass="headerlink"href="#fanno-ReleaseGIL"title="Permalink to this definition">¶</a></dt>
<dd>This boolean annotation specifies that the Python Global Interpreter Lock
(GIL) is released before the call to the underlying C or C++ function and
reacquired afterwards. It should be used for functions that might block or
take a significant amount of time to execute. See <aclass="reference external"href="using.html#ref-gil"><em>The Python Global Interpreter Lock</em></a> and the
<p>This would result in <ttclass="docutils literal"><spanclass="pre">MyBool</span></tt> being used in the generated code.</p>
<p>Specifying the annotation means that <ttclass="docutils literal"><spanclass="pre">bool</span></tt> will be used in the generated
code instead.</p>
</dd></dl>
</div>
<divclass="section"id="variable-annotations">
<spanid="ref-variable-annos"></span><h2>Variable Annotations<aclass="headerlink"href="#variable-annotations"title="Permalink to this headline">¶</a></h2>
<dlclass="variable-annotation">
<dtid="vanno-DocType">
<ttclass="descname">DocType</tt><aclass="headerlink"href="#vanno-DocType"title="Permalink to this definition">¶</a></dt>
<dd><p>
<spanclass="versionmodified">New in version 4.10.</span></p>
<p>This string annotation specifies the name of the type of the variable as it
will appear in any generated docstrings. It is usually used with variables
of type <aclass="reference external"href="specification_files.html#stype-SIP_PYOBJECT"><ttclass="xref docutils literal"><spanclass="pre">SIP_PYOBJECT</span></tt></a> to provide a more specific type.</p>
</dd></dl>
<dlclass="variable-annotation">
<dtid="vanno-PyName">
<ttclass="descname">PyName</tt><aclass="headerlink"href="#vanno-PyName"title="Permalink to this definition">¶</a></dt>
<dd>This name annotation specifies an alternative name for the variable being
wrapped which is used when it is referred to from Python. It is required
when a variable name is the same as a Python keyword. It may also be used
to avoid name clashes with other objects (e.g. classes, functions) that
have the same name in the same C++ scope.</dd></dl>
</div>
</div>
</div>
</div>
</div>
<divclass="sphinxsidebar">
<divclass="sphinxsidebarwrapper">
<h3><ahref="index.html">Table Of Contents</a></h3>