3#include <pybind11/eval.h>
4#include <pybind11/pybind11.h>
6#if defined(_MSC_VER) && _MSC_VER < 1910
13using namespace pybind11::literals;
23#define TEST_SUBMODULE(name, variable) \
24 void test_submodule_##name(py::module_ &); \
25 test_initializer name(#name, test_submodule_##name); \
26 void test_submodule_##name(py::module_ &(variable))
71 return py::str(
"rvalue").release();
74 return py::str(
"lvalue").release();
83 message = "pybind11-bound class '.+' is using an old-style placement-new '(?:__init__|__setstate__)' which has been deprecated"
86 with warnings.catch_warnings():
87 warnings.filterwarnings("ignore", message=message, category=FutureWarning)
90 py::dict(py::arg("body") = py::cpp_function(body)));
Like UserType, but increments value on copy for quick reference vs. copy tests.
IncType(const IncType &other)
IncType & operator=(IncType &&)=delete
IncType & operator=(const IncType &)=delete
IncType(IncType &&)=delete
A user-defined type which is exported and can be used by any test.
\rst Holds a reference to a Python object (no reference counting)
void(*)(py::module_ &) Initializer
static handle cast(const RValueCaster &, return_value_policy, handle)
static handle cast(RValueCaster &&, return_value_policy, handle)
PYBIND11_TYPE_CASTER(RValueCaster, const_name("RValueCaster"))
#define PYBIND11_NAMESPACE_END(name)
#define PYBIND11_NAMESPACE_BEGIN(name)
return_value_policy
Approach used to cast a previously unknown C++ instance into a Python object.
constexpr descr< N - 1 > const_name(char const (&text)[N])
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
void ignoreOldStyleInitWarnings(F &&body)
Custom cast-only type that casts to a string "rvalue" or "lvalue" depending on the cast context.
Dummy type which is not exported anywhere – something to trigger a conversion error.
A simple union for basic testing.