attr.h
Go to the documentation of this file.
1 /*
2  pybind11/attr.h: Infrastructure for processing custom
3  type and function attributes
4 
5  Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
6 
7  All rights reserved. Use of this source code is governed by a
8  BSD-style license that can be found in the LICENSE file.
9 */
10 
11 #pragma once
12 
13 #include "detail/common.h"
14 #include "cast.h"
15 
16 #include <functional>
17 
19 
20 
24 struct is_method {
26  explicit is_method(const handle &c) : class_(c) {}
27 };
28 
30 struct is_operator {};
31 
33 struct is_final {};
34 
36 struct scope {
38  explicit scope(const handle &s) : value(s) {}
39 };
40 
42 struct doc {
43  const char *value;
44  explicit doc(const char *value) : value(value) {}
45 };
46 
48 struct name {
49  const char *value;
50  explicit name(const char *value) : value(value) {}
51 };
52 
54 struct sibling {
56  explicit sibling(const handle &value) : value(value.ptr()) {}
57 };
58 
60 template <typename T>
61 struct base {
62 
64  "base<T>() was deprecated in favor of specifying 'T' as a template argument to class_")
65  base() = default;
66 };
67 
69 template <size_t Nurse, size_t Patient>
70 struct keep_alive {};
71 
74 
76 struct dynamic_attr {};
77 
79 struct buffer_protocol {};
80 
82 struct metaclass {
84 
85  PYBIND11_DEPRECATED("py::metaclass() is no longer required. It's turned on by default now.")
86  metaclass() = default;
87 
89  explicit metaclass(handle value) : value(value) {}
90 };
91 
102  using callback = std::function<void(PyHeapTypeObject *heap_type)>;
103 
104  explicit custom_type_setup(callback value) : value(std::move(value)) {}
105 
107 };
108 
110 struct module_local {
111  const bool value;
112  constexpr explicit module_local(bool v = true) : value(v) {}
113 };
114 
116 struct arithmetic {};
117 
119 struct prepend {};
120 
139 template <typename... Ts>
140 struct call_guard;
141 
142 template <>
143 struct call_guard<> {
144  using type = detail::void_type;
145 };
146 
147 template <typename T>
148 struct call_guard<T> {
150  "The guard type must be default constructible");
151 
152  using type = T;
153 };
154 
155 template <typename T, typename... Ts>
156 struct call_guard<T, Ts...> {
157  struct type {
158  T guard{}; // Compose multiple guard types with left-to-right default-constructor order
159  typename call_guard<Ts...>::type next{};
160  };
161 };
162 
164 
166 /* Forward declarations */
167 enum op_id : int;
168 enum op_type : int;
169 struct undefined_t;
170 template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>
171 struct op_;
172 void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret);
173 
176  const char *name;
177  const char *descr;
179  bool convert : 1;
180  bool none : 1;
181 
182  argument_record(const char *name, const char *descr, handle value, bool convert, bool none)
183  : name(name), descr(descr), value(value), convert(convert), none(none) {}
184 };
185 
190  : is_constructor(false), is_new_style_constructor(false), is_stateless(false),
191  is_operator(false), is_method(false), has_args(false), has_kwargs(false),
192  prepend(false) {}
193 
195  char *name = nullptr; /* why no C++ strings? They generate heavier code.. */
196 
197  // User-specified documentation string
198  char *doc = nullptr;
199 
201  char *signature = nullptr;
202 
204  std::vector<argument_record> args;
205 
207  handle (*impl)(function_call &) = nullptr;
208 
210  void *data[3] = {};
211 
213  void (*free_data)(function_record *ptr) = nullptr;
214 
217 
219  bool is_constructor : 1;
220 
223 
225  bool is_stateless : 1;
226 
228  bool is_operator : 1;
229 
231  bool is_method : 1;
232 
234  bool has_args : 1;
235 
237  bool has_kwargs : 1;
238 
240  bool prepend : 1;
241 
244 
247  std::uint16_t nargs_pos = 0;
248 
250  std::uint16_t nargs_pos_only = 0;
251 
253  PyMethodDef *def = nullptr;
254 
257 
260 
262  function_record *next = nullptr;
263 };
264 
266 struct type_record {
268  : multiple_inheritance(false), dynamic_attr(false), buffer_protocol(false),
269  default_holder(true), module_local(false), is_final(false) {}
270 
273 
275  const char *name = nullptr;
276 
277  // Pointer to RTTI type_info data structure
278  const std::type_info *type = nullptr;
279 
281  size_t type_size = 0;
282 
284  size_t type_align = 0;
285 
287  size_t holder_size = 0;
288 
290  void *(*operator_new)(size_t) = nullptr;
291 
293  void (*init_instance)(instance *, const void *) = nullptr;
294 
296  void (*dealloc)(detail::value_and_holder &) = nullptr;
297 
300 
302  const char *doc = nullptr;
303 
306 
309 
312 
314  bool dynamic_attr : 1;
315 
317  bool buffer_protocol : 1;
318 
320  bool default_holder : 1;
321 
323  bool module_local : 1;
324 
326  bool is_final : 1;
327 
328  PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *) ) {
329  auto *base_info = detail::get_type_info(base, false);
330  if (!base_info) {
331  std::string tname(base.name());
332  detail::clean_type_id(tname);
333  pybind11_fail("generic_type: type \"" + std::string(name)
334  + "\" referenced unknown base type \"" + tname + "\"");
335  }
336 
337  if (default_holder != base_info->default_holder) {
338  std::string tname(base.name());
339  detail::clean_type_id(tname);
340  pybind11_fail("generic_type: type \"" + std::string(name) + "\" "
341  + (default_holder ? "does not have" : "has")
342  + " a non-default holder type while its base \"" + tname + "\" "
343  + (base_info->default_holder ? "does not" : "does"));
344  }
345 
346  bases.append((PyObject *) base_info->type);
347 
348 #if PY_VERSION_HEX < 0x030B0000
349  dynamic_attr |= base_info->type->tp_dictoffset != 0;
350 #else
351  dynamic_attr |= (base_info->type->tp_flags & Py_TPFLAGS_MANAGED_DICT) != 0;
352 #endif
353 
354  if (caster) {
355  base_info->implicit_casts.emplace_back(type, caster);
356  }
357  }
358 };
359 
360 inline function_call::function_call(const function_record &f, handle p) : func(f), parent(p) {
361  args.reserve(f.nargs);
362  args_convert.reserve(f.nargs);
363 }
364 
367 
374 template <typename T, typename SFINAE = void>
376 
377 template <typename T>
380  static void init(const T &, function_record *) {}
381  static void init(const T &, type_record *) {}
382  static void precall(function_call &) {}
383  static void postcall(function_call &, handle) {}
384 };
385 
387 template <>
389  static void init(const name &n, function_record *r) { r->name = const_cast<char *>(n.value); }
390 };
391 
393 template <>
395  static void init(const doc &n, function_record *r) { r->doc = const_cast<char *>(n.value); }
396 };
397 
399 template <>
401  static void init(const char *d, function_record *r) { r->doc = const_cast<char *>(d); }
402  static void init(const char *d, type_record *r) { r->doc = const_cast<char *>(d); }
403 };
404 template <>
406 
408 template <>
410  static void init(const return_value_policy &p, function_record *r) { r->policy = p; }
411 };
412 
415 template <>
417  static void init(const sibling &s, function_record *r) { r->sibling = s.value; }
418 };
419 
421 template <>
423  static void init(const is_method &s, function_record *r) {
424  r->is_method = true;
425  r->scope = s.class_;
426  }
427 };
428 
430 template <>
432  static void init(const scope &s, function_record *r) { r->scope = s.value; }
433 };
434 
436 template <>
438  static void init(const is_operator &, function_record *r) { r->is_operator = true; }
439 };
440 
441 template <>
443  : process_attribute_default<is_new_style_constructor> {
444  static void init(const is_new_style_constructor &, function_record *r) {
445  r->is_new_style_constructor = true;
446  }
447 };
448 
449 inline void check_kw_only_arg(const arg &a, function_record *r) {
450  if (r->args.size() > r->nargs_pos && (!a.name || a.name[0] == '\0')) {
451  pybind11_fail("arg(): cannot specify an unnamed argument after a kw_only() annotation or "
452  "args() argument");
453  }
454 }
455 
457  if (r->is_method && r->args.empty()) {
458  r->args.emplace_back("self", nullptr, handle(), /*convert=*/true, /*none=*/false);
459  }
460 }
461 
463 template <>
465  static void init(const arg &a, function_record *r) {
467  r->args.emplace_back(a.name, nullptr, handle(), !a.flag_noconvert, a.flag_none);
468 
469  check_kw_only_arg(a, r);
470  }
471 };
472 
474 template <>
476  static void init(const arg_v &a, function_record *r) {
477  if (r->is_method && r->args.empty()) {
478  r->args.emplace_back(
479  "self", /*descr=*/nullptr, /*parent=*/handle(), /*convert=*/true, /*none=*/false);
480  }
481 
482  if (!a.value) {
483 #if defined(PYBIND11_DETAILED_ERROR_MESSAGES)
484  std::string descr("'");
485  if (a.name) {
486  descr += std::string(a.name) + ": ";
487  }
488  descr += a.type + "'";
489  if (r->is_method) {
490  if (r->name) {
491  descr += " in method '" + (std::string) str(r->scope) + "."
492  + (std::string) r->name + "'";
493  } else {
494  descr += " in method of '" + (std::string) str(r->scope) + "'";
495  }
496  } else if (r->name) {
497  descr += " in function '" + (std::string) r->name + "'";
498  }
499  pybind11_fail("arg(): could not convert default argument " + descr
500  + " into a Python object (type not registered yet?)");
501 #else
502  pybind11_fail("arg(): could not convert default argument "
503  "into a Python object (type not registered yet?). "
504  "#define PYBIND11_DETAILED_ERROR_MESSAGES or compile in debug mode for "
505  "more information.");
506 #endif
507  }
508  r->args.emplace_back(a.name, a.descr, a.value.inc_ref(), !a.flag_noconvert, a.flag_none);
509 
510  check_kw_only_arg(a, r);
511  }
512 };
513 
515 template <>
517  static void init(const kw_only &, function_record *r) {
519  if (r->has_args && r->nargs_pos != static_cast<std::uint16_t>(r->args.size())) {
520  pybind11_fail("Mismatched args() and kw_only(): they must occur at the same relative "
521  "argument location (or omit kw_only() entirely)");
522  }
523  r->nargs_pos = static_cast<std::uint16_t>(r->args.size());
524  }
525 };
526 
528 template <>
530  static void init(const pos_only &, function_record *r) {
532  r->nargs_pos_only = static_cast<std::uint16_t>(r->args.size());
533  if (r->nargs_pos_only > r->nargs_pos) {
534  pybind11_fail("pos_only(): cannot follow a py::args() argument");
535  }
536  // It also can't follow a kw_only, but a static_assert in pybind11.h checks that
537  }
538 };
539 
542 template <typename T>
544  : process_attribute_default<handle> {
545  static void init(const handle &h, type_record *r) { r->bases.append(h); }
546 };
547 
549 template <typename T>
551  static void init(const base<T> &, type_record *r) { r->add_base(typeid(T), nullptr); }
552 };
553 
555 template <>
557  static void init(const multiple_inheritance &, type_record *r) {
558  r->multiple_inheritance = true;
559  }
560 };
561 
562 template <>
564  static void init(const dynamic_attr &, type_record *r) { r->dynamic_attr = true; }
565 };
566 
567 template <>
569  static void init(const custom_type_setup &value, type_record *r) {
571  }
572 };
573 
574 template <>
576  static void init(const is_final &, type_record *r) { r->is_final = true; }
577 };
578 
579 template <>
581  static void init(const buffer_protocol &, type_record *r) { r->buffer_protocol = true; }
582 };
583 
584 template <>
585 struct process_attribute<metaclass> : process_attribute_default<metaclass> {
586  static void init(const metaclass &m, type_record *r) { r->metaclass = m.value; }
587 };
588 
589 template <>
591  static void init(const module_local &l, type_record *r) { r->module_local = l.value; }
592 };
593 
595 template <>
597  static void init(const prepend &, function_record *r) { r->prepend = true; }
598 };
599 
601 template <>
603 
604 template <typename... Ts>
605 struct process_attribute<call_guard<Ts...>> : process_attribute_default<call_guard<Ts...>> {};
606 
612 template <size_t Nurse, size_t Patient>
613 struct process_attribute<keep_alive<Nurse, Patient>>
614  : public process_attribute_default<keep_alive<Nurse, Patient>> {
615  template <size_t N = Nurse, size_t P = Patient, enable_if_t<N != 0 && P != 0, int> = 0>
616  static void precall(function_call &call) {
617  keep_alive_impl(Nurse, Patient, call, handle());
618  }
619  template <size_t N = Nurse, size_t P = Patient, enable_if_t<N != 0 && P != 0, int> = 0>
620  static void postcall(function_call &, handle) {}
621  template <size_t N = Nurse, size_t P = Patient, enable_if_t<N == 0 || P == 0, int> = 0>
622  static void precall(function_call &) {}
623  template <size_t N = Nurse, size_t P = Patient, enable_if_t<N == 0 || P == 0, int> = 0>
624  static void postcall(function_call &call, handle ret) {
625  keep_alive_impl(Nurse, Patient, call, ret);
626  }
627 };
628 
630 template <typename... Args>
632  static void init(const Args &...args, function_record *r) {
635  using expander = int[];
636  (void) expander{
637  0, ((void) process_attribute<typename std::decay<Args>::type>::init(args, r), 0)...};
638  }
639  static void init(const Args &...args, type_record *r) {
642  using expander = int[];
643  (void) expander{0,
645  }
646  static void precall(function_call &call) {
648  using expander = int[];
649  (void) expander{0,
650  (process_attribute<typename std::decay<Args>::type>::precall(call), 0)...};
651  }
652  static void postcall(function_call &call, handle fn_ret) {
655  using expander = int[];
656  (void) expander{
657  0, (process_attribute<typename std::decay<Args>::type>::postcall(call, fn_ret), 0)...};
658  }
659 };
660 
661 template <typename T>
663 
665 template <typename... Extra>
667 
669 template <typename... Extra,
672 constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs) {
673  PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(nargs, has_args, has_kwargs);
674  return named == 0 || (self + named + size_t(has_args) + size_t(has_kwargs)) == nargs;
675 }
676 
handle scope
Python handle to the parent scope (a class or a module)
Definition: attr.h:256
PYBIND11_NOINLINE detail::type_info * get_type_info(PyTypeObject *type)
static void precall(function_call &)
Definition: attr.h:382
Matrix3f m
constexpr module_local(bool v=true)
Definition: attr.h:112
Annotation which enables dynamic attributes, i.e. adds __dict__ to a class.
Definition: attr.h:76
void check_kw_only_arg(const arg &a, function_record *r)
Definition: attr.h:449
handle class_
Definition: attr.h:25
Annotation for parent scope.
Definition: attr.h:36
#define PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(...)
bool is_final
Is the class inheritable from python classes?
Definition: attr.h:326
std::uint16_t nargs
Number of arguments (including py::args and/or py::kwargs, if present)
Definition: attr.h:243
Operator implementation generator.
Definition: attr.h:171
is_method(const handle &c)
Definition: attr.h:26
PYBIND11_NOINLINE type_record()
Definition: attr.h:267
static void postcall(function_call &call, handle ret)
Definition: attr.h:624
Keep patient alive while nurse lives.
Definition: attr.h:70
static void init(const scope &s, function_record *r)
Definition: attr.h:432
return_value_policy policy
Return value policy associated with this function.
Definition: attr.h:216
PYBIND11_DEPRECATED("make_simple_namespace should be replaced with " "py::module_::import(\ypes\.attr(\impleNamespace\ ") object make_simple_namespace(Args &&...args_)
Definition: pybind11.h:1276
static void init(const buffer_protocol &, type_record *r)
Definition: attr.h:581
handle sibling
Python handle to the sibling function representing an overload chain.
Definition: attr.h:259
Annotation which requests that a special metaclass is created for a type.
Definition: attr.h:82
static void init(const doc &n, function_record *r)
Definition: attr.h:395
Definition: pytypes.h:2012
Annotation for documentation.
Definition: attr.h:42
Definition: cast.h:1265
Tag for a new-style __init__ defined in detail/init.h
Definition: attr.h:366
Type for an unused type slot.
Definition: operators.h:75
int n
static void init(const kw_only &, function_record *r)
Definition: attr.h:517
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
handle value
Definition: attr.h:83
object value
The default value.
Definition: cast.h:1309
bool buffer_protocol
Does the class implement the buffer protocol?
Definition: attr.h:317
static void init(const arg_v &a, function_record *r)
Definition: attr.h:476
static void init(const dynamic_attr &, type_record *r)
Definition: attr.h:564
argument_record(const char *name, const char *descr, handle value, bool convert, bool none)
Definition: attr.h:182
const char * doc
Optional docstring.
Definition: attr.h:302
sibling(const handle &value)
Definition: attr.h:56
static void init(const custom_type_setup &value, type_record *r)
Definition: attr.h:569
bool multiple_inheritance
Multiple inheritance marker.
Definition: attr.h:311
const char * value
Definition: attr.h:43
Annotation for operators.
Definition: attr.h:30
Definition: BFloat16.h:88
unsigned short uint16_t
Definition: ms_stdint.h:84
static void postcall(function_call &, handle)
Definition: attr.h:620
static void postcall(function_call &call, handle fn_ret)
Definition: attr.h:652
static void init(const prepend &, function_record *r)
Definition: attr.h:597
static void init(const char *d, type_record *r)
Definition: attr.h:402
typename exactly_one< Predicate, Default, Ts... >::type exactly_one_t
Definition: cast.h:1238
static void init(const arg &a, function_record *r)
Definition: attr.h:465
PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *))
Definition: attr.h:328
Internal data associated with a single function call.
Definition: cast.h:1355
handle value
Associated Python object.
Definition: attr.h:178
static void init(const base< T > &, type_record *r)
Definition: attr.h:551
The &#39;instance&#39; type which needs to be standard layout (need to be able to use &#39;offsetof&#39;) ...
Definition: pytypes.h:1614
op_id
Enumeration with all supported operator types.
Definition: operators.h:18
Process an attribute specifying the function&#39;s docstring (provided as a C-style string) ...
Definition: attr.h:400
PYBIND11_NOINLINE void clean_type_id(std::string &name)
Definition: typeid.h:35
std::function< void(PyHeapTypeObject *heap_type)> callback
Definition: attr.h:102
constexpr size_t constexpr_sum()
Compile-time integer sum.
PyExc_RuntimeError [[noreturn]] PYBIND11_NOINLINE void pybind11_fail(const char *reason)
Used internally.
custom_type_setup::callback custom_type_setup_callback
Custom type setup.
Definition: attr.h:308
static void init(const sibling &s, function_record *r)
Definition: attr.h:417
const handle & inc_ref() const &
Definition: pytypes.h:246
custom_type_setup(callback value)
Definition: attr.h:104
bool has_kwargs
True if the function has a &#39;**kwargs&#39; argument.
Definition: attr.h:237
const char * descr
Human-readable version of the argument value.
Definition: attr.h:177
bool convert
True if the argument is allowed to convert when loading.
Definition: attr.h:179
handle metaclass
Custom metaclass (optional)
Definition: attr.h:305
static void init(const module_local &l, type_record *r)
Definition: attr.h:591
static const Line3 l(Rot3(), 1, 1)
Definition: descr.h:25
void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret)
Definition: pybind11.h:2219
handle value
Definition: attr.h:55
const char * name
Argument name.
Definition: attr.h:176
static void init(const Args &...args, type_record *r)
Definition: attr.h:639
handle scope
Handle to the parent scope.
Definition: attr.h:272
static void init(const is_final &, type_record *r)
Definition: attr.h:576
Definition: cast.h:1321
static void init(const pos_only &, function_record *r)
Definition: attr.h:530
Annotation that marks a class as local to the module:
Definition: attr.h:110
bool is_stateless
True if this is a stateless function pointer.
Definition: attr.h:225
std::uint16_t nargs_pos_only
Number of leading arguments (counted in nargs) that are positional-only.
Definition: attr.h:250
void append(T &&val)
Definition: pytypes.h:2000
list bases
List of base classes of the newly created type.
Definition: attr.h:299
function_call(const function_record &f, handle p)
Definition: attr.h:360
std::vector< bool > args_convert
The convert value the arguments should be loaded with.
Definition: cast.h:1365
std::uint16_t nargs_pos
Definition: attr.h:247
Array< int, Dynamic, 1 > v
static void init(const T &, function_record *)
Default implementation: do nothing.
Definition: attr.h:380
static void precall(function_call &call)
Definition: attr.h:646
Eigen::Triplet< double > T
int data[]
constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs)
Check the number of named arguments at compile time.
Definition: attr.h:672
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
bool is_method
True if this is a method.
Definition: attr.h:231
bool is_constructor
True if name == &#39;init&#39;.
Definition: attr.h:219
Recursively iterate over variadic template arguments.
Definition: attr.h:631
RealScalar s
#define PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(...)
bool module_local
Is the class definition local to the module shared object?
Definition: attr.h:323
static void precall(function_call &call)
Definition: attr.h:616
Annotation which enables the buffer protocol for a type.
Definition: attr.h:79
const char * value
Definition: attr.h:49
static void init(const name &n, function_record *r)
Definition: attr.h:389
static void init(const T &, type_record *)
Definition: attr.h:381
static void init(const handle &h, type_record *r)
Definition: attr.h:545
DenseIndex ret
bool prepend
True if this function is to be inserted at the beginning of the overload resolution chain...
Definition: attr.h:240
Definition: pytypes.h:1979
bool none
True if None is allowed when loading.
Definition: attr.h:180
static void init(const Args &...args, function_record *r)
Definition: attr.h:632
function_record()
Definition: attr.h:189
name(const char *value)
Definition: attr.h:50
Annotation indicating that a class is involved in a multiple inheritance relationship.
Definition: attr.h:73
static void init(const is_operator &, function_record *r)
Definition: attr.h:438
void append_self_arg_if_needed(function_record *r)
Definition: attr.h:456
const double h
Annotation to mark enums as an arithmetic type.
Definition: attr.h:116
static void init(const metaclass &m, type_record *r)
Definition: attr.h:586
const bool value
Definition: attr.h:111
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) ...
Definition: attr.h:666
Annotation for classes that cannot be subclassed.
Definition: attr.h:33
static void init(const is_method &s, function_record *r)
Definition: attr.h:423
Special data structure which (temporarily) holds metadata about a bound class.
Definition: attr.h:266
Annotation for methods.
Definition: attr.h:24
doc(const char *value)
Definition: attr.h:44
static void init(const char *d, function_record *r)
Definition: attr.h:401
bool default_holder
Is the default (unique_ptr) holder type used?
Definition: attr.h:320
static void postcall(function_call &, handle)
Definition: attr.h:383
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
Definition: pybind11.h:1882
char * doc
Definition: attr.h:198
std::vector< argument_record > args
List of registered keyword arguments.
Definition: attr.h:204
static void init(const return_value_policy &p, function_record *r)
Definition: attr.h:410
float * p
char * name
Function name.
Definition: attr.h:195
bool has_args
True if the function has a &#39;*args&#39; argument.
Definition: attr.h:234
bool is_operator
True if this is an operator (add), etc.
Definition: attr.h:228
typename std::enable_if< B, T >::type enable_if_t
from cpp_future import (convenient aliases from C++14/17)
const char * descr
The (optional) description of the default value.
Definition: cast.h:1311
static void init(const is_new_style_constructor &, function_record *r)
Definition: attr.h:444
bool is_new_style_constructor
True if this is a new-style __init__ defined in detail/init.h
Definition: attr.h:222
Annotation for function names.
Definition: attr.h:48
const char * name
If non-null, this is a named kwargs argument.
Definition: cast.h:1257
Annotation indicating that a class derives from another given type.
Definition: attr.h:61
scope(const handle &s)
Definition: attr.h:38
static void init(const multiple_inheritance &, type_record *r)
Definition: attr.h:557
Mark a function for addition at the beginning of the existing overload chain instead of the end...
Definition: attr.h:119
Annotation indicating that a function is an overload associated with a given "sibling".
Definition: attr.h:54
return_value_policy
Approach used to cast a previously unknown C++ instance into a Python object.
bool flag_noconvert
Definition: cast.h:1258
op_type
Definition: operators.h:65
Internal data structure which holds metadata about a keyword argument.
Definition: attr.h:175
#define PYBIND11_NAMESPACE_END(name)
static BinaryMeasurement< Rot3 > convert(const BetweenFactor< Pose3 >::shared_ptr &f)
std::string type
The C++ type name of the default value (only available when compiled in debug mode) ...
Definition: cast.h:1314
std::is_base_of< pyobject_tag, remove_reference_t< T > > is_pyobject
Definition: pytypes.h:70
static void precall(function_call &)
Definition: attr.h:622
callback value
Definition: attr.h:106
bool dynamic_attr
Does the class manage a dict?
Definition: attr.h:314
handle value
Definition: attr.h:37
Definition: pytypes.h:1370
#define PYBIND11_NAMESPACE_BEGIN(name)
bool flag_none
If set (the default), allow None to be passed to this argument.
Definition: cast.h:1260


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:33:56