cppexception: translate C++ exceptions into Python¶
- class pybindgen.cppexception.CppException(name, parent=None, outer_class=None, custom_name=None, foreign_cpp_namespace=None, message_rvalue=None)¶
Bases: object
Parameters: - name – exception class name
- parent – optional parent class wrapper
- custom_name – an alternative name to give to this exception class at python-side; if omitted, the name of the class in the python module will be the same name as the class in C++ (minus namespace).
- foreign_cpp_namespace – if set, the class is assumed to belong to the given C++ namespace, regardless of the C++ namespace of the python module it will be added to. For instance, this can be useful to wrap std classes, like std::ofstream, without having to create an extra python submodule.
- message_rvalue – if not None, this parameter is a string that contains an rvalue C expression that evaluates to the exception message. The Python % operator will be used to substitute %(EXC)s for the caught exception variable name. The rvalue expression must return a string of type “char const*”, a pointer owned by the exception instance.
- generate(code_sink, module, docstring=None)¶
Generates the class to a code sink
- generate_forward_declarations(code_sink, dummy_module)¶
- get_module()¶
Get the Module object this type belongs to
- module¶
Get the Module object this type belongs to
- python_full_name¶
- python_name¶
- set_module(module)¶
Set the Module object this type belongs to
- write_convert_to_python(code_block, variable_name)¶