Replace error printing code gated by NDEBUG with a new flag: PYBIND11_DETAILED_ERROR_MESSAGES (#3913)

* Update cast.h

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Move definition to detail/common, change name, apply everywhere

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename debug_enabled in tests to detailed_error_messages_enabled
This commit is contained in:
Michael Voznesensky
2022-05-02 12:30:19 -07:00
committed by GitHub
parent 75007dda72
commit f0b9f755e4
10 changed files with 82 additions and 66 deletions

View File

@@ -361,10 +361,10 @@ TEST_SUBMODULE(methods_and_attributes, m) {
// test_bad_arg_default
// Issue/PR #648: bad arg default debugging output
#if !defined(NDEBUG)
m.attr("debug_enabled") = true;
#if defined(PYBIND11_DETAILED_ERROR_MESSAGES)
m.attr("detailed_error_messages_enabled") = true;
#else
m.attr("debug_enabled") = false;
m.attr("detailed_error_messages_enabled") = false;
#endif
m.def("bad_arg_def_named", [] {
auto m = py::module_::import("pybind11_tests");