MCPcopy Create free account
hub / github.com/pybind/pybind11 / ignoreOldStyleInitWarnings

Function ignoreOldStyleInitWarnings

tests/pybind11_tests.h:88–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86
87template <typename F>
88void ignoreOldStyleInitWarnings(F &&body) {
89 py::exec(R"(
90 message = "pybind11-bound class '.+' is using an old-style placement-new '(?:__init__|__setstate__)' which has been deprecated"
91
92 import warnings
93 with warnings.catch_warnings():
94 warnings.filterwarnings("ignore", message=message, category=FutureWarning)
95 body()
96 )",
97 py::dict(py::arg("body") = py::cpp_function(body)));
98}
99
100// See PR #5419 for background.
101class TestContext {

Callers 2

TEST_SUBMODULEFunction · 0.85
PYBIND11_OVERRIDEFunction · 0.85

Calls 4

execFunction · 0.85
dictClass · 0.85
cpp_functionClass · 0.85
argClass · 0.50

Tested by

no test coverage detected