File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 66* The full license is in the file LICENSE, distributed with this software. *
77****************************************************************************/
88
9- #include < iostream>
109#include < string>
1110#include < vector>
1211#include < cmath>
@@ -23,6 +22,11 @@ namespace nl = nlohmann;
2322
2423using namespace pybind11 ::literals;
2524
25+ inline py::module create_module (const std::string& module_name)
26+ {
27+ return py::module_::create_extension_module (module_name.c_str (), nullptr , new py::module_::module_def);
28+ }
29+
2630TEST (nljson_serializers_tojson, none)
2731{
2832 py::scoped_interpreter guard;
@@ -429,7 +433,7 @@ inline const nl::json& test_fromtojson(const nl::json& json)
429433TEST (pybind11_caster_tojson, dict)
430434{
431435 py::scoped_interpreter guard;
432- py::module m (" test" );
436+ py::module m = create_module (" test" );
433437
434438 m.def (" to_json" , &test_fromtojson);
435439
@@ -445,7 +449,7 @@ TEST(pybind11_caster_tojson, dict)
445449TEST (pybind11_caster_fromjson, dict)
446450{
447451 py::scoped_interpreter guard;
448- py::module m (" test" );
452+ py::module m = create_module (" test" );
449453
450454 m.def (" from_json" , &test_fromtojson);
451455
You can’t perform that action at this time.
0 commit comments