aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tests/test_eval.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/pybind11/tests/test_eval.cpp')
-rw-r--r--3rdparty/pybind11/tests/test_eval.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/3rdparty/pybind11/tests/test_eval.cpp b/3rdparty/pybind11/tests/test_eval.cpp
index e0948219..5416c2ec 100644
--- a/3rdparty/pybind11/tests/test_eval.cpp
+++ b/3rdparty/pybind11/tests/test_eval.cpp
@@ -14,7 +14,7 @@
TEST_SUBMODULE(eval_, m) {
// test_evals
- auto global = py::dict(py::module::import("__main__").attr("__dict__"));
+ auto global = py::dict(py::module_::import("__main__").attr("__dict__"));
m.def("test_eval_statements", [global]() {
auto local = py::dict();
@@ -88,4 +88,12 @@ TEST_SUBMODULE(eval_, m) {
}
return false;
});
+
+ // test_eval_empty_globals
+ m.def("eval_empty_globals", [](py::object global) {
+ if (global.is_none())
+ global = py::dict();
+ auto int_class = py::eval("isinstance(42, int)", global);
+ return global;
+ });
}