ext: Upgrade PyBind11 to version 2.2.1

This upgrade is necessary for pybind to build with GCC 7.2.

We still need to add the patch for stl.h. MSC_FULL_VER change is no longer
needed.
See https://gem5-review.googlesource.com/c/public/gem5/+/2230

Change-Id: I806729217d022070583994c2dfcaa74476aef30f
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/5801
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
Jason Lowe-Power
2017-11-17 17:02:05 -08:00
parent 3f64b374c4
commit f07d5069d8
160 changed files with 15668 additions and 7238 deletions

View File

@@ -11,7 +11,9 @@
#include <pybind11/eval.h>
#include "pybind11_tests.h"
test_initializer eval([](py::module &m) {
TEST_SUBMODULE(eval_, m) {
// test_evals
auto global = py::dict(py::module::import("__main__").attr("__dict__"));
m.def("test_eval_statements", [global]() {
@@ -20,14 +22,24 @@ test_initializer eval([](py::module &m) {
return 42;
});
auto result = py::eval<py::eval_statements>(
"print('Hello World!');\n"
"x = call_test();",
// Regular string literal
py::exec(
"message = 'Hello World!'\n"
"x = call_test()",
global, local
);
// Multi-line raw string literal
py::exec(R"(
if x == 42:
print(message)
else:
raise RuntimeError
)", global, local
);
auto x = local["x"].cast<int>();
return result == py::none() && x == 42;
return x == 42;
});
m.def("test_eval", [global]() {
@@ -45,7 +57,7 @@ test_initializer eval([](py::module &m) {
auto result = py::eval<py::eval_single_statement>("x = call_test()", py::dict(), local);
auto x = local["x"].cast<int>();
return result == py::none() && x == 42;
return result.is_none() && x == 42;
});
m.def("test_eval_file", [global](py::str filename) {
@@ -56,7 +68,7 @@ test_initializer eval([](py::module &m) {
local["call_test2"] = py::cpp_function([&](int value) { val_out = value; });
auto result = py::eval_file(filename, global, local);
return val_out == 43 && result == py::none();
return val_out == 43 && result.is_none();
});
m.def("test_eval_failure", []() {
@@ -76,4 +88,4 @@ test_initializer eval([](py::module &m) {
}
return false;
});
});
}