Go to the documentation of this file.
67 "base<T>() was deprecated in favor of specifying 'T' as a template argument to class_")
72 template <
size_t Nurse,
size_t Patient>
88 PYBIND11_DEPRECATED(
"py::metaclass() is no longer required. It's turned on by default now.")
105 using callback = std::function<void(PyHeapTypeObject *heap_type)>;
142 template <
typename... Ts>
147 using type = detail::void_type;
150 template <
typename T>
153 "The guard type must be default constructible");
158 template <
typename T,
typename... Ts>
173 template <op_
id id, op_type ot,
typename L = undefined_t,
typename R = undefined_t>
207 std::vector<argument_record>
args;
259 PyMethodDef *
def =
nullptr;
284 const std::type_info *
type =
nullptr;
302 void (*
dealloc)(detail::value_and_holder &) =
nullptr;
308 const char *
doc =
nullptr;
337 std::string tname(
base.name());
340 +
"\" referenced unknown base type \"" + tname +
"\"");
344 std::string tname(
base.name());
348 +
" a non-default holder type while its base \"" + tname +
"\" "
349 + (base_info->default_holder ?
"does not" :
"does"));
354 #if PY_VERSION_HEX < 0x030B0000
357 dynamic_attr |= (base_info->type->tp_flags & Py_TPFLAGS_MANAGED_DICT) != 0;
361 base_info->implicit_casts.emplace_back(
type, caster);
367 args.reserve(
f.nargs);
380 template <
typename T,
typename SFINAE =
void>
383 template <
typename T>
463 pybind11_fail(
"arg(): cannot specify an unnamed argument after a kw_only() annotation or "
470 r->
args.emplace_back(
"self",
nullptr,
handle(),
true,
false);
479 r->
args.emplace_back(
a.name,
nullptr,
handle(), !
a.flag_noconvert,
a.flag_none);
490 r->
args.emplace_back(
491 "self",
nullptr,
handle(),
true,
false);
495 #if defined(PYBIND11_DETAILED_ERROR_MESSAGES)
496 std::string
descr(
"'");
498 descr += std::string(
a.name) +
": ";
504 + (std::string) r->
name +
"'";
506 descr +=
" in method of '" + (std::string)
str(r->
scope) +
"'";
508 }
else if (r->
name) {
509 descr +=
" in function '" + (std::string) r->
name +
"'";
512 +
" into a Python object (type not registered yet?)");
515 "into a Python object (type not registered yet?). "
516 "#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for "
517 "more information.");
520 r->
args.emplace_back(
a.name,
a.descr,
a.value.inc_ref(), !
a.flag_noconvert,
a.flag_none);
532 pybind11_fail(
"Mismatched args() and kw_only(): they must occur at the same relative "
533 "argument location (or omit kw_only() entirely)");
546 pybind11_fail(
"pos_only(): cannot follow a py::args() argument");
554 template <
typename T>
561 template <
typename T>
616 template <
typename... Ts>
624 template <
size_t Nurse,
size_t Patient>
627 template <
size_t N = Nurse,
size_t P = Patient, enable_if_t<N != 0 && P != 0,
int> = 0>
631 template <
size_t N = Nurse,
size_t P = Patient, enable_if_t<N != 0 && P != 0,
int> = 0>
633 template <
size_t N = Nurse,
size_t P = Patient, enable_if_t<N == 0 || P == 0,
int> = 0>
635 template <
size_t N = Nurse,
size_t P = Patient, enable_if_t<N == 0 || P == 0,
int> = 0>
642 template <
typename... Args>
647 using expander =
int[];
654 using expander =
int[];
660 using expander =
int[];
667 using expander =
int[];
673 template <
typename T>
677 template <
typename... Extra>
681 template <
typename... Extra,
686 return named == 0 || (
self + named +
size_t(has_args) +
size_t(has_kwargs)) ==
nargs;
Annotation which enables the buffer protocol for a type.
const char * doc
Optional docstring.
bool is_new_style_constructor
True if this is a new-style __init__ defined in detail/init.h
static void init(const arg &a, function_record *r)
static void init(const doc &n, function_record *r)
Annotation for function names.
Annotation indicating that a class derives from another given type.
static void init(const dynamic_attr &, type_record *r)
handle scope
Python handle to the parent scope (a class or a module)
void append_self_arg_if_needed(function_record *r)
static void init(const name &n, function_record *r)
handle sibling
Python handle to the sibling function representing an overload chain.
std::function< void(PyHeapTypeObject *heap_type)> callback
Annotation for parent scope.
PYBIND11_DEPRECATED("base<T>() was deprecated in favor of specifying 'T' as a template argument to class_") base()=default
static const double d[K][N]
std::uint16_t nargs
Number of arguments (including py::args and/or py::kwargs, if present)
return_value_policy
Approach used to cast a previously unknown C++ instance into a Python object.
bool dynamic_attr
Does the class manage a dict?
custom_type_setup(callback value)
static void init(const return_value_policy &p, function_record *r)
Annotation indicating that a class is involved in a multiple inheritance relationship.
Annotation for classes that cannot be subclassed.
Annotation for operators.
PYBIND11_NOINLINE void clean_type_id(std::string &name)
constexpr size_t constexpr_sum()
Compile-time integer sum.
static void init(const arg_v &a, function_record *r)
argument_record(const char *name, const char *descr, handle value, bool convert, bool none)
static void init(const char *d, function_record *r)
void check_kw_only_arg(const arg &a, function_record *r)
static void init(const Args &...args, type_record *r)
#define PYBIND11_NAMESPACE_END(name)
constexpr module_local(bool v=true)
#define PYBIND11_NOINLINE
Eigen::Triplet< double > T
bool has_kwargs
True if the function has a '**kwargs' argument.
function_call(const function_record &f, handle p)
void(* init_instance)(instance *, const void *)
Function pointer to class_<..>::init_instance.
#define PYBIND11_NAMESPACE_BEGIN(name)
handle value
Associated Python object.
Operator implementation generator.
return_value_policy policy
Return value policy associated with this function.
static void precall(function_call &)
size_t holder_size
How large is the type's holder?
static void init(const base< T > &, type_record *r)
op_id
Enumeration with all supported operator types.
Annotation to mark enums as an arithmetic type.
void * data[3]
Storage for the wrapped function pointer and captured data, if any.
PyMethodDef * def
Python method object.
bool module_local
Is the class definition local to the module shared object?
static void init(const handle &h, type_record *r)
Internal data structure which holds metadata about a keyword argument.
bool default_holder
Is the default (unique_ptr) holder type used?
The 'instance' type which needs to be standard layout (need to be able to use 'offsetof')
Internal data associated with a single function call.
const char * name
Argument name.
Mark a function for addition at the beginning of the existing overload chain instead of the end.
Annotation indicating that a function is an overload associated with a given "sibling".
handle metaclass
Custom metaclass (optional)
static void init(const T &, type_record *)
bool convert
True if the argument is allowed to convert when loading.
Annotation for documentation.
bool multiple_inheritance
Multiple inheritance marker.
Annotation which enables dynamic attributes, i.e. adds __dict__ to a class.
typename exactly_one< Predicate, Default, Ts... >::type exactly_one_t
bool is_method
True if this is a method.
Type for an unused type slot.
static void init(const pos_only &, function_record *r)
handle(* impl)(function_call &)
Pointer to lambda function which converts arguments and performs the actual call.
static void postcall(function_call &, handle)
static void init(const kw_only &, function_record *r)
list bases
List of base classes of the newly created type.
typename exactly_one_t< is_call_guard, call_guard<>, Extra... >::type extract_guard_t
Extract the type from the first call_guard in Extras... (or void_type if none found)
Tag for a new-style __init__ defined in detail/init.h
Process an attribute specifying the function's docstring (provided as a C-style string)
char * signature
Human-readable version of the function signature.
bool prepend
True if this function is to be inserted at the beginning of the overload resolution chain.
Special data structure which (temporarily) holds metadata about a bound class.
static const Line3 l(Rot3(), 1, 1)
Annotation that marks a class as local to the module:
static void init(const prepend &, function_record *r)
static void init(const is_method &s, function_record *r)
static void postcall(function_call &call, handle fn_ret)
static void init(const is_new_style_constructor &, function_record *r)
Keep patient alive while nurse lives.
std::uint16_t nargs_pos_only
Number of leading arguments (counted in nargs) that are positional-only.
bool is_constructor
True if name == 'init'.
static void init(const is_operator &, function_record *r)
PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *))
function_record * next
Pointer to next overload.
PYBIND11_NOINLINE detail::type_info * get_type_info(PyTypeObject *type)
const char * descr
Human-readable version of the argument value.
static void precall(function_call &)
static void postcall(function_call &call, handle ret)
static void precall(function_call &call)
PyExc_RuntimeError PYBIND11_NOINLINE void pybind11_fail(const char *reason)
Used internally.
bool none
True if None is allowed when loading.
bool has_args
True if the function has a '*args' argument.
bool is_stateless
True if this is a stateless function pointer.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
bool is_final
Is the class inheritable from python classes?
bool is_operator
True if this is an operator (add), etc.
Recursively iterate over variadic template arguments.
#define PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(...)
std::vector< argument_record > args
List of registered keyword arguments.
void(* dealloc)(detail::value_and_holder &)
Function pointer to class_<..>::dealloc.
static void init(const scope &s, function_record *r)
static void init(const T &, function_record *)
Default implementation: do nothing.
std::is_base_of< pyobject_tag, remove_reference_t< T > > is_pyobject
Array< int, Dynamic, 1 > v
void(* free_data)(function_record *ptr)
Pointer to custom destructor for 'data' (if needed)
static void init(const buffer_protocol &, type_record *r)
size_t type_align
What is the alignment of the underlying C++ type?
void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret)
handle scope
Handle to the parent scope.
static void init(const is_setter &, function_record *r)
bool buffer_protocol
Does the class implement the buffer protocol?
static void init(const char *d, type_record *r)
static void init(const module_local &l, type_record *r)
size_t type_size
How large is the underlying C++ type?
char * name
Function name.
sibling(const handle &value)
#define PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(...)
static void init(const sibling &s, function_record *r)
PYBIND11_NOINLINE type_record()
PYBIND11_DEPRECATED("make_simple_namespace should be replaced with " "py::module_::import(\"types\").attr(\"SimpleNamespace\") ") object make_simple_namespace(Args &&...args_)
static void precall(function_call &call)
bool is_setter
True if this is a setter.
static void init(const is_final &, type_record *r)
constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs)
Check the number of named arguments at compile time.
is_method(const handle &c)
static void init(const Args &...args, function_record *r)
static void postcall(function_call &, handle)
typename std::enable_if< B, T >::type enable_if_t
from cpp_future import (convenient aliases from C++14/17)
static void init(const multiple_inheritance &, type_record *r)
std::vector< bool > args_convert
The convert value the arguments should be loaded with.
static void init(const custom_type_setup &value, type_record *r)
custom_type_setup::callback custom_type_setup_callback
Custom type setup.
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:31:57