diff options
author | Miodrag Milanović <mmicko@gmail.com> | 2021-01-02 11:16:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-02 11:16:49 +0100 |
commit | 9b9628047c01a970cfe20f83f2b7129ed109440d (patch) | |
tree | 1db418e9a889dc6fbe6199c5259aac9bd8cbb32f /3rdparty/pybind11/tests/pybind11_tests.h | |
parent | c6cdf30501dcb2da01361229dd66a05dad73a132 (diff) | |
parent | 61b07bc9a664d6a88b85aae99f9756d7569688a9 (diff) | |
download | nextpnr-9b9628047c01a970cfe20f83f2b7129ed109440d.tar.gz nextpnr-9b9628047c01a970cfe20f83f2b7129ed109440d.tar.bz2 nextpnr-9b9628047c01a970cfe20f83f2b7129ed109440d.zip |
Merge pull request #549 from YosysHQ/update
Update pybind11 version and fix for future python versions
Diffstat (limited to '3rdparty/pybind11/tests/pybind11_tests.h')
-rw-r--r-- | 3rdparty/pybind11/tests/pybind11_tests.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/3rdparty/pybind11/tests/pybind11_tests.h b/3rdparty/pybind11/tests/pybind11_tests.h index 90963a5d..4ff56c07 100644 --- a/3rdparty/pybind11/tests/pybind11_tests.h +++ b/3rdparty/pybind11/tests/pybind11_tests.h @@ -10,7 +10,7 @@ namespace py = pybind11; using namespace pybind11::literals; class test_initializer { - using Initializer = void (*)(py::module &); + using Initializer = void (*)(py::module_ &); public: test_initializer(Initializer init); @@ -18,9 +18,9 @@ public: }; #define TEST_SUBMODULE(name, variable) \ - void test_submodule_##name(py::module &); \ + void test_submodule_##name(py::module_ &); \ test_initializer name(#name, test_submodule_##name); \ - void test_submodule_##name(py::module &variable) + void test_submodule_##name(py::module_ &variable) /// Dummy type which is not exported anywhere -- something to trigger a conversion error @@ -50,16 +50,22 @@ public: IncType &operator=(IncType &&) = delete; }; +/// A simple union for basic testing +union IntFloat { + int i; + float f; +}; + /// Custom cast-only type that casts to a string "rvalue" or "lvalue" depending on the cast context. /// Used to test recursive casters (e.g. std::tuple, stl containers). struct RValueCaster {}; -NAMESPACE_BEGIN(pybind11) -NAMESPACE_BEGIN(detail) +PYBIND11_NAMESPACE_BEGIN(pybind11) +PYBIND11_NAMESPACE_BEGIN(detail) template<> class type_caster<RValueCaster> { public: PYBIND11_TYPE_CASTER(RValueCaster, _("RValueCaster")); static handle cast(RValueCaster &&, return_value_policy, handle) { return py::str("rvalue").release(); } static handle cast(const RValueCaster &, return_value_policy, handle) { return py::str("lvalue").release(); } }; -NAMESPACE_END(detail) -NAMESPACE_END(pybind11) +PYBIND11_NAMESPACE_END(detail) +PYBIND11_NAMESPACE_END(pybind11) |